diff mbox series

[1/2] media: imx-mipi-csis: Switch to RUNTIME_PM_OPS()

Message ID 20240807182610.81244-1-festevam@gmail.com
State New
Headers show
Series [1/2] media: imx-mipi-csis: Switch to RUNTIME_PM_OPS() | expand

Commit Message

Fabio Estevam Aug. 7, 2024, 6:26 p.m. UTC
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/media/platform/nxp/imx-mipi-csis.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Laurent Pinchart Aug. 11, 2024, 6:49 p.m. UTC | #1
Hi Fabio,

Thank you for the patch.

On Wed, Aug 07, 2024 at 03:26:09PM -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>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/nxp/imx-mipi-csis.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index b9729a8883d6..08d8850399b6 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -1344,7 +1344,7 @@ static int mipi_csis_async_register(struct mipi_csis_device *csis)
>   * Suspend/resume
>   */
>  
> -static int __maybe_unused mipi_csis_runtime_suspend(struct device *dev)
> +static int mipi_csis_runtime_suspend(struct device *dev)
>  {
>  	struct v4l2_subdev *sd = dev_get_drvdata(dev);
>  	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
> @@ -1359,7 +1359,7 @@ static int __maybe_unused mipi_csis_runtime_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused mipi_csis_runtime_resume(struct device *dev)
> +static int mipi_csis_runtime_resume(struct device *dev)
>  {
>  	struct v4l2_subdev *sd = dev_get_drvdata(dev);
>  	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
> @@ -1379,8 +1379,8 @@ static int __maybe_unused mipi_csis_runtime_resume(struct device *dev)
>  }
>  
>  static const struct dev_pm_ops mipi_csis_pm_ops = {
> -	SET_RUNTIME_PM_OPS(mipi_csis_runtime_suspend, mipi_csis_runtime_resume,
> -			   NULL)
> +	RUNTIME_PM_OPS(mipi_csis_runtime_suspend, mipi_csis_runtime_resume,
> +		       NULL)
>  };
>  
>  /* -----------------------------------------------------------------------------
> @@ -1571,7 +1571,7 @@ static struct platform_driver mipi_csis_driver = {
>  	.driver		= {
>  		.of_match_table = mipi_csis_of_match,
>  		.name		= CSIS_DRIVER_NAME,
> -		.pm		= &mipi_csis_pm_ops,
> +		.pm		= pm_ptr(&mipi_csis_pm_ops),
>  	},
>  };
>
diff mbox series

Patch

diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
index b9729a8883d6..08d8850399b6 100644
--- a/drivers/media/platform/nxp/imx-mipi-csis.c
+++ b/drivers/media/platform/nxp/imx-mipi-csis.c
@@ -1344,7 +1344,7 @@  static int mipi_csis_async_register(struct mipi_csis_device *csis)
  * Suspend/resume
  */
 
-static int __maybe_unused mipi_csis_runtime_suspend(struct device *dev)
+static int mipi_csis_runtime_suspend(struct device *dev)
 {
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
@@ -1359,7 +1359,7 @@  static int __maybe_unused mipi_csis_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused mipi_csis_runtime_resume(struct device *dev)
+static int mipi_csis_runtime_resume(struct device *dev)
 {
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct mipi_csis_device *csis = sd_to_mipi_csis_device(sd);
@@ -1379,8 +1379,8 @@  static int __maybe_unused mipi_csis_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops mipi_csis_pm_ops = {
-	SET_RUNTIME_PM_OPS(mipi_csis_runtime_suspend, mipi_csis_runtime_resume,
-			   NULL)
+	RUNTIME_PM_OPS(mipi_csis_runtime_suspend, mipi_csis_runtime_resume,
+		       NULL)
 };
 
 /* -----------------------------------------------------------------------------
@@ -1571,7 +1571,7 @@  static struct platform_driver mipi_csis_driver = {
 	.driver		= {
 		.of_match_table = mipi_csis_of_match,
 		.name		= CSIS_DRIVER_NAME,
-		.pm		= &mipi_csis_pm_ops,
+		.pm		= pm_ptr(&mipi_csis_pm_ops),
 	},
 };