[PATCH] input: touchscreen: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
From: Triet Hoang <hidden>
Date: 2026-08-21 02:44:55
Also in:
lkml
Subsystem:
ad7879 touchscreen driver (ad7879/ad7889), cyttsp touchscreen driver, input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers:
Michael Hennerich, Linus Walleij, Dmitry Torokhov, Linus Torvalds
Convert deprecated SIMPLE_DEV_PM_OPS to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr(). This lets us drop the __maybe_unused annotations from the resume and suspend callbacks. Also reduces kernel size when CONFIG_PM or CONFIG_PM_SLEEP is disabled. Signed-off-by: Triet Hoang <redacted> --- drivers/input/touchscreen/ad7879-i2c.c | 2 +- drivers/input/touchscreen/ad7879-spi.c | 2 +- drivers/input/touchscreen/ad7879.c | 8 ++++---- drivers/input/touchscreen/cyttsp5.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c
index c1ccdf86b74c..7ee5c0abd551 100644
--- a/drivers/input/touchscreen/ad7879-i2c.c
+++ b/drivers/input/touchscreen/ad7879-i2c.c@@ -60,7 +60,7 @@ static struct i2c_driver ad7879_i2c_driver = { .driver = { .name = "ad7879", .dev_groups = ad7879_groups, - .pm = &ad7879_pm_ops, + .pm = pm_sleep_ptr(&ad7879_pm_ops), .of_match_table = of_match_ptr(ad7879_i2c_dt_ids), }, .probe = ad7879_i2c_probe,
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c
index 064968fe57cf..66dcd4aa4711 100644
--- a/drivers/input/touchscreen/ad7879-spi.c
+++ b/drivers/input/touchscreen/ad7879-spi.c@@ -58,7 +58,7 @@ static struct spi_driver ad7879_spi_driver = { .driver = { .name = "ad7879", .dev_groups = ad7879_groups, - .pm = &ad7879_pm_ops, + .pm = pm_sleep_ptr(&ad7879_pm_ops), .of_match_table = of_match_ptr(ad7879_spi_dt_ids), }, .probe = ad7879_spi_probe,
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 31d2a3029d5f..f686f028d4bc 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c@@ -301,7 +301,7 @@ static void ad7879_close(struct input_dev *input) __ad7879_disable(ts); } -static int __maybe_unused ad7879_suspend(struct device *dev) +static int ad7879_suspend(struct device *dev) { struct ad7879 *ts = dev_get_drvdata(dev);
@@ -315,7 +315,7 @@ static int __maybe_unused ad7879_suspend(struct device *dev) return 0; } -static int __maybe_unused ad7879_resume(struct device *dev) +static int ad7879_resume(struct device *dev) { struct ad7879 *ts = dev_get_drvdata(dev);
@@ -329,8 +329,8 @@ static int __maybe_unused ad7879_resume(struct device *dev) return 0; } -SIMPLE_DEV_PM_OPS(ad7879_pm_ops, ad7879_suspend, ad7879_resume); -EXPORT_SYMBOL(ad7879_pm_ops); +DEFINE_SIMPLE_DEV_PM_OPS(ad7879_pm_ops, ad7879_suspend, ad7879_resume); +EXPORT_SIMPLE_DEV_PM_OPS(ad7879_pm_ops, ad7879_suspend, ad7879_resume); static void ad7879_toggle(struct ad7879 *ts, bool disable) {
diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
index 9266c07314be..7b0613156fc1 100644
--- a/drivers/input/touchscreen/cyttsp5.c
+++ b/drivers/input/touchscreen/cyttsp5.c@@ -942,7 +942,7 @@ static const struct i2c_device_id cyttsp5_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, cyttsp5_i2c_id); -static int __maybe_unused cyttsp5_suspend(struct device *dev) +static int cyttsp5_suspend(struct device *dev) { struct cyttsp5 *ts = dev_get_drvdata(dev);
@@ -952,7 +952,7 @@ static int __maybe_unused cyttsp5_suspend(struct device *dev) return 0; } -static int __maybe_unused cyttsp5_resume(struct device *dev) +static int cyttsp5_resume(struct device *dev) { struct cyttsp5 *ts = dev_get_drvdata(dev);
@@ -962,13 +962,13 @@ static int __maybe_unused cyttsp5_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(cyttsp5_pm, cyttsp5_suspend, cyttsp5_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cyttsp5_pm, cyttsp5_suspend, cyttsp5_resume); static struct i2c_driver cyttsp5_i2c_driver = { .driver = { .name = CYTTSP5_NAME, .of_match_table = cyttsp5_of_match, - .pm = &cyttsp5_pm, + .pm = pm_sleep_ptr(&cyttsp5_pm), }, .probe = cyttsp5_i2c_probe, .id_table = cyttsp5_i2c_id,
--
2.53.0