media: imx-jpeg: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS()
authorFabio Estevam <festevam@denx.de>
Fri, 9 Aug 2024 01:20:13 +0000 (22:20 -0300)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Sat, 12 Oct 2024 14:28:24 +0000 (16:28 +0200)
Replace SET_RUNTIME_PM_OPS()/SET SYSTEM_SLEEP_PM_OPS() with their modern
RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() alternatives.

The combined usage of pm_ptr() and RUNTIME_PM_OPS/SYSTEM_SLEEP_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 CONFIG_PM ifdefery from the runtime
suspend/resume() functions.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c

index 1d891381303722e8efdcfe26fb9b8a804b64d900..3428ff9d51e9ff7076cfa1f94d011ce9d6199d07 100644 (file)
@@ -2888,7 +2888,6 @@ err_clk:
        return ret;
 }
 
-#ifdef CONFIG_PM
 static int mxc_jpeg_runtime_resume(struct device *dev)
 {
        struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
@@ -2911,9 +2910,7 @@ static int mxc_jpeg_runtime_suspend(struct device *dev)
 
        return 0;
 }
-#endif
 
-#ifdef CONFIG_PM_SLEEP
 static int mxc_jpeg_suspend(struct device *dev)
 {
        struct mxc_jpeg_dev *jpeg = dev_get_drvdata(dev);
@@ -2934,12 +2931,10 @@ static int mxc_jpeg_resume(struct device *dev)
        v4l2_m2m_resume(jpeg->m2m_dev);
        return ret;
 }
-#endif
 
 static const struct dev_pm_ops mxc_jpeg_pm_ops = {
-       SET_RUNTIME_PM_OPS(mxc_jpeg_runtime_suspend,
-                          mxc_jpeg_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(mxc_jpeg_suspend, mxc_jpeg_resume)
+       RUNTIME_PM_OPS(mxc_jpeg_runtime_suspend, mxc_jpeg_runtime_resume, NULL)
+       SYSTEM_SLEEP_PM_OPS(mxc_jpeg_suspend, mxc_jpeg_resume)
 };
 
 static void mxc_jpeg_remove(struct platform_device *pdev)
@@ -2963,7 +2958,7 @@ static struct platform_driver mxc_jpeg_driver = {
        .driver = {
                .name = "mxc-jpeg",
                .of_match_table = mxc_jpeg_match,
-               .pm = &mxc_jpeg_pm_ops,
+               .pm = pm_ptr(&mxc_jpeg_pm_ops),
        },
 };
 module_platform_driver(mxc_jpeg_driver);