public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: imx: Switch to RUNTIME_PM_OPS()
@ 2024-08-07 18:14 Fabio Estevam
  2024-08-08  4:26 ` Oleksij Rempel
  2024-08-09  0:12 ` Andi Shyti
  0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2024-08-07 18:14 UTC (permalink / raw)
  To: o.rempel; +Cc: andi.shyti, linux-i2c, Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

Replace SET_RUNTIME_PM_OPS() with its modern RUNTIME_PM_OPS()
alternative.

The combined usage of pm_ptr() and RUNTIME_PM_OPS() allows the
compiler to evaluate if the runtime suspend/resume() functions
are used at build time or are simply dead code.

This allows removing the __maybe_unused notation from the runtime
suspend/resume() functions.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 drivers/i2c/busses/i2c-imx.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 3842e527116b..d68b575e5d18 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1549,7 +1549,7 @@ static void i2c_imx_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 }
 
-static int __maybe_unused i2c_imx_runtime_suspend(struct device *dev)
+static int i2c_imx_runtime_suspend(struct device *dev)
 {
 	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
 
@@ -1558,7 +1558,7 @@ static int __maybe_unused i2c_imx_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused i2c_imx_runtime_resume(struct device *dev)
+static int i2c_imx_runtime_resume(struct device *dev)
 {
 	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
 	int ret;
@@ -1571,8 +1571,7 @@ static int __maybe_unused i2c_imx_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops i2c_imx_pm_ops = {
-	SET_RUNTIME_PM_OPS(i2c_imx_runtime_suspend,
-			   i2c_imx_runtime_resume, NULL)
+	RUNTIME_PM_OPS(i2c_imx_runtime_suspend, i2c_imx_runtime_resume, NULL)
 };
 
 static struct platform_driver i2c_imx_driver = {
@@ -1580,7 +1579,7 @@ static struct platform_driver i2c_imx_driver = {
 	.remove_new = i2c_imx_remove,
 	.driver = {
 		.name = DRIVER_NAME,
-		.pm = &i2c_imx_pm_ops,
+		.pm = pm_ptr(&i2c_imx_pm_ops),
 		.of_match_table = i2c_imx_dt_ids,
 		.acpi_match_table = i2c_imx_acpi_ids,
 	},
-- 
2.34.1


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

* Re: [PATCH] i2c: imx: Switch to RUNTIME_PM_OPS()
  2024-08-07 18:14 [PATCH] i2c: imx: Switch to RUNTIME_PM_OPS() Fabio Estevam
@ 2024-08-08  4:26 ` Oleksij Rempel
  2024-08-09  0:12 ` Andi Shyti
  1 sibling, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2024-08-08  4:26 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: andi.shyti, linux-i2c, Fabio Estevam

On Wed, Aug 07, 2024 at 03:14:56PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> Replace SET_RUNTIME_PM_OPS() with its modern RUNTIME_PM_OPS()
> alternative.
> 
> The combined usage of pm_ptr() and RUNTIME_PM_OPS() allows the
> compiler to evaluate if the runtime suspend/resume() functions
> are used at build time or are simply dead code.
> 
> This allows removing the __maybe_unused notation from the runtime
> suspend/resume() functions.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>

Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>

Thank you!

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH] i2c: imx: Switch to RUNTIME_PM_OPS()
  2024-08-07 18:14 [PATCH] i2c: imx: Switch to RUNTIME_PM_OPS() Fabio Estevam
  2024-08-08  4:26 ` Oleksij Rempel
@ 2024-08-09  0:12 ` Andi Shyti
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2024-08-09  0:12 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: o.rempel, linux-i2c, Fabio Estevam

Hi Fabio,

On Wed, Aug 07, 2024 at 03:14:56PM GMT, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> Replace SET_RUNTIME_PM_OPS() with its modern RUNTIME_PM_OPS()
> alternative.
> 
> The combined usage of pm_ptr() and RUNTIME_PM_OPS() allows the
> compiler to evaluate if the runtime suspend/resume() functions
> are used at build time or are simply dead code.
> 
> This allows removing the __maybe_unused notation from the runtime
> suspend/resume() functions.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>

pushed to i2c/i2c-host.

Thanks,
Andi

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

end of thread, other threads:[~2024-08-09  0:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07 18:14 [PATCH] i2c: imx: Switch to RUNTIME_PM_OPS() Fabio Estevam
2024-08-08  4:26 ` Oleksij Rempel
2024-08-09  0:12 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox