All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] IIO: Where dev_pm_ops rework and namespaces meet.
@ 2022-04-01 14:06 Jonathan Cameron
  2022-04-01 14:06 ` [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume() Jonathan Cameron
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-04-01 14:06 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-iio; +Cc: Paul Cercueil, Linux PM

v2:
Just the first 3 patches so they can go via the PM tree.
Remainder of series will go via IIO in due course.

Hi All,

As these two activities have been ongoing across IIO at the same time
it was inevitable that there would be drivers were they both interact.
In particularly when we have EXPORT* of struct dev_pm_ops.

This series covers those cases by introducing (in patch 2)
EXPORT_NS[_GPL]_SIMPLE_DEV_PM_OPS() and
EXPORT_NS[_GPL]_RUNTIME_DEV_PM_OPS()
that add a namespace as the final parameter.

Thanks,

Jonathan

Jonathan Cameron (3):
  iio: chemical: scd30: Export dev_pm_ops instead of suspend() and
    resume()
  PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and
    runtime pm equiv
  iio: chemical: scd30: Move symbol exports into IIO_SCD30 namespace

 drivers/iio/chemical/scd30.h        |  5 +----
 drivers/iio/chemical/scd30_core.c   | 10 +++++-----
 drivers/iio/chemical/scd30_i2c.c    |  3 ++-
 drivers/iio/chemical/scd30_serial.c |  3 ++-
 include/linux/pm.h                  | 14 +++++++++-----
 include/linux/pm_runtime.h          | 10 ++++++++--
 6 files changed, 27 insertions(+), 18 deletions(-)

-- 
2.32.0


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

* [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume()
  2022-04-01 14:06 [PATCH v2 0/3] IIO: Where dev_pm_ops rework and namespaces meet Jonathan Cameron
@ 2022-04-01 14:06 ` Jonathan Cameron
  2022-04-05 18:19   ` Rafael J. Wysocki
  2022-04-01 14:06 ` [PATCH v2 2/3] PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and runtime pm equiv Jonathan Cameron
  2022-04-01 14:06 ` [PATCH v2 3/3] iio: chemical: scd30: Move symbol exports into IIO_SCD30 namespace Jonathan Cameron
  2 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2022-04-01 14:06 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-iio; +Cc: Paul Cercueil, Linux PM

Whilst here move to the new infrastructure using pm_sleep_ptr()
and EXPORT_DEV_PM_OPS() so as to let the compiler remove the unused
code if CONFIG_SLEEP is not defined.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
---
 drivers/iio/chemical/scd30.h        | 5 +----
 drivers/iio/chemical/scd30_core.c   | 8 ++++----
 drivers/iio/chemical/scd30_i2c.c    | 2 +-
 drivers/iio/chemical/scd30_serial.c | 2 +-
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/chemical/scd30.h b/drivers/iio/chemical/scd30.h
index f60127bfe0f4..1ac9f3f79271 100644
--- a/drivers/iio/chemical/scd30.h
+++ b/drivers/iio/chemical/scd30.h
@@ -68,10 +68,7 @@ struct scd30_state {
 	scd30_command_t command;
 };
 
-int scd30_suspend(struct device *dev);
-int scd30_resume(struct device *dev);
-
-static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
+extern const struct dev_pm_ops scd30_pm_ops;
 
 int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command);
 
diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
index 9fe6bbe9ee04..6c6c11c2772a 100644
--- a/drivers/iio/chemical/scd30_core.c
+++ b/drivers/iio/chemical/scd30_core.c
@@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
 	IIO_CHAN_SOFT_TIMESTAMP(3),
 };
 
-int __maybe_unused scd30_suspend(struct device *dev)
+static int scd30_suspend(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct scd30_state *state  = iio_priv(indio_dev);
@@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)
 
 	return regulator_disable(state->vdd);
 }
-EXPORT_SYMBOL(scd30_suspend);
 
-int __maybe_unused scd30_resume(struct device *dev)
+static int scd30_resume(struct device *dev)
 {
 	struct iio_dev *indio_dev = dev_get_drvdata(dev);
 	struct scd30_state *state = iio_priv(indio_dev);
@@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)
 
 	return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
 }
-EXPORT_SYMBOL(scd30_resume);
+
+EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
 
 static void scd30_stop_meas(void *data)
 {
diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c
index 875892a070ee..7c332e4e8e46 100644
--- a/drivers/iio/chemical/scd30_i2c.c
+++ b/drivers/iio/chemical/scd30_i2c.c
@@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = scd30_i2c_of_match,
-		.pm = &scd30_pm_ops,
+		.pm = pm_sleep_ptr(&scd30_pm_ops),
 	},
 	.probe_new = scd30_i2c_probe,
 };
diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c
index 568b34486c44..8664f3ce6b33 100644
--- a/drivers/iio/chemical/scd30_serial.c
+++ b/drivers/iio/chemical/scd30_serial.c
@@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = scd30_serdev_of_match,
-		.pm = &scd30_pm_ops,
+		.pm = pm_sleep_ptr(&scd30_pm_ops),
 	},
 	.probe = scd30_serdev_probe,
 };
-- 
2.32.0


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

* [PATCH v2 2/3] PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and runtime pm equiv
  2022-04-01 14:06 [PATCH v2 0/3] IIO: Where dev_pm_ops rework and namespaces meet Jonathan Cameron
  2022-04-01 14:06 ` [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume() Jonathan Cameron
@ 2022-04-01 14:06 ` Jonathan Cameron
  2022-04-01 14:06 ` [PATCH v2 3/3] iio: chemical: scd30: Move symbol exports into IIO_SCD30 namespace Jonathan Cameron
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-04-01 14:06 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-iio; +Cc: Paul Cercueil, Linux PM

As more drivers start to use namespaces, we need to have varients of these
useful macros that allow the export to be in a particular namespace.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/linux/pm.h         | 14 +++++++++-----
 include/linux/pm_runtime.h | 10 ++++++++--
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index f7d2be686359..112b8125d4be 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -368,13 +368,13 @@ const struct dev_pm_ops name = { \
 
 #ifdef CONFIG_PM
 #define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
-			   runtime_resume_fn, idle_fn, sec) \
+			   runtime_resume_fn, idle_fn, sec, ns)		\
 	_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
 			   runtime_resume_fn, idle_fn); \
