linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] i2c: Use new PM macros
@ 2023-07-05 20:42 Paul Cercueil
  2023-07-05 20:42 ` [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions Paul Cercueil
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Elie Morisse,
	Shyam Sundar S K, Ray Jui, Scott Branden, Kamal Dasu,
	Broadcom internal kernel review list, Florian Fainelli,
	Bartosz Golaszewski, Jarkko Nikula, Andy Shevchenko,
	Mika Westerberg, Jan Dabros, Jean Delvare, Qii Wang,
	Matthias Brugger, AngeloGioacchino Del Regno, Linus Walleij,
	Peter Korsgaard, Andrew Lunn, Vladimir Zapolskiy, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Wolfram Sang, Krzysztof Kozlowski,
	Alim Akhtar, Conghui Chen, Viresh Kumar, Peter Rosin,
	linux-arm-kernel, linux-arm-msm, linux-mediatek,
	linux-renesas-soc, linux-samsung-soc, virtualization

Hi Wolfram,

This patchset converts the I2C subsystem to use the PM macros that were
introduced in v5.17, which allow the dev_pm_ops and related callbacks to
be automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

The point of this, is that all this code is now compiled independently
of any Kconfig option, which makes bugs and regressions easier to catch.

This continues the work that has been started in other subsystems (DRM,
IIO, watchdog).

As an added bonus, the diff is 71+/192-, that means less code you will
have to maintain ;)

The patches generally don't change the behaviour, with a few exceptions,
that are documented in the corresponding patches.

I would like to draw the attention to a few patches in particular:

- [01/23] the driver most likely does something that it shouldn't do
  (use the same callbacks for runtime PM and system PM). The patch does
  not change this behaviour but I have questions.

- [11/23] uses platform_driver.{suspend,resume} instead of the regular
  .driver.pm. I have no idea why it does that and I believe it doesn't
  really have to.

- [18/23] I feel like the qup_i2c_suspend / qup_i2c_resume don't really
  need to exist, and the pm_runtime_force_suspend() /
  pm_runtime_force_resume() helpers should be used instead, using the
  DEFINE_RUNTIME_DEV_PM_OPS() macro.

Cheers,
-Paul

Paul Cercueil (23):
  i2c: amd-mp2: Remove #ifdef guards for PM related functions
  i2c: au1550: Remove #ifdef guards for PM related functions
  i2c: iproc: Remove #ifdef guards for PM related functions
  i2c: brcmstb: Remove #ifdef guards for PM related functions
  i2c: davinci: Remove #ifdef guards for PM related functions
  i2c: designware: Remove #ifdef guards for PM related functions
  i2c: exynos5: Remove #ifdef guards for PM related functions
  i2c: hix5hd2: Remove #ifdef guards for PM related functions
  i2c: i801: Remove #ifdef guards for PM related functions
  i2c: img-scb: Remove #ifdef guards for PM related functions
  i2c: kempld: Remove #ifdef guards for PM related functions
  i2c: lpc2k: Remove #ifdef guards for PM related functions
  i2c: mt65xx: Remove #ifdef guards for PM related functions
  i2c: nomadik: Remove #ifdef guards for PM related functions
  i2c: ocores: Remove #ifdef guards for PM related functions
  i2c: pnx: Remove #ifdef guards for PM related functions
  i2c: pxa: Remove #ifdef guards for PM related functions
  i2c: qup: Remove #ifdef guards for PM related functions
  i2c: rcar: Remove #ifdef guards for PM related functions
  i2c: s3c2410: Remove #ifdef guards for PM related functions
  i2c: sh-mobile: Remove #ifdef guards for PM related functions
  i2c: virtio: Remove #ifdef guards for PM related functions
  i2c: mux: pca954x: Remove #ifdef guards for PM related functions

 drivers/i2c/busses/i2c-amd-mp2-pci.c        | 14 +++++--------
 drivers/i2c/busses/i2c-amd-mp2-plat.c       |  8 ++------
 drivers/i2c/busses/i2c-amd-mp2.h            |  2 --
 drivers/i2c/busses/i2c-au1550.c             | 15 +++-----------
 drivers/i2c/busses/i2c-bcm-iproc.c          | 10 +---------
 drivers/i2c/busses/i2c-brcmstb.c            |  8 +++-----
 drivers/i2c/busses/i2c-davinci.c            | 12 +++--------
 drivers/i2c/busses/i2c-designware-platdrv.c | 22 ++++++---------------
 drivers/i2c/busses/i2c-exynos5.c            |  8 +++-----
 drivers/i2c/busses/i2c-hix5hd2.c            | 10 ++++------
 drivers/i2c/busses/i2c-i801.c               |  6 ++----
 drivers/i2c/busses/i2c-img-scb.c            | 13 ++++--------
 drivers/i2c/busses/i2c-kempld.c             |  9 ++-------
 drivers/i2c/busses/i2c-lpc2k.c              |  8 +-------
 drivers/i2c/busses/i2c-mt65xx.c             |  8 +++-----
 drivers/i2c/busses/i2c-nomadik.c            | 14 +++++--------
 drivers/i2c/busses/i2c-ocores.c             | 10 +++-------
 drivers/i2c/busses/i2c-pnx.c                | 12 ++++-------
 drivers/i2c/busses/i2c-pxa.c                |  8 +-------
 drivers/i2c/busses/i2c-qup.c                | 16 ++++-----------
 drivers/i2c/busses/i2c-rcar.c               | 10 ++--------
 drivers/i2c/busses/i2c-s3c2410.c            | 14 +++----------
 drivers/i2c/busses/i2c-sh_mobile.c          | 12 +++--------
 drivers/i2c/busses/i2c-virtio.c             |  8 ++------
 drivers/i2c/muxes/i2c-mux-pca954x.c         |  6 ++----
 25 files changed, 71 insertions(+), 192 deletions(-)

-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
@ 2023-07-05 20:42 ` Paul Cercueil
  2023-07-06  2:11   ` Jonathan Cameron
  2023-07-06 17:01   ` Ray Jui
  2023-07-05 20:42 ` [PATCH 04/23] i2c: brcmstb: " Paul Cercueil
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, linux-arm-kernel

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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/i2c/busses/i2c-bcm-iproc.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
index 2d8342fdc25d..8a3e2208475c 100644
--- a/drivers/i2c/busses/i2c-bcm-iproc.c
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -1125,8 +1125,6 @@ static void bcm_iproc_i2c_remove(struct platform_device *pdev)
 	bcm_iproc_i2c_enable_disable(iproc_i2c, false);
 }
 
-#ifdef CONFIG_PM_SLEEP
-
 static int bcm_iproc_i2c_suspend(struct device *dev)
 {
 	struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
@@ -1177,12 +1175,6 @@ static const struct dev_pm_ops bcm_iproc_i2c_pm_ops = {
 	.resume_early = &bcm_iproc_i2c_resume
 };
 
-#define BCM_IPROC_I2C_PM_OPS (&bcm_iproc_i2c_pm_ops)
-#else
-#define BCM_IPROC_I2C_PM_OPS NULL
-#endif /* CONFIG_PM_SLEEP */
-
-
 static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave)
 {
 	struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter);
@@ -1255,7 +1247,7 @@ static struct platform_driver bcm_iproc_i2c_driver = {
 	.driver = {
 		.name = "bcm-iproc-i2c",
 		.of_match_table = bcm_iproc_i2c_of_match,
-		.pm = BCM_IPROC_I2C_PM_OPS,
+		.pm = pm_sleep_ptr(&bcm_iproc_i2c_pm_ops),
 	},
 	.probe = bcm_iproc_i2c_probe,
 	.remove_new = bcm_iproc_i2c_remove,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/23] i2c: brcmstb: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
  2023-07-05 20:42 ` [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions Paul Cercueil
@ 2023-07-05 20:42 ` Paul Cercueil
  2023-07-06  2:12   ` Jonathan Cameron
  2023-07-05 20:42 ` [PATCH 05/23] i2c: davinci: " Paul Cercueil
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Kamal Dasu,
	Broadcom internal kernel review list, Florian Fainelli,
	linux-arm-kernel

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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
Cc: Kamal Dasu <kdasu.kdev@gmail.com>
Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/i2c/busses/i2c-brcmstb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index cf92cbcb8c86..c778bcca95fe 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -697,7 +697,6 @@ static void brcmstb_i2c_remove(struct platform_device *pdev)
 	i2c_del_adapter(&dev->adapter);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int brcmstb_i2c_suspend(struct device *dev)
 {
 	struct brcmstb_i2c_dev *i2c_dev = dev_get_drvdata(dev);
@@ -715,10 +714,9 @@ static int brcmstb_i2c_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(brcmstb_i2c_pm, brcmstb_i2c_suspend,
-			 brcmstb_i2c_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(brcmstb_i2c_pm, brcmstb_i2c_suspend,
+				brcmstb_i2c_resume);
 
 static const struct of_device_id brcmstb_i2c_of_match[] = {
 	{.compatible = "brcm,brcmstb-i2c"},
@@ -732,7 +730,7 @@ static struct platform_driver brcmstb_i2c_driver = {
 	.driver = {
 		   .name = "brcmstb-i2c",
 		   .of_match_table = brcmstb_i2c_of_match,
-		   .pm = &brcmstb_i2c_pm,
+		   .pm = pm_sleep_ptr(&brcmstb_i2c_pm),
 		   },
 	.probe = brcmstb_i2c_probe,
 	.remove_new = brcmstb_i2c_remove,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/23] i2c: davinci: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
  2023-07-05 20:42 ` [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions Paul Cercueil
  2023-07-05 20:42 ` [PATCH 04/23] i2c: brcmstb: " Paul Cercueil
@ 2023-07-05 20:42 ` Paul Cercueil
  2023-07-06  2:15   ` Jonathan Cameron
  2023-07-05 20:42 ` [PATCH 07/23] i2c: exynos5: " Paul Cercueil
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Bartosz Golaszewski,
	linux-arm-kernel

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>

---
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/i2c/busses/i2c-davinci.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 71b60778c643..52527189a7bf 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -902,7 +902,6 @@ static void davinci_i2c_remove(struct platform_device *pdev)
 	pm_runtime_disable(dev->dev);
 }
 
-#ifdef CONFIG_PM
 static int davinci_i2c_suspend(struct device *dev)
 {
 	struct davinci_i2c_dev *i2c_dev = dev_get_drvdata(dev);
@@ -926,15 +925,10 @@ static int davinci_i2c_resume(struct device *dev)
 static const struct dev_pm_ops davinci_i2c_pm = {
 	.suspend        = davinci_i2c_suspend,
 	.resume         = davinci_i2c_resume,
-	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				      pm_runtime_force_resume)
+	NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+				  pm_runtime_force_resume)
 };
 
