Re: [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
From: Jonathan Cameron
Date: Thu Aug 20 2026 - 21:56:17 EST
On Fri, 21 Aug 2026 08:44:54 +0700
Triet Hoang <triet.hoang.dev@xxxxxxxxx> wrote:
> Convert the deprecated SIMPLE_DEV_PM_OPS
> to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr().
Hi Triet,
Wrap to 75 ish chars for commit messages.
>
> 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.
>
> Signed-off-by: Triet Hoang <triet.hoang.dev@xxxxxxxxx>
One more thing below.
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> index 5133755c2ea6..7d09f7c7d35c 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
> @@ -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);
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.