On Wed Jul 29 06:04:40 2026 +0000, Tharit Tangkijwanichakul wrote:
> The runtime suspend and resume callbacks are currently guarded by
> CONFIG_PM. Removing the guard directly would leave the callbacks unused
> when CONFIG_PM is disabled.
>
> Define the PM operations with DEFINE_RUNTIME_DEV_PM_OPS() and use
> pm_ptr() when assigning them to the platform driver. This keeps the PM
> callbacks available when needed while avoiding unused-function warnings
> for CONFIG_PM=n builds.
>
> Signed-off-by: Tharit Tangkijwanichakul <[email protected]>
> Reviewed-by: Frank Li <[email protected]>
> Signed-off-by: Nicolas Dufresne <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>
Patch committed.
Thanks,
Hans Verkuil
drivers/media/platform/verisilicon/hantro_drv.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c
b/drivers/media/platform/verisilicon/hantro_drv.c
index 43f67b9fcf27..7cffbde8ce6e 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -1290,7 +1290,6 @@ static void hantro_remove(struct platform_device *pdev)
pm_runtime_disable(vpu->dev);
}
-#ifdef CONFIG_PM
static int hantro_runtime_resume(struct device *dev)
{
struct hantro_dev *vpu = dev_get_drvdata(dev);
@@ -1320,13 +1319,9 @@ static int hantro_runtime_suspend(struct device *dev)
clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
return 0;
}
-#endif
-static const struct dev_pm_ops hantro_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
- pm_runtime_force_resume)
- SET_RUNTIME_PM_OPS(hantro_runtime_suspend, hantro_runtime_resume, NULL)
-};
+static DEFINE_RUNTIME_DEV_PM_OPS(hantro_pm_ops, hantro_runtime_suspend,
+ hantro_runtime_resume, NULL);
static struct platform_driver hantro_driver = {
.probe = hantro_probe,
@@ -1334,7 +1329,7 @@ static struct platform_driver hantro_driver = {
.driver = {
.name = DRIVER_NAME,
.of_match_table = of_hantro_match,
- .pm = &hantro_pm_ops,
+ .pm = pm_ptr(&hantro_pm_ops),
},
};
module_platform_driver(hantro_driver);
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]