All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hesham Almatary <hesham.almatary@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linuxarm@huawei.com>, <jonathan.cameron@huawei.com>,
	<paul@crapouillou.net>, <rafael@kernel.org>, <amitk@kernel.org>,
	<rui.zhang@intel.com>, <linux-pm@vger.kernel.org>,
	Hesham Almatary <hesham.almatary@huawei.com>
Subject: [PATCH] thermal:hisi_termal: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
Date: Thu, 24 Mar 2022 10:34:43 +0000	[thread overview]
Message-ID: <20220324103443.4563-1-hesham.almatary@huawei.com> (raw)

Cleaning up the driver to use pm_sleep_ptr() macro instead of #ifdef
guards is simpler and allows the compiler to remove those functions
if built without CONFIG_PM_SLEEP support.

Signed-off-by: Hesham Almatary <hesham.almatary@huawei.com>
---
 drivers/thermal/hisi_thermal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 9a21ac0ceb11..b29ab09040d5 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -629,7 +629,6 @@ static int hisi_thermal_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int hisi_thermal_suspend(struct device *dev)
 {
 	struct hisi_thermal_data *data = dev_get_drvdata(dev);
@@ -651,15 +650,14 @@ static int hisi_thermal_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
+static DEFINE_SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
 			 hisi_thermal_suspend, hisi_thermal_resume);
 
 static struct platform_driver hisi_thermal_driver = {
 	.driver = {
 		.name		= "hisi_thermal",
-		.pm		= &hisi_thermal_pm_ops,
+		.pm		= pm_sleep_ptr(&hisi_thermal_pm_ops),
 		.of_match_table = of_hisi_thermal_match,
 	},
 	.probe	= hisi_thermal_probe,
-- 
2.25.1


             reply	other threads:[~2022-03-24 10:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 10:34 Hesham Almatary [this message]
2022-03-24 12:11 ` [PATCH] thermal:hisi_termal: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Paul Cercueil
2022-04-13 14:38   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220324103443.4563-1-hesham.almatary@huawei.com \
    --to=hesham.almatary@huawei.com \
    --cc=amitk@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=paul@crapouillou.net \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.