The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
@ 2026-08-21  1:44 Triet Hoang
  2026-08-21  1:54 ` Jonathan Cameron
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Triet Hoang @ 2026-08-21  1:44 UTC (permalink / raw)
  To: jic23
  Cc: dlechner, nuno.sa, andy, bleung, groeck, linux-iio,
	chrome-platform, 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 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@gmail.com>
---
 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(-)

diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index b971f8b646be..551b86236abc 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -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,
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);
 EXPORT_SYMBOL_GPL(cros_ec_sensors_pm_ops);
 
 MODULE_DESCRIPTION("ChromeOS EC sensor hub core functions");
diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cros_ec_light_prox.c
index 7ab565b1fb9f..b1c92de7922a 100644
--- a/drivers/iio/light/cros_ec_light_prox.c
+++ b/drivers/iio/light/cros_ec_light_prox.c
@@ -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,
diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cros_ec_baro.c
index 6a567b6075d9..e4bc4df48d01 100644
--- a/drivers/iio/pressure/cros_ec_baro.c
+++ b/drivers/iio/pressure/cros_ec_baro.c
@@ -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,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21  1:44 [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
@ 2026-08-21  1:54 ` Jonathan Cameron
  2026-08-21  2:10   ` Triet Hoang
  2026-08-21 13:37 ` Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Jonathan Cameron @ 2026-08-21  1:54 UTC (permalink / raw)
  To: Triet Hoang
  Cc: dlechner, nuno.sa, andy, bleung, groeck, linux-iio,
	chrome-platform, linux-kernel

On Fri, 21 Aug 2026 08:44:54 +0700
Triet Hoang <triet.hoang.dev@gmail.com> 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@gmail.com>

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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21  1:54 ` Jonathan Cameron
@ 2026-08-21  2:10   ` Triet Hoang
  2026-08-21 16:02     ` Jonathan Cameron
  0 siblings, 1 reply; 15+ messages in thread
From: Triet Hoang @ 2026-08-21  2:10 UTC (permalink / raw)
  To: jic23
  Cc: andy, bleung, chrome-platform, dlechner, groeck, linux-iio,
	linux-kernel, nuno.sa, triet.hoang.dev

On Fri, 21 Aug 2026 02:54:53 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> Hi Triet,
> 
> Wrap to 75 ish chars for commit messages.

Thanks for that! I will keep in my mind.

> > 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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21  1:44 [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
  2026-08-21  1:54 ` Jonathan Cameron
@ 2026-08-21 13:37 ` Andy Shevchenko
  2026-08-21 14:04   ` Triet Hoang
  2026-08-25  1:27 ` [PATCH v2] " Triet Hoang
  2026-08-25  9:35 ` [PATCH v3] " Triet Hoang
  3 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2026-08-21 13:37 UTC (permalink / raw)
  To: Triet Hoang
  Cc: jic23, dlechner, nuno.sa, andy, bleung, groeck, linux-iio,
	chrome-platform, linux-kernel

On Fri, Aug 21, 2026 at 08:44:54AM +0700, Triet Hoang wrote:
> 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.

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.


...

> -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.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21 13:37 ` Andy Shevchenko
@ 2026-08-21 14:04   ` Triet Hoang
  2026-08-21 16:01     ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Triet Hoang @ 2026-08-21 14:04 UTC (permalink / raw)
  To: andriy.shevchenko
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa, triet.hoang.dev

On Fri, 21 Aug 2026 16:37:18 +0300, Andy Shevchenko wrote:
> There is a macro that combines DEFINE + EXPORT.

Hi Andy,

Thanks for reviewing. Should I send the v2 with the update?

> 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.

With the new commit that you have suggested.

BR,
Triet

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21 14:04   ` Triet Hoang
@ 2026-08-21 16:01     ` Andy Shevchenko
  0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2026-08-21 16:01 UTC (permalink / raw)
  To: Triet Hoang
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa

On Fri, Aug 21, 2026 at 02:04:50PM +0000, Triet Hoang wrote:
> On Fri, 21 Aug 2026 16:37:18 +0300, Andy Shevchenko wrote:
> > 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.

> > 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.
> 
> With the new commit that you have suggested.

It should be a new version of the same change, but with the comments being
addressed.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21  2:10   ` Triet Hoang
@ 2026-08-21 16:02     ` Jonathan Cameron
  0 siblings, 0 replies; 15+ messages in thread
