From patchwork Thu Nov 16 11:26:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13457815 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 755DFC197A0 for ; Thu, 16 Nov 2023 11:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3MX9mdx2MU8DBM0kYVIDusvIzwvargX9LVYgsgo6MpM=; b=uFan3Xj/izHiJT La/95h+XIMFTk9KUrQu2mlbXiUcVVj0zmFqj6KhP92wmEA08NgSgZEPG4Q5pwMUBrKRLYCcyiCIWd 9L8KBLzRWCoLcTKE20hnVJp4Ob4f2IAg9YaFMk87C/Shz5kGc4ePdXdyLLkK/oYR9fhWCNKWKgw1I VccyA9njQUf72PKjoVYU3TrArxYdfhPdiNzI1oM0yjIybGP+PePyMl8RrBjQiZih9Rj+4DAQBpFTO Zya7oJDgaaiSlGU0XS8xTJfJsElLs44FAjSxxdwb9wzBuvkP9H+Ilt/m41hKEXoafiTVa30xPV/Jz yoQfpyblD3fgX8GKcwug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r3aWZ-003EYH-18; Thu, 16 Nov 2023 11:27:07 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r3aWU-003ETo-0G for linux-amlogic@lists.infradead.org; Thu, 16 Nov 2023 11:27:05 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r3aWH-00084C-AH; Thu, 16 Nov 2023 12:26:49 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r3aWG-009RE6-J8; Thu, 16 Nov 2023 12:26:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3aWG-002aLv-A1; Thu, 16 Nov 2023 12:26:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Guillaume La Roque , "Rafael J. Wysocki" , Daniel Lezcano Cc: Zhang Rui , Lukasz Luba , linux-pm@vger.kernel.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 1/2] thermal: amlogic: Make amlogic_thermal_disable() return void Date: Thu, 16 Nov 2023 12:26:35 +0100 Message-ID: <20231116112633.668826-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231116112633.668826-1-u.kleine-koenig@pengutronix.de> References: <20231116112633.668826-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1540; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=zS5bf2K9StbVA3TOdCPCK/qoOEqpcla6Ty+ZtVPLmWY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVfxrNgTH4AYOVvU000xsT7JO+KmseS6hL84j2 ICo8g/biOuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVX8awAKCRCPgPtYfRL+ Tiz6CACMTqm95KR5Ydn8/rVs3MdqY9osaf9rLaFoZH2F6mps4WDjCz77OFWsNxgSoFX7FuGIwI0 EnOnZGuqaowfkkQDv/gn7gW95l3pcGHSKbEvsne/0W5b/YjpAhwE77VTpFGbxLVF08ek5oE3NMd 5h7i6SEirOL2W9zlsKZiXdml/Zx5MnKt58bwaKTiCrM1CQ3ie+xx+t8NMbbXBTE2trpKX8pKNJ5 EYLkIygs3hZ+oqtyllVkStwGrrew/SFUe2krmKJHnvF1ue32OdR1G/HbEUB9yslono3Igh9vxjX JtSmETfzRiZ3vmTIGYTmX+7easlWI1zIP+LFhamEHe7GqyI2 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231116_032702_126330_0CCE4FDF X-CRM114-Status: GOOD ( 11.23 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org amlogic_thermal_disable() returned zero unconditionally and amlogic_thermal_remove() already ignores the return value. Make it return no value and modify amlogic_thermal_suspend to not check the value. This patch introduces no semantic changes, but makes it more obvious for a human reader that amlogic_thermal_suspend() cannot fail. Signed-off-by: Uwe Kleine-König --- drivers/thermal/amlogic_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c index 5877cde25b79..562f63b7bf27 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -167,13 +167,11 @@ static int amlogic_thermal_enable(struct amlogic_thermal *data) return 0; } -static int amlogic_thermal_disable(struct amlogic_thermal *data) +static void amlogic_thermal_disable(struct amlogic_thermal *data) { regmap_update_bits(data->regmap, TSENSOR_CFG_REG1, TSENSOR_CFG_REG1_ENABLE, 0); clk_disable_unprepare(data->clk); - - return 0; } static int amlogic_thermal_get_temp(struct thermal_zone_device *tz, int *temp) @@ -302,7 +300,9 @@ static int __maybe_unused amlogic_thermal_suspend(struct device *dev) { struct amlogic_thermal *data = dev_get_drvdata(dev); - return amlogic_thermal_disable(data); + amlogic_thermal_disable(data); + + return 0; } static int __maybe_unused amlogic_thermal_resume(struct device *dev) From patchwork Thu Nov 16 11:26:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13457816 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4D96C5ACB3 for ; Thu, 16 Nov 2023 11:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cf9V/596Pkszud4DG58V7UiXYHnUp4dX+lPOrk9xm1o=; b=HeB5Bne25PxX3V SAySB2Mxt/wmh/nlWZcUcEhMziGb1N84DQxiYTEKo35ZkVRwwInLEPVgkKSMgEFUtz/WqjSIBRtX3 L10HxCqbURmD4r8qjHe5YaU1oUgWZdgLNPrZvk/LqUWJJ/F5emXImWER83Pbm+4BWoPdIsubln8H6 7Sorwlowrxe8uarmL7Dug8+q9p3TrPqFpwiWBxIHdojMz4ORRUPNm0nGSPaKCRQWUkS7mO+zLv1WQ EI/zqOZ0toZqM6NMhHTytXNYywzHCvoQ/zRSWvLgW7GMDM1bCFn4AurxstSwVGdy1UPNhBR/znaDR 5DRfRA+NUiFNkAPkvvNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r3aWY-003EYB-39; Thu, 16 Nov 2023 11:27:06 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r3aWU-003ETV-0G for linux-amlogic@lists.infradead.org; Thu, 16 Nov 2023 11:27:04 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r3aWH-00084D-AH; Thu, 16 Nov 2023 12:26:49 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r3aWG-009RE9-PB; Thu, 16 Nov 2023 12:26:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3aWG-002aLy-G8; Thu, 16 Nov 2023 12:26:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Guillaume La Roque , "Rafael J. Wysocki" , Daniel Lezcano Cc: Zhang Rui , Lukasz Luba , linux-pm@vger.kernel.org, linux-amlogic@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 2/2] thermal: amlogic: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions Date: Thu, 16 Nov 2023 12:26:36 +0100 Message-ID: <20231116112633.668826-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231116112633.668826-1-u.kleine-koenig@pengutronix.de> References: <20231116112633.668826-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1841; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=GhV61L6m5250RjClaUhpQ4Ok3kSdHAD+MEd8kv1eWac=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVfxsDGe6lAm2SmhswY2cjWZPHW5ajdO34W3Uf Kv+prQDSaWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVX8bAAKCRCPgPtYfRL+ TnCdB/9YsxgNnfWbUb7UCsbX2HAdOY2Yfzz9LNLP1eNaSGSrM0GLE3kQxrg7zMrIPehmoErkHDs 9XYoZiByxH7hVvNKFHJaqNddzvjYKlCU0OZZe67sVdDBzq5yOpmLhAbEFHFrXm24exNVSuJRjjG Df+fILso3vPJl3TcY924K5/t/XnpXA2LJckEdBA/PWEvREucnpsnYFbcVUGDJ2aT7TRploQAa5f VPIHW4vHLSxba5jqFVrHptWosemRr7XFR073svBIEHGdESU19s0m0Izwl7+VFYZRH9cbP9JPYgW +3ERd08m9GEWDOeASyOxedH299LieKW4xNAdpQlGMxOk07Du X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231116_032702_125771_97B01424 X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to care about when the functions are actually used, so the corresponding __maybe_unused can be dropped. Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM isn't enabled. Signed-off-by: Uwe Kleine-König --- drivers/thermal/amlogic_thermal.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c index 562f63b7bf27..df7a5ed55385 100644 --- a/drivers/thermal/amlogic_thermal.c +++ b/drivers/thermal/amlogic_thermal.c @@ -296,7 +296,7 @@ static void amlogic_thermal_remove(struct platform_device *pdev) amlogic_thermal_disable(data); } -static int __maybe_unused amlogic_thermal_suspend(struct device *dev) +static int amlogic_thermal_suspend(struct device *dev) { struct amlogic_thermal *data = dev_get_drvdata(dev); @@ -305,20 +305,21 @@ static int __maybe_unused amlogic_thermal_suspend(struct device *dev) return 0; } -static int __maybe_unused amlogic_thermal_resume(struct device *dev) +static int amlogic_thermal_resume(struct device *dev) { struct amlogic_thermal *data = dev_get_drvdata(dev); return amlogic_thermal_enable(data); } -static SIMPLE_DEV_PM_OPS(amlogic_thermal_pm_ops, - amlogic_thermal_suspend, amlogic_thermal_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(amlogic_thermal_pm_ops, + amlogic_thermal_suspend, + amlogic_thermal_resume); static struct platform_driver amlogic_thermal_driver = { .driver = { .name = "amlogic_thermal", - .pm = &amlogic_thermal_pm_ops, + .pm = pm_ptr(&amlogic_thermal_pm_ops), .of_match_table = of_amlogic_thermal_match, }, .probe = amlogic_thermal_probe,