From: Paul Cercueil <paul@crapouillou.net>
To: Wolfram Sang <wsa@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Paul Cercueil <paul@crapouillou.net>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Vladimir Zapolskiy <vz@mleia.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 11/22] i2c: lpc2k: Remove #ifdef guards for PM related functions
Date: Sat, 22 Jul 2023 13:50:35 +0200 [thread overview]
Message-ID: <20230722115046.27323-12-paul@crapouillou.net> (raw)
In-Reply-To: <20230722115046.27323-1-paul@crapouillou.net>
Use the new PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.
This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.
Note that the behaviour is slightly different than before; the original
code wrapped the suspend/resume with #ifdef CONFIG_PM guards, which
resulted in these functions being compiled in but never used when
CONFIG_PM_SLEEP was disabled.
Now, those functions are only compiled in when CONFIG_PM_SLEEP is
enabled.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/i2c/busses/i2c-lpc2k.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
index 5c6d96554753..c61157f1409b 100644
--- a/drivers/i2c/busses/i2c-lpc2k.c
+++ b/drivers/i2c/busses/i2c-lpc2k.c
@@ -431,7 +431,6 @@ static void i2c_lpc2k_remove(struct platform_device *dev)
i2c_del_adapter(&i2c->adap);
}
-#ifdef CONFIG_PM
static int i2c_lpc2k_suspend(struct device *dev)
{
struct lpc2k_i2c *i2c = dev_get_drvdata(dev);
@@ -456,11 +455,6 @@ static const struct dev_pm_ops i2c_lpc2k_dev_pm_ops = {
.resume_noirq = i2c_lpc2k_resume,
};
-#define I2C_LPC2K_DEV_PM_OPS (&i2c_lpc2k_dev_pm_ops)
-#else
-#define I2C_LPC2K_DEV_PM_OPS NULL
-#endif
-
static const struct of_device_id lpc2k_i2c_match[] = {
{ .compatible = "nxp,lpc1788-i2c" },
{},
@@ -472,7 +466,7 @@ static struct platform_driver i2c_lpc2k_driver = {
.remove_new = i2c_lpc2k_remove,
.driver = {
.name = "lpc2k-i2c",
- .pm = I2C_LPC2K_DEV_PM_OPS,
+ .pm = pm_sleep_ptr(&i2c_lpc2k_dev_pm_ops),
.of_match_table = lpc2k_i2c_match,
},
};
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-07-22 11:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 11:50 [PATCH v2 00/22] i2c: Use new PM macros Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 02/22] i2c: iproc: Remove #ifdef guards for PM related functions Paul Cercueil
2023-07-22 14:39 ` Florian Fainelli
2023-07-22 11:50 ` [PATCH v2 03/22] i2c: brcmstb: " Paul Cercueil
2023-07-22 14:39 ` Florian Fainelli
2023-07-22 11:50 ` [PATCH v2 04/22] i2c: davinci: " Paul Cercueil
2023-07-27 7:40 ` Bartosz Golaszewski
2023-07-22 11:50 ` [PATCH v2 06/22] i2c: exynos5: " Paul Cercueil
2023-07-22 11:50 ` Paul Cercueil [this message]
2023-07-22 11:50 ` [PATCH v2 12/22] i2c: mt65xx: " Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 13/22] i2c: nomadik: " Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 15/22] i2c: pnx: " Paul Cercueil
2023-07-22 11:53 ` [PATCH v2 19/22] i2c: s3c2410: " Paul Cercueil
2023-08-02 20:10 ` [PATCH v2 00/22] i2c: Use new PM macros Andi Shyti
2023-08-14 15:06 ` Wolfram Sang
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=20230722115046.27323-12-paul@crapouillou.net \
--to=paul@crapouillou.net \
--cc=Jonathan.Cameron@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vz@mleia.com \
--cc=wsa@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox