Skip to contentSkip to conversation

iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

PATCH Applied Triet Hoang 4 participants 4 messages Aug 28 – Aug 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

Convert deprecated SIMPLE_DEV_PM_OPS() to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr(). Also replace SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL() with EXPORT_GPL_SIMPLE_DEV_PM_OPS().

This allows us to drop the __maybe_unused annotations from the resume callback. This is a straightforward cleanup with no functional change intended.

---
Changes in v2:
- Use EXPORT_GPL_SIMPLE_DEV_PM_OPS for cros_ec_sensors_pm_ops
- Wrap to 75 ish chars for commit messages.
Changes in v3:
- Update commit message based on feedback from v2, and added Reviewed-by tags. Changes in v4:
- Remove the "Reviewed-by" tags.
- Address EXPORT_GPL_SIMPLE_DEV_PM_OPS() usage in cros_ec_sensors_core.c.
---

 drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c      | 2 +-
 drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 5 ++---
 drivers/iio/light/cros_ec_light_prox.c                    | 2 +-
 drivers/iio/pressure/cros_ec_baro.c                       | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +1 -1
index b971f8b646be..551b86236abc 100644
@@ -311,7 +311,7 @@ MODULE_DEVICE_TABLE(platform, cros_ec_sensors_ids);
 static struct platform_driver cros_ec_sensors_platform_driver = {
 	.driver = {
 		.name	= "cros-ec-sensors",
-		.pm	= &cros_ec_sensors_pm_ops,
+		.pm	= pm_sleep_ptr(&cros_ec_sensors_pm_ops),
 	},
 	.probe		= cros_ec_sensors_probe,
 	.id_table	= cros_ec_sensors_ids,
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +2 -3
index 5133755c2ea6..d03e40c91582 100644
@@ -862,7 +862,7 @@ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st,
 }
 EXPORT_SYMBOL_GPL(cros_ec_sensors_core_write);
 
-static int __maybe_unused cros_ec_sensors_resume(struct device *dev)
+static int cros_ec_sensors_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
@@ -879,8 +879,7 @@ static int __maybe_unused cros_ec_sensors_resume(struct device *dev)
 	return ret;
 }
 
-SIMPLE_DEV_PM_OPS(cros_ec_sensors_pm_ops, NULL, cros_ec_sensors_resume);
-EXPORT_SYMBOL_GPL(cros_ec_sensors_pm_ops);
+EXPORT_GPL_SIMPLE_DEV_PM_OPS(cros_ec_sensors_pm_ops, NULL, cros_ec_sensors_resume);
 
 MODULE_DESCRIPTION("ChromeOS EC sensor hub core functions");
 MODULE_LICENSE("GPL v2");
drivers/iio/light/cros_ec_light_prox.c +1 -1
index 7ab565b1fb9f..b1c92de7922a 100644
@@ -249,7 +249,7 @@ MODULE_DEVICE_TABLE(platform, cros_ec_light_prox_ids);
 static struct platform_driver cros_ec_light_prox_platform_driver = {
 	.driver = {
 		.name	= "cros-ec-light-prox",
-		.pm	= &cros_ec_sensors_pm_ops,
+		.pm	= pm_sleep_ptr(&cros_ec_sensors_pm_ops),
 	},
 	.probe		= cros_ec_light_prox_probe,
 	.id_table	= cros_ec_light_prox_ids,
drivers/iio/pressure/cros_ec_baro.c +1 -1
index 6a567b6075d9..e4bc4df48d01 100644
@@ -192,7 +192,7 @@ MODULE_DEVICE_TABLE(platform, cros_ec_baro_ids);
 static struct platform_driver cros_ec_baro_platform_driver = {
 	.driver = {
 		.name	= "cros-ec-baro",
-		.pm	= &cros_ec_sensors_pm_ops,
+		.pm	= pm_sleep_ptr(&cros_ec_sensors_pm_ops),
 	},
 	.probe		= cros_ec_baro_probe,
 	.id_table	= cros_ec_baro_ids,
Signature · 1 line
2.53.0
Reviewed-by on v4 1/1
#1 lore raw
Quoted 8 lines · Triet Hoang

Convert deprecated SIMPLE_DEV_PM_OPS() to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr(). Also replace SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL() with EXPORT_GPL_SIMPLE_DEV_PM_OPS().

This allows us to drop the __maybe_unused annotations from the resume callback. This is a straightforward cleanup with no functional change intended.

maintainer Applied
#2 lore raw
Quoted 11 lines · On Fri, 28 Aug 2026 05:36:00 +0000 Tzung-Bi Shih <[email protected]> wrote:
Quoted 8 lines · Triet Hoang

Convert deprecated SIMPLE_DEV_PM_OPS() to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr(). Also replace SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL() with EXPORT_GPL_SIMPLE_DEV_PM_OPS().

This allows us to drop the __maybe_unused annotations from the resume callback. This is a straightforward cleanup with no functional change intended.

Applied.

Thanks

Jonathan

Reviewed-by on v4 1/1
#3 lore raw
In reply to Triet Hoang
Quoted 6 lines · Triet Hoang

Convert deprecated SIMPLE_DEV_PM_OPS() to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr(). Also replace SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL() with EXPORT_GPL_SIMPLE_DEV_PM_OPS().

This allows us to drop the __maybe_unused annotations from the resume callback. This is a straightforward cleanup with no functional change intended.

LGTM now,

Signature · 2 lines
With Best Regards,
Andy Shevchenko