From: Jonathan Cameron @ 2026-08-21 16:02 UTC (permalink / raw)
  To: Triet Hoang
  Cc: andy, bleung, chrome-platform, dlechner, groeck, linux-iio,
	linux-kernel, nuno.sa

On Fri, 21 Aug 2026 09:10:07 +0700
Triet Hoang <triet.hoang.dev@gmail.com> wrote:

> On Fri, 21 Aug 2026 02:54:53 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > Hi Triet,
> > 
> > Wrap to 75 ish chars for commit messages.  
> 
> Thanks for that! I will keep in my mind.
> 
> > > 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?
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

> 
> Regards,
> Triet


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21  1:44 [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
  2026-08-21  1:54 ` Jonathan Cameron
  2026-08-21 13:37 ` Andy Shevchenko
@ 2026-08-25  1:27 ` Triet Hoang
  2026-08-25  1:52   ` Tzung-Bi Shih
  2026-08-25  9:14   ` Andy Shevchenko
  2026-08-25  9:35 ` [PATCH v3] " Triet Hoang
  3 siblings, 2 replies; 15+ messages in thread
From: Triet Hoang @ 2026-08-25  1:27 UTC (permalink / raw)
  To: triet.hoang.dev
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa

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 callbacks,
and reduces kernel size when CONFIG_PM or CONFIG_PM_SLEEP is disabled.

Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
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(-)

diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index b971f8b646be..551b86236abc 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -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,
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..d03e40c91582 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,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");
diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cros_ec_light_prox.c
index 7ab565b1fb9f..b1c92de7922a 100644
--- a/drivers/iio/light/cros_ec_light_prox.c
+++ b/drivers/iio/light/cros_ec_light_prox.c
@@ -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,
diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cros_ec_baro.c
index 6a567b6075d9..e4bc4df48d01 100644
--- a/drivers/iio/pressure/cros_ec_baro.c
+++ b/drivers/iio/pressure/cros_ec_baro.c
@@ -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,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-25  1:27 ` [PATCH v2] " Triet Hoang
@ 2026-08-25  1:52   ` Tzung-Bi Shih
  2026-08-25  2:32     ` Triet Hoang
  2026-08-25  9:14   ` Andy Shevchenko
  1 sibling, 1 reply; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-08-25  1:52 UTC (permalink / raw)
  To: Triet Hoang
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa

On Tue, Aug 25, 2026 at 08:27:24AM +0700, Triet Hoang wrote:
> Convert deprecated SIMPLE_DEV_PM_OPS to DEFINE_SIMPLE_DEV_PM_OPS
> and pm_sleep_ptr().

This needs to update accordingly: SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL()
-> EXPORT_GPL_SIMPLE_DEV_PM_OPS().

> 
> 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.
> 
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>

With a nit in the commit message,
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-25  1:52   ` Tzung-Bi Shih
@ 2026-08-25  2:32     ` Triet Hoang
  2026-08-25  9:15       ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Triet Hoang @ 2026-08-25  2:32 UTC (permalink / raw)
  To: tzungbi
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa, triet.hoang.dev

On Tue, 25 Aug 2026 01:52:20 +0000, Tzung-Bi Shih wrote:

> This needs to update accordingly: SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL()
> -> EXPORT_GPL_SIMPLE_DEV_PM_OPS().
> 
> > 
> > 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.
> > 
> > Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
> 
> With a nit in the commit message,
> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>

Thanks for your review. Should I send the v3 to update this?
Or maintainer will 'amend' the commit message when apply patch.

Regards,
Triet

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-25  1:27 ` [PATCH v2] " Triet Hoang
  2026-08-25  1:52   ` Tzung-Bi Shih
@ 2026-08-25  9:14   ` Andy Shevchenko
  1 sibling, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2026-08-25  9:14 UTC (permalink / raw)
  To: Triet Hoang
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa

On Tue, Aug 25, 2026 at 08:27:24AM +0700, Triet Hoang wrote:
> Convert deprecated SIMPLE_DEV_PM_OPS to DEFINE_SIMPLE_DEV_PM_OPS

SIMPLE_DEV_PM_OPS()
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.

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.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-25  2:32     ` Triet Hoang
@ 2026-08-25  9:15       ` Andy Shevchenko
  0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2026-08-25  9:15 UTC (permalink / raw)
  To: Triet Hoang
  Cc: tzungbi, andy, bleung, chrome-platform, dlechner, groeck, jic23,
	linux-iio, linux-kernel, nuno.sa

On Tue, Aug 25, 2026 at 09:32:16AM +0700, Triet Hoang wrote:
> On Tue, 25 Aug 2026 01:52:20 +0000, Tzung-Bi Shih wrote:
> 
> > This needs to update accordingly: SIMPLE_DEV_PM_OPS() + EXPORT_SYMBOL_GPL()
> > -> EXPORT_GPL_SIMPLE_DEV_PM_OPS().
> > 
> > > 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.
> > 
> > With a nit in the commit message,
> > Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
> 
> 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.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v3] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-21  1:44 [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
                   ` (2 preceding siblings ...)
  2026-08-25  1:27 ` [PATCH v2] " Triet Hoang
@ 2026-08-25  9:35 ` Triet Hoang
  2026-08-25  9:42   ` Joshua Crofts
  2026-08-25 10:51   ` Tzung-Bi Shih
  3 siblings, 2 replies; 15+ messages in thread
From: Triet Hoang @ 2026-08-25  9:35 UTC (permalink / raw)
  To: triet.hoang.dev
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa, Tzung-Bi Shih, Andy Shevchenko

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 callback.
This is a straightforward cleanup with no functional change intended.

Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
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(-)

diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index b971f8b646be..551b86236abc 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -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,
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..d03e40c91582 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,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");
diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cros_ec_light_prox.c
index 7ab565b1fb9f..b1c92de7922a 100644
--- a/drivers/iio/light/cros_ec_light_prox.c
+++ b/drivers/iio/light/cros_ec_light_prox.c
@@ -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,
diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cros_ec_baro.c
index 6a567b6075d9..e4bc4df48d01 100644
--- a/drivers/iio/pressure/cros_ec_baro.c
+++ b/drivers/iio/pressure/cros_ec_baro.c
@@ -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,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v3] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-25  9:35 ` [PATCH v3] " Triet Hoang
@ 2026-08-25  9:42   ` Joshua Crofts
  2026-08-25 10:51   ` Tzung-Bi Shih
  1 sibling, 0 replies; 15+ messages in thread
From: Joshua Crofts @ 2026-08-25  9:42 UTC (permalink / raw)
  To: Triet Hoang
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa, Tzung-Bi Shih, Andy Shevchenko

On Tue, 25 Aug 2026 16:35:24 +0700
Triet Hoang <triet.hoang.dev@gmail.com> wrote:

> 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 callback.
> This is a straightforward cleanup with no functional change intended.
> 
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
> Reviewed-by: Jonathan Cameron <jic23@kernel.org>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> ---
> 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.
> ---

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.

-- 
Kind regards,
Joshua Crofts

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
  2026-08-25  9:35 ` [PATCH v3] " Triet Hoang
  2026-08-25  9:42   ` Joshua Crofts
@ 2026-08-25 10:51   ` Tzung-Bi Shih
  1 sibling, 0 replies; 15+ messages in thread
From: Tzung-Bi Shih @ 2026-08-25 10:51 UTC (permalink / raw)
  To: Triet Hoang
  Cc: andy, bleung, chrome-platform, dlechner, groeck, jic23, linux-iio,
	linux-kernel, nuno.sa, Andy Shevchenko

On Tue, Aug 25, 2026 at 04:35:24PM +0700, Triet Hoang wrote:
> Convert deprecated SIMPLE_DEV_PM_OPS() to DEFINE_SIMPLE_DEV_PM_OPS()
> and pm_sleep_ptr().

My comments from v2 haven't been addressed here.

> 
> This lets us drop the __maybe_unused annotations from the resume callback.
> This is a straightforward cleanup with no functional change intended.
> 
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
> Reviewed-by: Jonathan Cameron <jic23@kernel.org>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

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.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-08-25 10:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21  1:44 [PATCH] iio: cros_ec: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
2026-08-21  1:54 ` Jonathan Cameron
2026-08-21  2:10   ` Triet Hoang
2026-08-21 16:02     ` Jonathan Cameron
2026-08-21 13:37 ` Andy Shevchenko
2026-08-21 14:04   ` Triet Hoang
2026-08-21 16:01     ` Andy Shevchenko
2026-08-25  1:27 ` [PATCH v2] " Triet Hoang
2026-08-25  1:52   ` Tzung-Bi Shih
2026-08-25  2:32     ` Triet Hoang
2026-08-25  9:15       ` Andy Shevchenko
2026-08-25  9:14   ` Andy Shevchenko
2026-08-25  9:35 ` [PATCH v3] " Triet Hoang
2026-08-25  9:42   ` Joshua Crofts
2026-08-25 10:51   ` Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox