iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Subsystems (2)
PATCH 1/1 iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
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 the resume callbacks, and reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled.
--- drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +- drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 4 ++-- drivers/iio/light/cros_ec_light_prox.c | 2 +- drivers/iio/pressure/cros_ec_baro.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +1 -1
@@ -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 -2
@@ -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,7 +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); +DEFINE_SIMPLE_DEV_PM_OPS (cros_ec_sensors_pm_ops,NULL , cros_ec_sensors_resume);EXPORT_SYMBOL_GPL (cros_ec_sensors_pm_ops);MODULE_DESCRIPTION ("ChromeOS EC sensor hub core functions" );
drivers/iio/light/cros_ec_light_prox.c +1 -1
@@ -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
@@ -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
Jonathan Cameron
maintainerQuoted 2 lines · On Fri, 21 Aug 2026 08:44:54 +0700 Triet Hoang <[email protected]>…
Convert the deprecated
SIMPLE_DEV_PM_OPStoDEFINE_SIMPLE_DEV_PM_OPSandpm_sleep_ptr().
Hi Triet,
Wrap to 75 ish chars for commit messages.
Quoted 6 lines
This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size in caseCONFIG_PMorCONFIG_PM_SLEEPis disabled.Signed-off-by Triet Hoang <[email protected]>
One more thing below.
Quoted 14 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +1
-1@@ -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);
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c static int __maybe_unused cros_ec_sensors_resume(struct device *dev) · line 882
Quoted 5 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +1
-1@@ -879,7 +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); +DEFINE_SIMPLE_DEV_PM_OPS (cros_ec_sensors_pm_ops,NULL , cros_ec_sensors_resume);
Take a look at where this macro and the comment right next to it...
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c static int __maybe_unused cros_ec_sensors_resume(struct device *dev) · line 883
Quoted 1 line
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +0
-0EXPORT_SYMBOL_GPL (cros_ec_sensors_pm_ops);
relating to this circumstance.
Quoted 3 lines · On Fri, 21 Aug 2026 02:54:53 +0100 Jonathan Cameron <[email protected]> wrote:
Hi Triet,
Wrap to 75 ish chars for commit messages.
Thanks for that! I will keep in my mind.
Quoted 4 lines
Quoted 3 lines
Take a look at where this macro and the comment right next to it...
EXPORT_SYMBOL_GPL(cros_ec_sensors_pm_ops);relating to this circumstance.
I think we should use EXPORT_GPL_SIMPLE_DEV_PM_OPS here. Should I send the v2 patch to correct it?
Regards,
Triet
Quoted 6 lines · Triet Hoang
Convert the deprecated
SIMPLE_DEV_PM_OPStoDEFINE_SIMPLE_DEV_PM_OPSandpm_sleep_ptr().This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size in caseCONFIG_PMorCONFIG_PM_SLEEPis disabled.
There is room on the lines to make them longer a bit.
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 the resume callbacks, and reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled.
...
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c static int __maybe_unused cros_ec_sensors_resume(struct device *dev) · line 883
Quoted 3 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +1
-1-SIMPLE_DEV_PM_OPS (cros_ec_sensors_pm_ops,NULL , cros_ec_sensors_resume); +DEFINE_SIMPLE_DEV_PM_OPS (cros_ec_sensors_pm_ops,NULL , cros_ec_sensors_resume);EXPORT_SYMBOL_GPL (cros_ec_sensors_pm_ops);
There is a macro that combines DEFINE + EXPORT.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 1 line · Andy Shevchenko
There is a macro that combines DEFINE + EXPORT.
Hi Andy,
Thanks for reviewing. Should I send the v2 with the update?
Quoted 7 lines
There is room on the lines to make them longer a bit.
Convert the deprecated
SIMPLE_DEV_PM_OPStoDEFINE_SIMPLE_DEV_PM_OPSandpm_sleep_ptr().This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size in caseCONFIG_PMorCONFIG_PM_SLEEPis disabled.
With the new commit that you have suggested.
BR,
Triet
Quoted 4 lines · Triet Hoang
Quoted 1 line · Andy Shevchenko
There is a macro that combines DEFINE + EXPORT.
Thanks for reviewing. Should I send the v2 with the update?
v2 should incorporate the requested changes.
Quoted 9 lines
Quoted 7 lines
There is room on the lines to make them longer a bit.
Convert the deprecated
SIMPLE_DEV_PM_OPStoDEFINE_SIMPLE_DEV_PM_OPSandpm_sleep_ptr().This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size in caseCONFIG_PMorCONFIG_PM_SLEEPis disabled.With the new commit that you have suggested.
It should be a new version of the same change, but with the comments being addressed.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 9 lines · On Fri, 21 Aug 2026 09:10:07 +0700 Triet Hoang <[email protected]>…
Quoted 3 lines · On Fri, 21 Aug 2026 02:54:53 +0100 Jonathan Cameron <[email protected]> wrote:
Hi Triet,
Wrap to 75 ish chars for commit messages.
Thanks for that! I will keep in my mind.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Take a look at where this macro and the comment right next to it...
EXPORT_SYMBOL_GPL(cros_ec_sensors_pm_ops);relating to this circumstance.
I think we should use
EXPORT_GPL_SIMPLE_DEV_PM_OPShere. Should I send the v2 patch to correct it?
Please do. Though normal process is to wait a few more days first to see if you get any other feedback that can be incorporated into v2.
Jonathan
Quoted 3 lines
Regards,
Triet
PATCH v2 1/1 iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
In reply to Triet HoangConvert 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 callbacks, and reduces kernel size when CONFIG_PM or CONFIG_PM_SLEEP is disabled.
---
Changes in v2:
- Use EXPORT_GPL_SIMPLE_DEV_PM_OPS for cros_ec_sensors_pm_ops
- Wrap to 75 ish chars for commit messages.
---
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
@@ -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
@@ -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
@@ -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
@@ -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
Quoted 2 lines · Triet Hoang
Convert deprecated
SIMPLE_DEV_PM_OPStoDEFINE_SIMPLE_DEV_PM_OPSandpm_sleep_ptr().
This needs to update accordingly: SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL() -> EXPORT_GPL_SIMPLE_DEV_PM_OPS().
Quoted 5 lines
This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size whenCONFIG_PMorCONFIG_PM_SLEEPis disabled.Signed-off-by Triet Hoang <[email protected]>
With a nit in the commit message,
Quoted 11 lines · Tzung-Bi Shih
This needs to update accordingly:
SIMPLE_DEV_PM_OPS()+EXPORT_SYMBOL_GPL()->EXPORT_GPL_SIMPLE_DEV_PM_OPS().Quoted 5 lines
This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size whenCONFIG_PMorCONFIG_PM_SLEEPis disabled.Signed-off-by Triet Hoang <[email protected]>With a nit in the commit message,
Reviewed-by Tzung-Bi Shih <[email protected]>
Thanks for your review. Should I send the v3 to update this? Or maintainer will 'amend' the commit message when apply patch.
Regards,
Triet
Quoted 1 line · Triet Hoang
Convert deprecated
SIMPLE_DEV_PM_OPStoDEFINE_SIMPLE_DEV_PM_OPS
SIMPLE_DEV_PM_OPS()DEFINE_SIMPLE_DEV_PM_OPS()
Quoted 4 lines
and
pm_sleep_ptr().This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size whenCONFIG_PMorCONFIG_PM_SLEEPis disabled.
Not really, the __maybe_unused is done in a way that _object_ size is bigger (function is compiled), but since it's put in a separate section, linker will drop it as unused, so the resulting binary will not have it.
...
Code wise looks good to me.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 5 lines · Triet Hoang
Quoted 3 lines · Tzung-Bi Shih
This needs to update accordingly:
SIMPLE_DEV_PM_OPS()+EXPORT_SYMBOL_GPL()->EXPORT_GPL_SIMPLE_DEV_PM_OPS().
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
This lets us drop the
__maybe_unusedannotations from the resume callbacks, and reduces kernel size whenCONFIG_PMorCONFIG_PM_SLEEPis disabled.With a nit in the commit message,
Reviewed-by Tzung-Bi Shih <[email protected]>Thanks for your review. Should I send the v3 to update this? Or maintainer will 'amend' the commit message when apply patch.
Taking into account that I gave also comments (and we have plenty of time), please v3.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 1/1 iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
In reply to Triet HoangConvert 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 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.
---
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
@@ -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
@@ -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
@@ -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
@@ -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
Quoted 10 lines · On Tue, 25 Aug 2026 16:35:24 +0700 Triet Hoang <[email protected]>…
Convert deprecated
SIMPLE_DEV_PM_OPS()toDEFINE_SIMPLE_DEV_PM_OPS()andpm_sleep_ptr().This lets us drop the
__maybe_unusedannotations from the resume callback. This is a straightforward cleanup with no functional change intended.Signed-off-by Triet Hoang <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Quoted 7 lines
---
Changes in v2:
- UseEXPORT_GPL_SIMPLE_DEV_PM_OPSforcros_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.
---
Please don't send a new version as a reply to the previous version, it can break tooling like b4. Additionally, please wait at least 24 hours before sending a new version.
Signature · 2 lines
Kind regards, Joshua Crofts
Quoted 2 lines · Triet Hoang
Convert deprecated
SIMPLE_DEV_PM_OPS()toDEFINE_SIMPLE_DEV_PM_OPS()andpm_sleep_ptr().
My comments from v2 haven't been addressed here.
Quoted 8 lines
This lets us drop the
__maybe_unusedannotations from the resume callback. This is a straightforward cleanup with no functional change intended.Signed-off-by Triet Hoang <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Reviewed-by Jonathan Cameron <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Neither Jonathan nor Andy have provided their Reviewed-by tags yet. You can't include them unless they explicitly provide them on the mailing list.
My Reviewed-by tag from v2 was conditional on my comments being addressed. Please drop it for now until they are resolved.