-	_EXPORT_SYMBOL(name, sec)
+	__EXPORT_SYMBOL(name, sec, ns)
 #else
 #define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
-			   runtime_resume_fn, idle_fn, sec) \
+			   runtime_resume_fn, idle_fn, sec, ns) \
 static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
 					 resume_fn, runtime_suspend_fn, \
 					 runtime_resume_fn, idle_fn)
@@ -391,9 +391,13 @@ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
 	_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
 
 #define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
-	_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "")
+	_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", "")
 #define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
-	_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl")
+	_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", "")
+#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns)	\
+	_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", #ns)
+#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns)	\
+	_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", #ns)
 
 /* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
 #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 9f09601c465a..6a8b9551ecad 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -41,10 +41,16 @@
 
 #define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
 	_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
-			   suspend_fn, resume_fn, idle_fn, "")
+			   suspend_fn, resume_fn, idle_fn, "", "")
 #define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
 	_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
-			   suspend_fn, resume_fn, idle_fn, "_gpl")
+			   suspend_fn, resume_fn, idle_fn, "_gpl", "")
+#define EXPORT_NS_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
+	_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
+			   suspend_fn, resume_fn, idle_fn, "", #ns)
+#define EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
+	_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
+			   suspend_fn, resume_fn, idle_fn, "_gpl", #ns)
 
 #ifdef CONFIG_PM
 extern struct workqueue_struct *pm_wq;
-- 
2.32.0


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

* [PATCH v2 3/3] iio: chemical: scd30: Move symbol exports into IIO_SCD30 namespace
  2022-04-01 14:06 [PATCH v2 0/3] IIO: Where dev_pm_ops rework and namespaces meet Jonathan Cameron
  2022-04-01 14:06 ` [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume() Jonathan Cameron
  2022-04-01 14:06 ` [PATCH v2 2/3] PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and runtime pm equiv Jonathan Cameron
@ 2022-04-01 14:06 ` Jonathan Cameron
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-04-01 14:06 UTC (permalink / raw)
  To: Rafael J . Wysocki, linux-iio; +Cc: Paul Cercueil, Linux PM

Avoid unnecessary pollution of the global symbol namespace by
moving library functions in to a specific namespace and import
that into the drivers that make use of the functions.

For more info: https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
---
 drivers/iio/chemical/scd30_core.c   | 4 ++--
 drivers/iio/chemical/scd30_i2c.c    | 1 +
 drivers/iio/chemical/scd30_serial.c | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
index 6c6c11c2772a..682fca39d14d 100644
--- a/drivers/iio/chemical/scd30_core.c
+++ b/drivers/iio/chemical/scd30_core.c
@@ -543,7 +543,7 @@ static int scd30_resume(struct device *dev)
 	return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
 }
 
-EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
+EXPORT_NS_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume, IIO_SCD30);
 
 static void scd30_stop_meas(void *data)
 {
@@ -759,7 +759,7 @@ int scd30_probe(struct device *dev, int irq, const char *name, void *priv,
 
 	return devm_iio_device_register(dev, indio_dev);
 }
-EXPORT_SYMBOL(scd30_probe);
+EXPORT_SYMBOL_NS(scd30_probe, IIO_SCD30);
 
 MODULE_AUTHOR("Tomasz Duszynski <tomasz.duszynski@octakon.com>");
 MODULE_DESCRIPTION("Sensirion SCD30 carbon dioxide sensor core driver");
diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c
index 7c332e4e8e46..bae479a4721f 100644
--- a/drivers/iio/chemical/scd30_i2c.c
+++ b/drivers/iio/chemical/scd30_i2c.c
@@ -137,3 +137,4 @@ module_i2c_driver(scd30_i2c_driver);
 MODULE_AUTHOR("Tomasz Duszynski <tomasz.duszynski@octakon.com>");
 MODULE_DESCRIPTION("Sensirion SCD30 carbon dioxide sensor i2c driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(IIO_SCD30);
diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c
index 8664f3ce6b33..3c519103d30b 100644
--- a/drivers/iio/chemical/scd30_serial.c
+++ b/drivers/iio/chemical/scd30_serial.c
@@ -261,3 +261,4 @@ module_serdev_device_driver(scd30_serdev_driver);
 MODULE_AUTHOR("Tomasz Duszynski <tomasz.duszynski@octakon.com>");
 MODULE_DESCRIPTION("Sensirion SCD30 carbon dioxide sensor serial driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(IIO_SCD30);
-- 
2.32.0


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

* Re: [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume()
  2022-04-01 14:06 ` [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume() Jonathan Cameron
@ 2022-04-05 18:19   ` Rafael J. Wysocki
  2022-04-06 13:09     ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-04-05 18:19 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Rafael J . Wysocki, linux-iio, Paul Cercueil, Linux PM

On Fri, Apr 1, 2022 at 4:06 PM Jonathan Cameron
<Jonathan.Cameron@huawei.com> wrote:
>
> Whilst here move to the new infrastructure using pm_sleep_ptr()
> and EXPORT_DEV_PM_OPS() so as to let the compiler remove the unused
> code if CONFIG_SLEEP is not defined.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
> ---
>  drivers/iio/chemical/scd30.h        | 5 +----
>  drivers/iio/chemical/scd30_core.c   | 8 ++++----
>  drivers/iio/chemical/scd30_i2c.c    | 2 +-
>  drivers/iio/chemical/scd30_serial.c | 2 +-
>  4 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/chemical/scd30.h b/drivers/iio/chemical/scd30.h
> index f60127bfe0f4..1ac9f3f79271 100644
> --- a/drivers/iio/chemical/scd30.h
> +++ b/drivers/iio/chemical/scd30.h
> @@ -68,10 +68,7 @@ struct scd30_state {
>         scd30_command_t command;
>  };
>
> -int scd30_suspend(struct device *dev);
> -int scd30_resume(struct device *dev);
> -
> -static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
> +extern const struct dev_pm_ops scd30_pm_ops;
>
>  int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command);
>
> diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
> index 9fe6bbe9ee04..6c6c11c2772a 100644
> --- a/drivers/iio/chemical/scd30_core.c
> +++ b/drivers/iio/chemical/scd30_core.c
> @@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
>         IIO_CHAN_SOFT_TIMESTAMP(3),
>  };
>
> -int __maybe_unused scd30_suspend(struct device *dev)
> +static int scd30_suspend(struct device *dev)
>  {
>         struct iio_dev *indio_dev = dev_get_drvdata(dev);
>         struct scd30_state *state  = iio_priv(indio_dev);
> @@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)
>
>         return regulator_disable(state->vdd);
>  }
> -EXPORT_SYMBOL(scd30_suspend);
>
> -int __maybe_unused scd30_resume(struct device *dev)
> +static int scd30_resume(struct device *dev)
>  {
>         struct iio_dev *indio_dev = dev_get_drvdata(dev);
>         struct scd30_state *state = iio_priv(indio_dev);
> @@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)
>
>         return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
>  }
> -EXPORT_SYMBOL(scd30_resume);
> +
> +EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
>
>  static void scd30_stop_meas(void *data)
>  {
> diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c
> index 875892a070ee..7c332e4e8e46 100644
> --- a/drivers/iio/chemical/scd30_i2c.c
> +++ b/drivers/iio/chemical/scd30_i2c.c
> @@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
>         .driver = {
>                 .name = KBUILD_MODNAME,
>                 .of_match_table = scd30_i2c_of_match,
> -               .pm = &scd30_pm_ops,
> +               .pm = pm_sleep_ptr(&scd30_pm_ops),
>         },
>         .probe_new = scd30_i2c_probe,
>  };
> diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c
> index 568b34486c44..8664f3ce6b33 100644
> --- a/drivers/iio/chemical/scd30_serial.c
> +++ b/drivers/iio/chemical/scd30_serial.c
> @@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
>         .driver = {
>                 .name = KBUILD_MODNAME,
>                 .of_match_table = scd30_serdev_of_match,
> -               .pm = &scd30_pm_ops,
> +               .pm = pm_sleep_ptr(&scd30_pm_ops),
>         },
>         .probe = scd30_serdev_probe,
>  };
> --

Applied as 5.19 material along with the [2-3/3].

Please let me know if you need a non-mutable branch to pull from in
order to base other work on these commits.

Thanks!

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

* Re: [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume()
  2022-04-05 18:19   ` Rafael J. Wysocki
@ 2022-04-06 13:09     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-04-06 13:09 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-iio, Paul Cercueil, Linux PM

On Tue, 5 Apr 2022 20:19:11 +0200
"Rafael J. Wysocki" <rafael@kernel.org> wrote:

> On Fri, Apr 1, 2022 at 4:06 PM Jonathan Cameron
> <Jonathan.Cameron@huawei.com> wrote:
> >
> > Whilst here move to the new infrastructure using pm_sleep_ptr()
> > and EXPORT_DEV_PM_OPS() so as to let the compiler remove the unused
> > code if CONFIG_SLEEP is not defined.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>
> > ---
> >  drivers/iio/chemical/scd30.h        | 5 +----
> >  drivers/iio/chemical/scd30_core.c   | 8 ++++----
> >  drivers/iio/chemical/scd30_i2c.c    | 2 +-
> >  drivers/iio/chemical/scd30_serial.c | 2 +-
> >  4 files changed, 7 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/iio/chemical/scd30.h b/drivers/iio/chemical/scd30.h
> > index f60127bfe0f4..1ac9f3f79271 100644
> > --- a/drivers/iio/chemical/scd30.h
> > +++ b/drivers/iio/chemical/scd30.h
> > @@ -68,10 +68,7 @@ struct scd30_state {
> >         scd30_command_t command;
> >  };
> >
> > -int scd30_suspend(struct device *dev);
> > -int scd30_resume(struct device *dev);
> > -
> > -static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
> > +extern const struct dev_pm_ops scd30_pm_ops;
> >
> >  int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command);
> >
> > diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
> > index 9fe6bbe9ee04..6c6c11c2772a 100644
> > --- a/drivers/iio/chemical/scd30_core.c
> > +++ b/drivers/iio/chemical/scd30_core.c
> > @@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = {
> >         IIO_CHAN_SOFT_TIMESTAMP(3),
> >  };
> >
> > -int __maybe_unused scd30_suspend(struct device *dev)
> > +static int scd30_suspend(struct device *dev)
> >  {
> >         struct iio_dev *indio_dev = dev_get_drvdata(dev);
> >         struct scd30_state *state  = iio_priv(indio_dev);
> > @@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev)
> >
> >         return regulator_disable(state->vdd);
> >  }
> > -EXPORT_SYMBOL(scd30_suspend);
> >
> > -int __maybe_unused scd30_resume(struct device *dev)
> > +static int scd30_resume(struct device *dev)
> >  {
> >         struct iio_dev *indio_dev = dev_get_drvdata(dev);
> >         struct scd30_state *state = iio_priv(indio_dev);
> > @@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev)
> >
> >         return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp);
> >  }
> > -EXPORT_SYMBOL(scd30_resume);
> > +
> > +EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume);
> >
> >  static void scd30_stop_meas(void *data)
> >  {
> > diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c
> > index 875892a070ee..7c332e4e8e46 100644
> > --- a/drivers/iio/chemical/scd30_i2c.c
> > +++ b/drivers/iio/chemical/scd30_i2c.c
> > @@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = {
> >         .driver = {
> >                 .name = KBUILD_MODNAME,
> >                 .of_match_table = scd30_i2c_of_match,
> > -               .pm = &scd30_pm_ops,
> > +               .pm = pm_sleep_ptr(&scd30_pm_ops),
> >         },
> >         .probe_new = scd30_i2c_probe,
> >  };
> > diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c
> > index 568b34486c44..8664f3ce6b33 100644
> > --- a/drivers/iio/chemical/scd30_serial.c
> > +++ b/drivers/iio/chemical/scd30_serial.c
> > @@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = {
> >         .driver = {
> >                 .name = KBUILD_MODNAME,
> >                 .of_match_table = scd30_serdev_of_match,
> > -               .pm = &scd30_pm_ops,
> > +               .pm = pm_sleep_ptr(&scd30_pm_ops),
> >         },
> >         .probe = scd30_serdev_probe,
> >  };
> > --  
> 
> Applied as 5.19 material along with the [2-3/3].
> 
> Please let me know if you need a non-mutable branch to pull from in
> order to base other work on these commits.

Yes please.  A non-mutable branch would be great.

Thanks,

Jonathan

> 
> Thanks!


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

end of thread, other threads:[~2022-04-06 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 14:06 [PATCH v2 0/3] IIO: Where dev_pm_ops rework and namespaces meet Jonathan Cameron
2022-04-01 14:06 ` [PATCH v2 1/3] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume() Jonathan Cameron
2022-04-05 18:19   ` Rafael J. Wysocki
2022-04-06 13:09     ` Jonathan Cameron
2022-04-01 14:06 ` [PATCH v2 2/3] PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and runtime pm equiv Jonathan Cameron
2022-04-01 14:06 ` [PATCH v2 3/3] iio: chemical: scd30: Move symbol exports into IIO_SCD30 namespace Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.