-#define davinci_i2c_pm_ops (&davinci_i2c_pm)
-#else
-#define davinci_i2c_pm_ops NULL
-#endif
-
 static const struct platform_device_id davinci_i2c_driver_ids[] = {
 	{ .name = "i2c_davinci", },
 	{ /* sentinel */ }
@@ -947,7 +941,7 @@ static struct platform_driver davinci_i2c_driver = {
 	.id_table	= davinci_i2c_driver_ids,
 	.driver		= {
 		.name	= "i2c_davinci",
-		.pm	= davinci_i2c_pm_ops,
+		.pm	= pm_sleep_ptr(&davinci_i2c_pm),
 		.of_match_table = davinci_i2c_of_match,
 	},
 };
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/23] i2c: exynos5: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
                   ` (2 preceding siblings ...)
  2023-07-05 20:42 ` [PATCH 05/23] i2c: davinci: " Paul Cercueil
@ 2023-07-05 20:42 ` Paul Cercueil
  2023-07-06  2:25   ` Jonathan Cameron
  2023-07-05 20:43 ` [PATCH 12/23] i2c: lpc2k: " Paul Cercueil
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Krzysztof Kozlowski,
	Alim Akhtar, linux-arm-kernel, linux-samsung-soc

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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
---
 drivers/i2c/busses/i2c-exynos5.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c
index f378cd479e55..5b201a326c13 100644
--- a/drivers/i2c/busses/i2c-exynos5.c
+++ b/drivers/i2c/busses/i2c-exynos5.c
@@ -892,7 +892,6 @@ static void exynos5_i2c_remove(struct platform_device *pdev)
 	clk_unprepare(i2c->pclk);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int exynos5_i2c_suspend_noirq(struct device *dev)
 {
 	struct exynos5_i2c *i2c = dev_get_drvdata(dev);
@@ -934,11 +933,10 @@ static int exynos5_i2c_resume_noirq(struct device *dev)
 	clk_disable_unprepare(i2c->pclk);
 	return ret;
 }
-#endif
 
 static const struct dev_pm_ops exynos5_i2c_dev_pm_ops = {
-	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(exynos5_i2c_suspend_noirq,
-				      exynos5_i2c_resume_noirq)
+	NOIRQ_SYSTEM_SLEEP_PM_OPS(exynos5_i2c_suspend_noirq,
+				  exynos5_i2c_resume_noirq)
 };
 
 static struct platform_driver exynos5_i2c_driver = {
@@ -946,7 +944,7 @@ static struct platform_driver exynos5_i2c_driver = {
 	.remove_new	= exynos5_i2c_remove,
 	.driver		= {
 		.name	= "exynos5-hsi2c",
-		.pm	= &exynos5_i2c_dev_pm_ops,
+		.pm	= pm_sleep_ptr(&exynos5_i2c_dev_pm_ops),
 		.of_match_table = exynos5_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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/23] i2c: lpc2k: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
                   ` (3 preceding siblings ...)
  2023-07-05 20:42 ` [PATCH 07/23] i2c: exynos5: " Paul Cercueil
@ 2023-07-05 20:43 ` Paul Cercueil
  2023-07-06  2:39   ` Jonathan Cameron
  2023-07-05 20:43 ` [PATCH 13/23] i2c: mt65xx: " Paul Cercueil
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:43 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Vladimir Zapolskiy,
	linux-arm-kernel

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.

Also note that pm_sleep_ptr() has not been applied to each callback
in the dev_pm_ops structure because the pm_sleep_ptr() at the usage site
is sufficient.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 13/23] i2c: mt65xx: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
                   ` (4 preceding siblings ...)
  2023-07-05 20:43 ` [PATCH 12/23] i2c: lpc2k: " Paul Cercueil
@ 2023-07-05 20:43 ` Paul Cercueil
  2023-07-06  2:40   ` Jonathan Cameron
  2023-07-05 20:43 ` [PATCH 14/23] i2c: nomadik: " Paul Cercueil
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:43 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Qii Wang,
	Matthias Brugger, AngeloGioacchino Del Regno, linux-arm-kernel,
	linux-mediatek

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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
Cc: Qii Wang <qii.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
---
 drivers/i2c/busses/i2c-mt65xx.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 7ca3f2221ba6..21cc39e35cf6 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -1514,7 +1514,6 @@ static void mtk_i2c_remove(struct platform_device *pdev)
 	clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mtk_i2c_suspend_noirq(struct device *dev)
 {
 	struct mtk_i2c *i2c = dev_get_drvdata(dev);
@@ -1544,11 +1543,10 @@ static int mtk_i2c_resume_noirq(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct dev_pm_ops mtk_i2c_pm = {
-	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_i2c_suspend_noirq,
-				      mtk_i2c_resume_noirq)
+	NOIRQ_SYSTEM_SLEEP_PM_OPS(mtk_i2c_suspend_noirq,
+				  mtk_i2c_resume_noirq)
 };
 
 static struct platform_driver mtk_i2c_driver = {
@@ -1556,7 +1554,7 @@ static struct platform_driver mtk_i2c_driver = {
 	.remove_new = mtk_i2c_remove,
 	.driver = {
 		.name = I2C_DRV_NAME,
-		.pm = &mtk_i2c_pm,
+		.pm = pm_sleep_ptr(&mtk_i2c_pm),
 		.of_match_table = mtk_i2c_of_match,
 	},
 };
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 14/23] i2c: nomadik: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
                   ` (5 preceding siblings ...)
  2023-07-05 20:43 ` [PATCH 13/23] i2c: mt65xx: " Paul Cercueil
@ 2023-07-05 20:43 ` Paul Cercueil
  2023-07-06  2:41   ` Jonathan Cameron
  2023-07-06 17:12   ` Linus Walleij
  2023-07-05 20:43 ` [PATCH 16/23] i2c: pnx: " Paul Cercueil
       [not found] ` <20230705204521.90050-1-paul@crapouillou.net>
  8 siblings, 2 replies; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:43 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Linus Walleij,
	linux-arm-kernel

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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/i2c/busses/i2c-nomadik.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 1e5fd23ef45c..4a4b5bc257ae 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -873,7 +873,6 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int nmk_i2c_suspend_late(struct device *dev)
 {
 	int ret;
@@ -890,9 +889,7 @@ static int nmk_i2c_resume_early(struct device *dev)
 {
 	return pm_runtime_force_resume(dev);
 }
-#endif
 
-#ifdef CONFIG_PM
 static int nmk_i2c_runtime_suspend(struct device *dev)
 {
 	struct amba_device *adev = to_amba_device(dev);
@@ -925,13 +922,12 @@ static int nmk_i2c_runtime_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
 static const struct dev_pm_ops nmk_i2c_pm = {
-	SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
-	SET_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
-			nmk_i2c_runtime_resume,
-			NULL)
+	LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
+	RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
+		       nmk_i2c_runtime_resume,
+		       NULL)
 };
 
 static unsigned int nmk_i2c_functionality(struct i2c_adapter *adap)
