All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [media] ad5820: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
@ 2026-08-21  4:47 Triet Hoang
  0 siblings, 0 replies; only message in thread
From: Triet Hoang @ 2026-08-21  4:47 UTC (permalink / raw)
  To: sakari.ailus; +Cc: pavel, mchehab, linux-media, linux-kernel, Triet Hoang

Convert the deprecated SIMPLE_DEV_PM_OPS
to DEFINE_SIMPLE_DEV_PM_OPS
and pm_sleep_ptr().

This lets us drop the __maybe_unused annotations
from its suspend and resume callbacks,
also reduces kernel size in case CONFIG_PM or
CONFIG_PM_SLEEP is disabled.

Fixes: 37f0644f3a56 ("[media] ad5820: use __maybe_unused for PM functions")
Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
 drivers/media/i2c/ad5820.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c
index fcce2857b69e..7418ae227636 100644
--- a/drivers/media/i2c/ad5820.c
+++ b/drivers/media/i2c/ad5820.c
@@ -268,7 +268,7 @@ static const struct v4l2_subdev_internal_ops ad5820_internal_ops = {
 /*
  * I2C driver
  */
-static int __maybe_unused ad5820_suspend(struct device *dev)
+static int ad5820_suspend(struct device *dev)
 {
 	struct v4l2_subdev *subdev = dev_get_drvdata(dev);
 	struct ad5820_device *coil = to_ad5820_device(subdev);
@@ -279,7 +279,7 @@ static int __maybe_unused ad5820_suspend(struct device *dev)
 	return ad5820_power_off(coil, false);
 }
 
-static int __maybe_unused ad5820_resume(struct device *dev)
+static int ad5820_resume(struct device *dev)
 {
 	struct v4l2_subdev *subdev = dev_get_drvdata(dev);
 	struct ad5820_device *coil = to_ad5820_device(subdev);
@@ -360,12 +360,12 @@ static const struct of_device_id ad5820_of_table[] = {
 };
 MODULE_DEVICE_TABLE(of, ad5820_of_table);
 
-static SIMPLE_DEV_PM_OPS(ad5820_pm, ad5820_suspend, ad5820_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ad5820_pm, ad5820_suspend, ad5820_resume);
 
 static struct i2c_driver ad5820_i2c_driver = {
 	.driver		= {
 		.name	= "ad5820",
-		.pm	= &ad5820_pm,
+		.pm	= pm_sleep_ptr(&ad5820_pm),
 		.of_match_table = ad5820_of_table,
 	},
 	.probe		= ad5820_probe,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-21  4:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  4:47 [PATCH] [media] ad5820: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.