@@ -1080,7 +1076,7 @@ static struct amba_driver nmk_i2c_driver = {
 	.drv = {
 		.owner = THIS_MODULE,
 		.name = DRIVER_NAME,
-		.pm = &nmk_i2c_pm,
+		.pm = pm_ptr(&nmk_i2c_pm),
 	},
 	.id_table = nmk_i2c_ids,
 	.probe = nmk_i2c_probe,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 16/23] i2c: pnx: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
                   ` (6 preceding siblings ...)
  2023-07-05 20:43 ` [PATCH 14/23] i2c: nomadik: " Paul Cercueil
@ 2023-07-05 20:43 ` Paul Cercueil
  2023-07-06  2:49   ` Jonathan Cameron
       [not found] ` <20230705204521.90050-1-paul@crapouillou.net>
  8 siblings, 1 reply; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:43 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Vladimir Zapolskiy,
	linux-arm-kernel

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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/i2c/busses/i2c-pnx.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 82400057f810..4ee7db512333 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -613,7 +613,6 @@ static const struct i2c_algorithm pnx_algorithm = {
 	.functionality = i2c_pnx_func,
 };
 
-#ifdef CONFIG_PM_SLEEP
 static int i2c_pnx_controller_suspend(struct device *dev)
 {
 	struct i2c_pnx_algo_data *alg_data = dev_get_drvdata(dev);
@@ -630,12 +629,9 @@ static int i2c_pnx_controller_resume(struct device *dev)
 	return clk_prepare_enable(alg_data->clk);
 }
 
-static SIMPLE_DEV_PM_OPS(i2c_pnx_pm,
-			 i2c_pnx_controller_suspend, i2c_pnx_controller_resume);
-#define PNX_I2C_PM	(&i2c_pnx_pm)
-#else
-#define PNX_I2C_PM	NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(i2c_pnx_pm,
+				i2c_pnx_controller_suspend,
+				i2c_pnx_controller_resume);
 
 static int i2c_pnx_probe(struct platform_device *pdev)
 {
@@ -763,7 +759,7 @@ static struct platform_driver i2c_pnx_driver = {
 	.driver = {
 		.name = "pnx-i2c",
 		.of_match_table = of_match_ptr(i2c_pnx_of_match),
-		.pm = PNX_I2C_PM,
+		.pm = pm_sleep_ptr(&i2c_pnx_pm),
 	},
 	.probe = i2c_pnx_probe,
 	.remove_new = i2c_pnx_remove,
-- 
2.40.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 20/23] i2c: s3c2410: Remove #ifdef guards for PM related functions
       [not found] ` <20230705204521.90050-1-paul@crapouillou.net>
@ 2023-07-05 20:45   ` Paul Cercueil
  2023-07-06  3:06     ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Paul Cercueil @ 2023-07-05 20:45 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Paul Cercueil, Krzysztof Kozlowski,
	Alim Akhtar, linux-arm-kernel, linux-samsung-soc

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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>

---
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
---
 drivers/i2c/busses/i2c-s3c2410.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 28f0e5c64f32..d23a9e7fcb48 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1125,7 +1125,6 @@ static void s3c24xx_i2c_remove(struct platform_device *pdev)
 	i2c_del_adapter(&i2c->adap);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int s3c24xx_i2c_suspend_noirq(struct device *dev)
 {
 	struct s3c24xx_i2c *i2c = dev_get_drvdata(dev);
@@ -1155,26 +1154,19 @@ static int s3c24xx_i2c_resume_noirq(struct device *dev)
 
 	return 0;
 }
-#endif
 
-#ifdef CONFIG_PM
 static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
-	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(s3c24xx_i2c_suspend_noirq,
-				      s3c24xx_i2c_resume_noirq)
+	NOIRQ_SYSTEM_SLEEP_PM_OPS(s3c24xx_i2c_suspend_noirq,
+				  s3c24xx_i2c_resume_noirq)
 };
 
-#define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops)
-#else
-#define S3C24XX_DEV_PM_OPS NULL
-#endif
-
 static struct platform_driver s3c24xx_i2c_driver = {
 	.probe		= s3c24xx_i2c_probe,
 	.remove_new	= s3c24xx_i2c_remove,
 	.id_table	= s3c24xx_driver_ids,
 	.driver		= {
 		.name	= "s3c-i2c",
-		.pm	= S3C24XX_DEV_PM_OPS,
+		.pm	= pm_sleep_ptr(&s3c24xx_i2c_dev_pm_ops),
 		.of_match_table = of_match_ptr(s3c24xx_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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 ` [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions Paul Cercueil
@ 2023-07-06  2:11   ` Jonathan Cameron
  2023-07-06 17:01   ` Ray Jui
  1 sibling, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:11 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, linux-arm-kernel

On Wed,  5 Jul 2023 22:42:54 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 04/23] i2c: brcmstb: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 ` [PATCH 04/23] i2c: brcmstb: " Paul Cercueil
@ 2023-07-06  2:12   ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:12 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Kamal Dasu,
	Broadcom internal kernel review list, Florian Fainelli,
	linux-arm-kernel

On Wed,  5 Jul 2023 22:42:55 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 05/23] i2c: davinci: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 ` [PATCH 05/23] i2c: davinci: " Paul Cercueil
@ 2023-07-06  2:15   ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:15 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Bartosz Golaszewski,
	linux-arm-kernel

On Wed,  5 Jul 2023 22:42:56 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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>
Slightly odd combination of callbacks in this driver, but your change
looks good to me.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/23] i2c: exynos5: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 ` [PATCH 07/23] i2c: exynos5: " Paul Cercueil
@ 2023-07-06  2:25   ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:25 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Krzysztof Kozlowski,
	Alim Akhtar, linux-arm-kernel, linux-samsung-soc

On Wed,  5 Jul 2023 22:42:58 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 12/23] i2c: lpc2k: Remove #ifdef guards for PM related functions
  2023-07-05 20:43 ` [PATCH 12/23] i2c: lpc2k: " Paul Cercueil
@ 2023-07-06  2:39   ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:39 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Vladimir Zapolskiy,
	linux-arm-kernel

On Wed,  5 Jul 2023 22:43:03 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Also note that pm_sleep_ptr() has not been applied to each callback
> in the dev_pm_ops structure because the pm_sleep_ptr() at the usage site
> is sufficient.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 13/23] i2c: mt65xx: Remove #ifdef guards for PM related functions
  2023-07-05 20:43 ` [PATCH 13/23] i2c: mt65xx: " Paul Cercueil
@ 2023-07-06  2:40   ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:40 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Qii Wang, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-arm-kernel, linux-mediatek

On Wed,  5 Jul 2023 22:43:04 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 14/23] i2c: nomadik: Remove #ifdef guards for PM related functions
  2023-07-05 20:43 ` [PATCH 14/23] i2c: nomadik: " Paul Cercueil
@ 2023-07-06  2:41   ` Jonathan Cameron
  2023-07-06 17:12   ` Linus Walleij
  1 sibling, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:41 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Linus Walleij,
	linux-arm-kernel

On Wed,  5 Jul 2023 22:43:05 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> 
Might be worth rewrapping the runtime pm line. Otherwise LGTM

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/i2c/busses/i2c-nomadik.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index 1e5fd23ef45c..4a4b5bc257ae 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -873,7 +873,6 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
>  static int nmk_i2c_suspend_late(struct device *dev)
>  {
>  	int ret;
> @@ -890,9 +889,7 @@ static int nmk_i2c_resume_early(struct device *dev)
>  {
>  	return pm_runtime_force_resume(dev);
>  }
> -#endif
>  
> -#ifdef CONFIG_PM
>  static int nmk_i2c_runtime_suspend(struct device *dev)
>  {
>  	struct amba_device *adev = to_amba_device(dev);
> @@ -925,13 +922,12 @@ static int nmk_i2c_runtime_resume(struct device *dev)
>  
>  	return ret;
>  }
> -#endif
>  
>  static const struct dev_pm_ops nmk_i2c_pm = {
> -	SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
> -	SET_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
> -			nmk_i2c_runtime_resume,
> -			NULL)
> +	LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
> +	RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
> +		       nmk_i2c_runtime_resume,
> +		       NULL)

rewrap?

>  };
>  
>  static unsigned int nmk_i2c_functionality(struct i2c_adapter *adap)
> @@ -1080,7 +1076,7 @@ static struct amba_driver nmk_i2c_driver = {
>  	.drv = {
>  		.owner = THIS_MODULE,
>  		.name = DRIVER_NAME,
> -		.pm = &nmk_i2c_pm,
> +		.pm = pm_ptr(&nmk_i2c_pm),
>  	},
>  	.id_table = nmk_i2c_ids,
>  	.probe = nmk_i2c_probe,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 16/23] i2c: pnx: Remove #ifdef guards for PM related functions
  2023-07-05 20:43 ` [PATCH 16/23] i2c: pnx: " Paul Cercueil
@ 2023-07-06  2:49   ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  2:49 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Vladimir Zapolskiy,
	linux-arm-kernel

On Wed,  5 Jul 2023 22:43:07 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 20/23] i2c: s3c2410: Remove #ifdef guards for PM related functions
  2023-07-05 20:45   ` [PATCH 20/23] i2c: s3c2410: " Paul Cercueil
@ 2023-07-06  3:06     ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2023-07-06  3:06 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Wolfram Sang, linux-i2c, linux-kernel, Krzysztof Kozlowski,
	Alim Akhtar, linux-arm-kernel, linux-samsung-soc

On Wed,  5 Jul 2023 22:45:18 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions
  2023-07-05 20:42 ` [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions Paul Cercueil
  2023-07-06  2:11   ` Jonathan Cameron
@ 2023-07-06 17:01   ` Ray Jui
  1 sibling, 0 replies; 21+ messages in thread
From: Ray Jui @ 2023-07-06 17:01 UTC (permalink / raw)
  To: Paul Cercueil, Wolfram Sang
  Cc: linux-i2c, linux-kernel, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2130 bytes --]



On 7/5/2023 1:42 PM, Paul Cercueil wrote:
> 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.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> 
> ---
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/i2c/busses/i2c-bcm-iproc.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
> index 2d8342fdc25d..8a3e2208475c 100644
> --- a/drivers/i2c/busses/i2c-bcm-iproc.c
> +++ b/drivers/i2c/busses/i2c-bcm-iproc.c
> @@ -1125,8 +1125,6 @@ static void bcm_iproc_i2c_remove(struct platform_device *pdev)
>  	bcm_iproc_i2c_enable_disable(iproc_i2c, false);
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -
>  static int bcm_iproc_i2c_suspend(struct device *dev)
>  {
>  	struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
> @@ -1177,12 +1175,6 @@ static const struct dev_pm_ops bcm_iproc_i2c_pm_ops = {
>  	.resume_early = &bcm_iproc_i2c_resume
>  };
>  
> -#define BCM_IPROC_I2C_PM_OPS (&bcm_iproc_i2c_pm_ops)
> -#else
> -#define BCM_IPROC_I2C_PM_OPS NULL
> -#endif /* CONFIG_PM_SLEEP */
> -
> -
>  static int bcm_iproc_i2c_reg_slave(struct i2c_client *slave)
>  {
>  	struct bcm_iproc_i2c_dev *iproc_i2c = i2c_get_adapdata(slave->adapter);
> @@ -1255,7 +1247,7 @@ static struct platform_driver bcm_iproc_i2c_driver = {
>  	.driver = {
>  		.name = "bcm-iproc-i2c",
>  		.of_match_table = bcm_iproc_i2c_of_match,
> -		.pm = BCM_IPROC_I2C_PM_OPS,
> +		.pm = pm_sleep_ptr(&bcm_iproc_i2c_pm_ops),
>  	},
>  	.probe = bcm_iproc_i2c_probe,
>  	.remove_new = bcm_iproc_i2c_remove,

Thanks.

Acked-by: Ray Jui <ray.jui@broadcom.com>

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 14/23] i2c: nomadik: Remove #ifdef guards for PM related functions
  2023-07-05 20:43 ` [PATCH 14/23] i2c: nomadik: " Paul Cercueil
  2023-07-06  2:41   ` Jonathan Cameron
@ 2023-07-06 17:12   ` Linus Walleij
  1 sibling, 0 replies; 21+ messages in thread
From: Linus Walleij @ 2023-07-06 17:12 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Wolfram Sang, linux-i2c, linux-kernel, linux-arm-kernel

On Wed, Jul 5, 2023 at 10:43 PM Paul Cercueil <paul@crapouillou.net> wrote:

> 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.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Looks correct!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-07-06 17:13 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-05 20:42 [PATCH 00/23] i2c: Use new PM macros Paul Cercueil
2023-07-05 20:42 ` [PATCH 03/23] i2c: iproc: Remove #ifdef guards for PM related functions Paul Cercueil
2023-07-06  2:11   ` Jonathan Cameron
2023-07-06 17:01   ` Ray Jui
2023-07-05 20:42 ` [PATCH 04/23] i2c: brcmstb: " Paul Cercueil
2023-07-06  2:12   ` Jonathan Cameron
2023-07-05 20:42 ` [PATCH 05/23] i2c: davinci: " Paul Cercueil
2023-07-06  2:15   ` Jonathan Cameron
2023-07-05 20:42 ` [PATCH 07/23] i2c: exynos5: " Paul Cercueil
2023-07-06  2:25   ` Jonathan Cameron
2023-07-05 20:43 ` [PATCH 12/23] i2c: lpc2k: " Paul Cercueil
2023-07-06  2:39   ` Jonathan Cameron
2023-07-05 20:43 ` [PATCH 13/23] i2c: mt65xx: " Paul Cercueil
2023-07-06  2:40   ` Jonathan Cameron
2023-07-05 20:43 ` [PATCH 14/23] i2c: nomadik: " Paul Cercueil
2023-07-06  2:41   ` Jonathan Cameron
2023-07-06 17:12   ` Linus Walleij
2023-07-05 20:43 ` [PATCH 16/23] i2c: pnx: " Paul Cercueil
2023-07-06  2:49   ` Jonathan Cameron
     [not found] ` <20230705204521.90050-1-paul@crapouillou.net>
2023-07-05 20:45   ` [PATCH 20/23] i2c: s3c2410: " Paul Cercueil
2023-07-06  3:06     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).