linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions
@ 2022-08-08 17:40 Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros Paul Cercueil
                   ` (30 more replies)
  0 siblings, 31 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Paul Cercueil, Jonathan Cameron,
	Rafael J . Wysocki, linux-pm

Hi Lee,

Here's my revised patchset updated from the feedback I got in V1.
This one is based on the current mfd-next-5.20.

I updated the PM macros in <linux/pm.h> and <linux/pm_runtime.h>, to
make them more versatile. They now allow to conditionally export
arbitrary dev_pm_ops structures. This is used in the "arizona" driver
for instance, which has "noirq" callbacks.

I Cc'd Jonathan, whom might be interested by the PM patch to convert the
IIO drivers to the new PM macros. Lee, if this patchset gets merged to
the MFD tree, could you then create an immutable branch for Jonathan?

Changes:
- [01/30] is new and adds the reworked PM macros.
- [12/30] now only modifies intel_soc_pmic_core.c since Andy updated
          the other file.
- [21/30] uses the new EXPORT_GPL_DEV_PM_OPS() macro instead of the
          trickery that was used before.
- [26/30] removes a CONFIG_PM wrapper around fields in private struct
- [27/30] removes a duplicated "const".
- [30/30] is new, and updates the intel-lpss driver.
- All patches: Reworded the last paragraph, hide the Cc's, remove
               the Cc to Bartlomiej's email address.

Cheers,
-Paul

Paul Cercueil (30):
  pm: Improve EXPORT_*_DEV_PM_OPS macros
  mfd: 88pm80x: Remove #ifdef guards for PM related functions
  mfd: aat2870: Remove #ifdef guards for PM related functions
  mfd: adp5520: Remove #ifdef guards for PM related functions
  mfd: max8925-i2c: Remove #ifdef guards for PM related functions
  mfd: mt6397-irq: Remove #ifdef guards for PM related functions
  mfd: pcf50633: Remove #ifdef guards for PM related functions
  mfd: rc5t583-irq: Remove #ifdef guards for PM related functions
  mfd: stpmic1: Remove #ifdef guards for PM related functions
  mfd: ucb1x00: Remove #ifdef guards for PM related functions
  mfd: 88pm860x: Remove #ifdef guards for PM related functions
  mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions
  mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions
  mfd: sec: Remove #ifdef guards for PM related functions
  mfd: sm501: Remove #ifdef guards for PM related functions
  mfd: tc6387xb: Remove #ifdef guards for PM related functions
  mfd: tps6586x: Remove #ifdef guards for PM related functions
  mfd: wm8994: Remove #ifdef guards for PM related functions
  mfd: max77620: Remove #ifdef guards for PM related functions
  mfd: t7l66xb: Remove #ifdef guards for PM related functions
  mfd: arizona: Remove #ifdef guards for PM related functions
  mfd: max14577: Remove #ifdef guards for PM related functions
  mfd: max77686: Remove #ifdef guards for PM related functions
  mfd: motorola-cpcap: Remove #ifdef guards for PM related functions
  mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions
  mfd: stmfx: Remove #ifdef guards for PM related functions
  mfd: stmpe: Remove #ifdef guards for PM related functions
  mfd: tc3589x: Remove #ifdef guards for PM related functions
  mfd: tc6393xb: Remove #ifdef guards for PM related functions
  mfd: intel-lpss: Remove #ifdef guards for PM related functions

 drivers/mfd/88pm800.c             |  2 +-
 drivers/mfd/88pm805.c             |  2 +-
 drivers/mfd/88pm80x.c             |  5 +----
 drivers/mfd/88pm860x-core.c       |  6 ++---
 drivers/mfd/aat2870-core.c        |  8 +++----
 drivers/mfd/adp5520.c             |  6 ++---
 drivers/mfd/arizona-core.c        | 19 ++++++----------
 drivers/mfd/arizona-i2c.c         |  2 +-
 drivers/mfd/arizona-spi.c         |  2 +-
 drivers/mfd/intel-lpss-acpi.c     |  4 +---
 drivers/mfd/intel-lpss-pci.c      |  4 +---
 drivers/mfd/intel-lpss.c          | 15 ++++++++-----
 drivers/mfd/intel-lpss.h          | 28 +----------------------
 drivers/mfd/intel_soc_pmic_core.c |  8 +++----
 drivers/mfd/max14577.c            |  6 ++---
 drivers/mfd/max77620.c            |  9 +++-----
 drivers/mfd/max77686.c            |  6 ++---
 drivers/mfd/max8925-i2c.c         |  7 +++---
 drivers/mfd/mcp-sa11x0.c          |  6 +----
 drivers/mfd/motorola-cpcap.c      |  6 ++---
 drivers/mfd/mt6397-irq.c          |  6 +----
 drivers/mfd/pcf50633-core.c       | 22 +-----------------
 drivers/mfd/pcf50633-irq.c        | 13 ++++++-----
 drivers/mfd/rc5t583-irq.c         |  7 ++----
 drivers/mfd/sec-core.c            |  7 +++---
 drivers/mfd/sm501.c               | 10 ++-------
 drivers/mfd/sprd-sc27xx-spi.c     |  7 +++---
 drivers/mfd/stmfx.c               |  6 ++---
 drivers/mfd/stmpe-i2c.c           |  4 +---
 drivers/mfd/stmpe-spi.c           |  4 +---
 drivers/mfd/stmpe.c               |  8 ++-----
 drivers/mfd/stpmic1.c             |  6 ++---
 drivers/mfd/t7l66xb.c             |  9 ++------
 drivers/mfd/tc3589x.c             |  7 +++---
 drivers/mfd/tc6387xb.c            |  9 ++------
 drivers/mfd/tc6393xb.c            |  9 ++------
 drivers/mfd/tps6586x.c            |  6 +----
 drivers/mfd/ucb1x00-core.c        |  7 +++---
 drivers/mfd/wm8994-core.c         |  6 ++---
 include/linux/mfd/pcf50633/core.h |  6 ++---
 include/linux/mfd/stmfx.h         |  2 --
 include/linux/pm.h                | 37 +++++++++++++++++++------------
 include/linux/pm_runtime.h        | 20 ++++++++++-------
 43 files changed, 127 insertions(+), 242 deletions(-)

---
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: linux-pm <linux-pm@vger.kernel.org>
-- 
2.35.1


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

* [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-13 14:49   ` Jonathan Cameron
  2022-08-23 17:47   ` Rafael J. Wysocki
  2022-08-08 17:40 ` [PATCH v2 02/30] mfd: 88pm80x: Remove #ifdef guards for PM related functions Paul Cercueil
                   ` (29 subsequent siblings)
  30 siblings, 2 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Paul Cercueil, Jonathan Cameron,
	Rafael J . Wysocki, linux-pm

Update the _EXPORT_DEV_PM_OPS() internal macro. It was not used anywhere
outside pm.h and pm_runtime.h, so it is safe to update it.

Before, this macro would take a few parameters to be used as sleep and
runtime callbacks. This made it unsuitable to use with different
callbacks, for instance the "noirq" ones.

It is now semantically different: instead of creating a conditionally
exported dev_pm_ops structure, it only contains part of the definition.

This macro should however never be used directly (hence the trailing
underscore). Instead, the following four macros are provided:
- EXPORT_DEV_PM_OPS(name)
- EXPORT_GPL_DEV_PM_OPS(name)
- EXPORT_NS_DEV_PM_OPS(name, ns)
- EXPORT_NS_GPL_DEV_PM_OPS(name, ns)

For instance, it is now possible to conditionally export noirq
suspend/resume PM functions like this:

EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
    NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
};

The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these new macros.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: linux-pm <linux-pm@vger.kernel.org>

 include/linux/pm.h         | 37 +++++++++++++++++++++++--------------
 include/linux/pm_runtime.h | 20 ++++++++++++--------
 2 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index 871c9c49ec9d..93cd34f00822 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -375,19 +375,20 @@ 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, ns)		\
-	_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
-			   runtime_resume_fn, idle_fn); \
-	__EXPORT_SYMBOL(name, sec, ns)
+#define _EXPORT_DEV_PM_OPS(name, sec, ns)				\
+	const struct dev_pm_ops name;					\
+	__EXPORT_SYMBOL(name, sec, ns);					\
+	const struct dev_pm_ops name
 #else
-#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
-			   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)
+#define _EXPORT_DEV_PM_OPS(name, sec, ns)				\
+	static __maybe_unused const struct dev_pm_ops __static_##name
 #endif
 
+#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
+#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "_gpl", "")
+#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
+#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "_gpl", #ns)
+
 /*
  * Use this if you want to use the same suspend and resume callbacks for suspend
  * to RAM and hibernation.
@@ -399,13 +400,21 @@ 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) = { \
+		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+	}
 #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_GPL_DEV_PM_OPS(name) = { \
+		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+	}
 #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)
+	EXPORT_NS_DEV_PM_OPS(name, ns) = { \
+		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+	}
 #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)
+	EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
+		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
+	}
 
 /* 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 9e4d056967c6..ba2077d9e366 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -40,17 +40,21 @@
 			   resume_fn, idle_fn)
 
 #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, "", "")
+	EXPORT_DEV_PM_OPS(name) = { \
+		RUNTIME_PM_OPS(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", "")
+	EXPORT_GPL_DEV_PM_OPS(name) = { \
+		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
+	}
 #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)
+	EXPORT_NS_DEV_PM_OPS(name, ns) = { \
+		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
+	}
 #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)
+	EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
+		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
+	}
 
 #ifdef CONFIG_PM
 extern struct workqueue_struct *pm_wq;
-- 
2.35.1


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

* [PATCH v2 02/30] mfd: 88pm80x: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 03/30] mfd: aat2870: " Paul Cercueil
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/88pm800.c | 2 +-
 drivers/mfd/88pm805.c | 2 +-
 drivers/mfd/88pm80x.c | 5 +----
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c
index eaf9845633b4..409f0996ae1d 100644
--- a/drivers/mfd/88pm800.c
+++ b/drivers/mfd/88pm800.c
@@ -599,7 +599,7 @@ static int pm800_remove(struct i2c_client *client)
 static struct i2c_driver pm800_driver = {
 	.driver = {
 		.name = "88PM800",
-		.pm = &pm80x_pm_ops,
+		.pm = pm_sleep_ptr(&pm80x_pm_ops),
 		},
 	.probe = pm800_probe,
 	.remove = pm800_remove,
diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c
index ada6c513302b..724ac4947e6f 100644
--- a/drivers/mfd/88pm805.c
+++ b/drivers/mfd/88pm805.c
@@ -254,7 +254,7 @@ static int pm805_remove(struct i2c_client *client)
 static struct i2c_driver pm805_driver = {
 	.driver = {
 		.name = "88PM805",
-		.pm = &pm80x_pm_ops,
+		.pm = pm_sleep_ptr(&pm80x_pm_ops),
 		},
 	.probe = pm805_probe,
 	.remove = pm805_remove,
diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c
index be036e7e787b..ac4f08565f29 100644
--- a/drivers/mfd/88pm80x.c
+++ b/drivers/mfd/88pm80x.c
@@ -129,7 +129,6 @@ int pm80x_deinit(void)
 }
 EXPORT_SYMBOL_GPL(pm80x_deinit);
 
-#ifdef CONFIG_PM_SLEEP
 static int pm80x_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -153,10 +152,8 @@ static int pm80x_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume);
-EXPORT_SYMBOL_GPL(pm80x_pm_ops);
+EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume);
 
 MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x");
 MODULE_AUTHOR("Qiao Zhou <zhouqiao@marvell.com>");
-- 
2.35.1


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

* [PATCH v2 03/30] mfd: aat2870: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 02/30] mfd: 88pm80x: Remove #ifdef guards for PM related functions Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 04/30] mfd: adp5520: " Paul Cercueil
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/aat2870-core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index a17cf759739d..8a3967c3f026 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -409,7 +409,6 @@ static int aat2870_i2c_probe(struct i2c_client *client,
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int aat2870_i2c_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -438,10 +437,9 @@ static int aat2870_i2c_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend,
-			 aat2870_i2c_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend,
+				aat2870_i2c_resume);
 
 static const struct i2c_device_id aat2870_i2c_id_table[] = {
 	{ "aat2870", 0 },
@@ -451,7 +449,7 @@ static const struct i2c_device_id aat2870_i2c_id_table[] = {
 static struct i2c_driver aat2870_i2c_driver = {
 	.driver = {
 		.name			= "aat2870",
-		.pm			= &aat2870_pm_ops,
+		.pm			= pm_sleep_ptr(&aat2870_pm_ops),
 		.suppress_bind_attrs	= true,
 	},
 	.probe		= aat2870_i2c_probe,
-- 
2.35.1


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

* [PATCH v2 04/30] mfd: adp5520: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (2 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 03/30] mfd: aat2870: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 05/30] mfd: max8925-i2c: " Paul Cercueil
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil, Michael Hennerich

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
---
 drivers/mfd/adp5520.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
index 8db15f5a7179..882eddc32f8e 100644
--- a/drivers/mfd/adp5520.c
+++ b/drivers/mfd/adp5520.c
@@ -305,7 +305,6 @@ static int adp5520_probe(struct i2c_client *client,
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int adp5520_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -326,9 +325,8 @@ static int adp5520_resume(struct device *dev)
 	adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode);
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume);
 
 static const struct i2c_device_id adp5520_id[] = {
 	{ "pmic-adp5520", ID_ADP5520 },
@@ -339,7 +337,7 @@ static const struct i2c_device_id adp5520_id[] = {
 static struct i2c_driver adp5520_driver = {
 	.driver = {
 		.name			= "adp5520",
-		.pm			= &adp5520_pm,
+		.pm			= pm_sleep_ptr(&adp5520_pm),
 		.suppress_bind_attrs	= true,
 	},
 	.probe		= adp5520_probe,
-- 
2.35.1


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

* [PATCH v2 05/30] mfd: max8925-i2c: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (3 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 04/30] mfd: adp5520: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 06/30] mfd: mt6397-irq: " Paul Cercueil
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/max8925-i2c.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index 114e905bef25..649310b5bb3e 100644
--- a/drivers/mfd/max8925-i2c.c
+++ b/drivers/mfd/max8925-i2c.c
@@ -208,7 +208,6 @@ static int max8925_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max8925_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -228,9 +227,9 @@ static int max8925_resume(struct device *dev)
 		disable_irq_wake(chip->core_irq);
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max8925_pm_ops,
+				max8925_suspend, max8925_resume);
 
 static const struct of_device_id max8925_dt_ids[] = {
 	{ .compatible = "maxim,max8925", },
@@ -240,7 +239,7 @@ static const struct of_device_id max8925_dt_ids[] = {
 static struct i2c_driver max8925_driver = {
 	.driver	= {
 		.name	= "max8925",
-		.pm     = &max8925_pm_ops,
+		.pm     = pm_sleep_ptr(&max8925_pm_ops),
 		.of_match_table = max8925_dt_ids,
 	},
 	.probe		= max8925_probe,
-- 
2.35.1


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

* [PATCH v2 06/30] mfd: mt6397-irq: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (4 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 05/30] mfd: max8925-i2c: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 07/30] mfd: pcf50633: " Paul Cercueil
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Paul Cercueil, Matthias Brugger, linux-arm-kernel,
	linux-mediatek

Use the new pm_sleep_ptr() macro to handle the .irq_set_wake() callback.

This macro allows the mt6397_irq_set_wake() function to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org

 drivers/mfd/mt6397-irq.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mfd/mt6397-irq.c b/drivers/mfd/mt6397-irq.c
index eff53fed8fe7..72f923e47752 100644
--- a/drivers/mfd/mt6397-irq.c
+++ b/drivers/mfd/mt6397-irq.c
@@ -54,7 +54,6 @@ static void mt6397_irq_enable(struct irq_data *data)
 	mt6397->irq_masks_cur[reg] |= BIT(shift);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on)
 {
 	struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(irq_data);
@@ -68,9 +67,6 @@ static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on)
 
 	return 0;
 }
-#else
-#define mt6397_irq_set_wake NULL
-#endif
 
 static struct irq_chip mt6397_irq_chip = {
 	.name = "mt6397-irq",
@@ -78,7 +74,7 @@ static struct irq_chip mt6397_irq_chip = {
 	.irq_bus_sync_unlock = mt6397_irq_sync_unlock,
 	.irq_enable = mt6397_irq_enable,
 	.irq_disable = mt6397_irq_disable,
-	.irq_set_wake = mt6397_irq_set_wake,
+	.irq_set_wake = pm_sleep_ptr(mt6397_irq_set_wake),
 };
 
 static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg,
-- 
2.35.1


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

* [PATCH v2 07/30] mfd: pcf50633: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (5 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 06/30] mfd: mt6397-irq: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 08/30] mfd: rc5t583-irq: " Paul Cercueil
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/pcf50633-core.c       | 22 +---------------------
 drivers/mfd/pcf50633-irq.c        | 13 ++++++++-----
 include/linux/mfd/pcf50633/core.h |  6 ++----
 3 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index e9c565cf0f54..06d750d9a476 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -158,26 +158,6 @@ pcf50633_client_dev_register(struct pcf50633 *pcf, const char *name,
 	}
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int pcf50633_suspend(struct device *dev)
-{
-	struct i2c_client *client = to_i2c_client(dev);
-	struct pcf50633 *pcf = i2c_get_clientdata(client);
-
-	return pcf50633_irq_suspend(pcf);
-}
-
-static int pcf50633_resume(struct device *dev)
-{
-	struct i2c_client *client = to_i2c_client(dev);
-	struct pcf50633 *pcf = i2c_get_clientdata(client);
-
-	return pcf50633_irq_resume(pcf);
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
-
 static const struct regmap_config pcf50633_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
@@ -302,7 +282,7 @@ MODULE_DEVICE_TABLE(i2c, pcf50633_id_table);
 static struct i2c_driver pcf50633_driver = {
 	.driver = {
 		.name	= "pcf50633",
-		.pm	= &pcf50633_pm,
+		.pm	= pm_sleep_ptr(&pcf50633_pm),
 	},
 	.id_table = pcf50633_id_table,
 	.probe = pcf50633_probe,
diff --git a/drivers/mfd/pcf50633-irq.c b/drivers/mfd/pcf50633-irq.c
index 2096afb0ce9b..e85af7f1cb0b 100644
--- a/drivers/mfd/pcf50633-irq.c
+++ b/drivers/mfd/pcf50633-irq.c
@@ -7,6 +7,7 @@
  * All rights reserved.
  */
 
+#include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/mutex.h>
@@ -218,10 +219,10 @@ static irqreturn_t pcf50633_irq(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-#ifdef CONFIG_PM
-
-int pcf50633_irq_suspend(struct pcf50633 *pcf)
+static int pcf50633_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
+	struct pcf50633 *pcf = i2c_get_clientdata(client);
 	int ret;
 	int i;
 	u8 res[5];
@@ -257,8 +258,10 @@ int pcf50633_irq_suspend(struct pcf50633 *pcf)
 	return ret;
 }
 
-int pcf50633_irq_resume(struct pcf50633 *pcf)
+static int pcf50633_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
+	struct pcf50633 *pcf = i2c_get_clientdata(client);
 	int ret;
 
 	/* Write the saved mask registers */
@@ -273,7 +276,7 @@ int pcf50633_irq_resume(struct pcf50633 *pcf)
 	return ret;
 }
 
-#endif
+EXPORT_GPL_SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
 
 int pcf50633_irq_init(struct pcf50633 *pcf, int irq)
 {
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 3f752dc62a6c..539f27f8bd89 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -13,6 +13,7 @@
 #include <linux/workqueue.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
+#include <linux/pm.h>
 #include <linux/power_supply.h>
 #include <linux/mfd/pcf50633/backlight.h>
 
@@ -226,9 +227,6 @@ static inline struct pcf50633 *dev_to_pcf50633(struct device *dev)
 
 int pcf50633_irq_init(struct pcf50633 *pcf, int irq);
 void pcf50633_irq_free(struct pcf50633 *pcf);
-#ifdef CONFIG_PM
-int pcf50633_irq_suspend(struct pcf50633 *pcf);
-int pcf50633_irq_resume(struct pcf50633 *pcf);
-#endif
+extern const struct dev_pm_ops pcf50633_pm;
 
 #endif
-- 
2.35.1


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

* [PATCH v2 08/30] mfd: rc5t583-irq: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (6 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 07/30] mfd: pcf50633: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 09/30] mfd: stpmic1: " Paul Cercueil
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new pm_sleep_ptr() macro to handle the .irq_set_wake() callback.

This macro allows the mt6397_irq_set_wake() function to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/rc5t583-irq.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/rc5t583-irq.c b/drivers/mfd/rc5t583-irq.c
index b374a3d34688..621ea61fa7c6 100644
--- a/drivers/mfd/rc5t583-irq.c
+++ b/drivers/mfd/rc5t583-irq.c
@@ -228,15 +228,12 @@ static void rc5t583_irq_sync_unlock(struct irq_data *irq_data)
 
 	mutex_unlock(&rc5t583->irq_lock);
 }
-#ifdef CONFIG_PM_SLEEP
+
 static int rc5t583_irq_set_wake(struct irq_data *irq_data, unsigned int on)
 {
 	struct rc5t583 *rc5t583 = irq_data_get_irq_chip_data(irq_data);
 	return irq_set_irq_wake(rc5t583->chip_irq, on);
 }
-#else
-#define rc5t583_irq_set_wake NULL
-#endif
 
 static irqreturn_t rc5t583_irq(int irq, void *data)
 {
@@ -317,7 +314,7 @@ static struct irq_chip rc5t583_irq_chip = {
 	.irq_bus_lock = rc5t583_irq_lock,
 	.irq_bus_sync_unlock = rc5t583_irq_sync_unlock,
 	.irq_set_type = rc5t583_irq_set_type,
-	.irq_set_wake = rc5t583_irq_set_wake,
+	.irq_set_wake = pm_sleep_ptr(rc5t583_irq_set_wake),
 };
 
 int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base)
-- 
2.35.1


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

* [PATCH v2 09/30] mfd: stpmic1: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (7 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 08/30] mfd: rc5t583-irq: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 10/30] mfd: ucb1x00: " Paul Cercueil
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/stpmic1.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c
index eb3da558c3fb..7d8b0c0548fe 100644
--- a/drivers/mfd/stpmic1.c
+++ b/drivers/mfd/stpmic1.c
@@ -162,7 +162,6 @@ static int stpmic1_probe(struct i2c_client *i2c,
 	return devm_of_platform_populate(dev);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stpmic1_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -187,9 +186,8 @@ static int stpmic1_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume);
 
 static const struct of_device_id stpmic1_of_match[] = {
 	{ .compatible = "st,stpmic1", },
@@ -201,7 +199,7 @@ static struct i2c_driver stpmic1_driver = {
 	.driver = {
 		.name = "stpmic1",
 		.of_match_table = of_match_ptr(stpmic1_of_match),
-		.pm = &stpmic1_pm,
+		.pm = pm_sleep_ptr(&stpmic1_pm),
 	},
 	.probe = stpmic1_probe,
 };
-- 
2.35.1


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

* [PATCH v2 10/30] mfd: ucb1x00: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (8 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 09/30] mfd: stpmic1: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 11/30] mfd: 88pm860x: " Paul Cercueil
                   ` (20 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/ucb1x00-core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index b690796d24d4..fc4d4c844a81 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -660,7 +660,6 @@ void ucb1x00_unregister_driver(struct ucb1x00_driver *drv)
 	mutex_unlock(&ucb1x00_mutex);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ucb1x00_suspend(struct device *dev)
 {
 	struct ucb1x00_plat_data *pdata = dev_get_platdata(dev);
@@ -728,15 +727,15 @@ static int ucb1x00_resume(struct device *dev)
 	mutex_unlock(&ucb1x00_mutex);
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, ucb1x00_suspend, ucb1x00_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops,
+				ucb1x00_suspend, ucb1x00_resume);
 
 static struct mcp_driver ucb1x00_driver = {
 	.drv		= {
 		.name	= "ucb1x00",
 		.owner	= THIS_MODULE,
-		.pm	= &ucb1x00_pm_ops,
+		.pm	= pm_sleep_ptr(&ucb1x00_pm_ops),
 	},
 	.probe		= ucb1x00_probe,
 	.remove		= ucb1x00_remove,
-- 
2.35.1


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

* [PATCH v2 11/30] mfd: 88pm860x: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (9 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 10/30] mfd: ucb1x00: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 12/30] mfd: intel_soc_pmic: " Paul Cercueil
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/88pm860x-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index b1e829ea909b..b698eb59041e 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -1213,7 +1213,6 @@ static int pm860x_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int pm860x_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -1233,9 +1232,8 @@ static int pm860x_resume(struct device *dev)
 		disable_irq_wake(chip->core_irq);
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume);
 
 static const struct i2c_device_id pm860x_id_table[] = {
 	{ "88PM860x", 0 },
@@ -1252,7 +1250,7 @@ MODULE_DEVICE_TABLE(of, pm860x_dt_ids);
 static struct i2c_driver pm860x_driver = {
 	.driver	= {
 		.name	= "88PM860x",
-		.pm     = &pm860x_pm_ops,
+		.pm     = pm_sleep_ptr(&pm860x_pm_ops),
 		.of_match_table	= pm860x_dt_ids,
 	},
 	.probe_new	= pm860x_probe,
-- 
2.35.1


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

* [PATCH v2 12/30] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (10 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 11/30] mfd: 88pm860x: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-23 14:17   ` Andy Shevchenko
  2022-08-08 17:40 ` [PATCH v2 13/30] mfd: mcp-sa11x0: " Paul Cercueil
                   ` (18 subsequent siblings)
  30 siblings, 1 reply; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil, Andy Shevchenko

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Cc: Andy Shevchenko <andy@kernel.org>

 drivers/mfd/intel_soc_pmic_core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index 5e8c94e008ed..96303aa87bc1 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -104,7 +104,6 @@ static void intel_soc_pmic_shutdown(struct i2c_client *i2c)
 	return;
 }
 
-#if defined(CONFIG_PM_SLEEP)
 static int intel_soc_pmic_suspend(struct device *dev)
 {
 	struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
@@ -122,10 +121,9 @@ static int intel_soc_pmic_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_suspend,
-			 intel_soc_pmic_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_suspend,
+				intel_soc_pmic_resume);
 
 static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
 	{ }
@@ -143,7 +141,7 @@ MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
 static struct i2c_driver intel_soc_pmic_i2c_driver = {
 	.driver = {
 		.name = "intel_soc_pmic_i2c",
-		.pm = &intel_soc_pmic_pm_ops,
+		.pm = pm_sleep_ptr(&intel_soc_pmic_pm_ops),
 		.acpi_match_table = ACPI_PTR(intel_soc_pmic_acpi_match),
 	},
 	.probe = intel_soc_pmic_i2c_probe,
-- 
2.35.1


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

* [PATCH v2 13/30] mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (11 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 12/30] mfd: intel_soc_pmic: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 14/30] mfd: sec: " Paul Cercueil
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new pm_sleep_ptr() macro to handle the .suspend/.resume
callbacks.

This macro allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/mcp-sa11x0.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c
index 4629dff187cd..1c9831b78cf9 100644
--- a/drivers/mfd/mcp-sa11x0.c
+++ b/drivers/mfd/mcp-sa11x0.c
@@ -255,7 +255,6 @@ static int mcp_sa11x0_remove(struct platform_device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int mcp_sa11x0_suspend(struct device *dev)
 {
 	struct mcp_sa11x0 *m = priv(dev_get_drvdata(dev));
@@ -277,17 +276,14 @@ static int mcp_sa11x0_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct dev_pm_ops mcp_sa11x0_pm_ops = {
-#ifdef CONFIG_PM_SLEEP
 	.suspend = mcp_sa11x0_suspend,
 	.freeze = mcp_sa11x0_suspend,
 	.poweroff = mcp_sa11x0_suspend,
 	.resume_noirq = mcp_sa11x0_resume,
 	.thaw_noirq = mcp_sa11x0_resume,
 	.restore_noirq = mcp_sa11x0_resume,
-#endif
 };
 
 static struct platform_driver mcp_sa11x0_driver = {
@@ -295,7 +291,7 @@ static struct platform_driver mcp_sa11x0_driver = {
 	.remove		= mcp_sa11x0_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
-		.pm	= &mcp_sa11x0_pm_ops,
+		.pm	= pm_sleep_ptr(&mcp_sa11x0_pm_ops),
 	},
 };
 
-- 
2.35.1


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

* [PATCH v2 14/30] mfd: sec: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (12 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 13/30] mfd: mcp-sa11x0: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 15/30] mfd: sm501: " Paul Cercueil
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Paul Cercueil, Krzysztof Kozlowski, linux-samsung-soc

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: linux-samsung-soc@vger.kernel.org

 drivers/mfd/sec-core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 1fb29c45f5cf..a467de2b2fea 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -455,7 +455,6 @@ static void sec_pmic_shutdown(struct i2c_client *i2c)
 	regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sec_pmic_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -488,14 +487,14 @@ static int sec_pmic_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops,
+				sec_pmic_suspend, sec_pmic_resume);
 
 static struct i2c_driver sec_pmic_driver = {
 	.driver = {
 		   .name = "sec_pmic",
-		   .pm = &sec_pmic_pm_ops,
+		   .pm = pm_sleep_ptr(&sec_pmic_pm_ops),
 		   .of_match_table = sec_dt_match,
 	},
 	.probe = sec_pmic_probe,
-- 
2.35.1


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

* [PATCH v2 15/30] mfd: sm501: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (13 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 14/30] mfd: sec: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 16/30] mfd: tc6387xb: " Paul Cercueil
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new pm_sleep_ptr() macro to handle the .suspend/.resume
callbacks.

This macro allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/sm501.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index bc0a2c38653e..81e15e646e77 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1432,8 +1432,6 @@ static int sm501_plat_probe(struct platform_device *dev)
 
 }
 
-#ifdef CONFIG_PM
-
 /* power management support */
 
 static void sm501_set_power(struct sm501_devdata *sm, int on)
@@ -1509,10 +1507,6 @@ static int sm501_plat_resume(struct platform_device *pdev)
 
 	return 0;
 }
-#else
-#define sm501_plat_suspend NULL
-#define sm501_plat_resume NULL
-#endif
 
 /* Initialisation data for PCI devices */
 
@@ -1714,8 +1708,8 @@ static struct platform_driver sm501_plat_driver = {
 	},
 	.probe		= sm501_plat_probe,
 	.remove		= sm501_plat_remove,
-	.suspend	= sm501_plat_suspend,
-	.resume		= sm501_plat_resume,
+	.suspend	= pm_sleep_ptr(sm501_plat_suspend),
+	.resume		= pm_sleep_ptr(sm501_plat_resume),
 };
 
 static int __init sm501_base_init(void)
-- 
2.35.1


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

* [PATCH v2 16/30] mfd: tc6387xb: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (14 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 15/30] mfd: sm501: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 17/30] mfd: tps6586x: " Paul Cercueil
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new pm_sleep_ptr() macro to handle the .suspend/.resume
callbacks.

This macro allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/tc6387xb.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index e846e4d26b6e..5392da6ba7b0 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -40,7 +40,6 @@ static const struct resource tc6387xb_mmc_resources[] = {
 
 /*--------------------------------------------------------------------------*/
 
-#ifdef CONFIG_PM
 static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
@@ -67,10 +66,6 @@ static int tc6387xb_resume(struct platform_device *dev)
 
 	return 0;
 }
-#else
-#define tc6387xb_suspend  NULL
-#define tc6387xb_resume   NULL
-#endif
 
 /*--------------------------------------------------------------------------*/
 
@@ -220,8 +215,8 @@ static struct platform_driver tc6387xb_platform_driver = {
 	},
 	.probe		= tc6387xb_probe,
 	.remove		= tc6387xb_remove,
-	.suspend        = tc6387xb_suspend,
-	.resume         = tc6387xb_resume,
+	.suspend        = pm_sleep_ptr(tc6387xb_suspend),
+	.resume         = pm_sleep_ptr(tc6387xb_resume),
 };
 
 module_platform_driver(tc6387xb_platform_driver);
-- 
2.35.1


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

* [PATCH v2 17/30] mfd: tps6586x: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (15 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 16/30] mfd: tc6387xb: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 18/30] mfd: wm8994: " Paul Cercueil
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new pm_sleep_ptr() macro to handle the .irq_set_wake() callback.

This macro allows the mt6397_irq_set_wake() function to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/tps6586x.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index c9303d3d6602..fd57c3974615 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -269,15 +269,11 @@ static void tps6586x_irq_sync_unlock(struct irq_data *data)
 	mutex_unlock(&tps6586x->irq_lock);
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tps6586x_irq_set_wake(struct irq_data *irq_data, unsigned int on)
 {
 	struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data);
 	return irq_set_irq_wake(tps6586x->irq, on);
 }
-#else
-#define tps6586x_irq_set_wake NULL
-#endif
 
 static struct irq_chip tps6586x_irq_chip = {
 	.name = "tps6586x",
@@ -285,7 +281,7 @@ static struct irq_chip tps6586x_irq_chip = {
 	.irq_bus_sync_unlock = tps6586x_irq_sync_unlock,
 	.irq_disable = tps6586x_irq_disable,
 	.irq_enable = tps6586x_irq_enable,
-	.irq_set_wake = tps6586x_irq_set_wake,
+	.irq_set_wake = pm_sleep_ptr(tps6586x_irq_set_wake),
 };
 
 static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq,
-- 
2.35.1


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

* [PATCH v2 18/30] mfd: wm8994: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (16 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 17/30] mfd: tps6586x: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-22  9:43   ` Charles Keepax
  2022-08-08 17:40 ` [PATCH v2 19/30] mfd: max77620: " Paul Cercueil
                   ` (12 subsequent siblings)
  30 siblings, 1 reply; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil, patches

Use the new RUNTIME_PM_OPS() and pm_ptr() macros to handle the
.runtime_suspend/.runtime_resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_PM is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Note that this driver should probably use the new
DEFINE_RUNTIME_DEV_PM_OPS() macro instead, which will provide
.suspend/.resume callbacks, pointing to pm_runtime_force_suspend() and
pm_runtime_force_resume() respectively; unless those callbacks really
aren't needed.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Cc: patches@opensource.cirrus.com

 drivers/mfd/wm8994-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 7b1d270722ba..a27a13b5ae1e 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -110,7 +110,6 @@ static const char *wm8958_main_supplies[] = {
 	"SPKVDD2",
 };
 
-#ifdef CONFIG_PM
 static int wm8994_suspend(struct device *dev)
 {
 	struct wm8994 *wm8994 = dev_get_drvdata(dev);
@@ -213,7 +212,6 @@ static int wm8994_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
 #ifdef CONFIG_REGULATOR
 static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo)
@@ -676,13 +674,13 @@ static const struct i2c_device_id wm8994_i2c_id[] = {
 MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id);
 
 static const struct dev_pm_ops wm8994_pm_ops = {
-	SET_RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL)
+	RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL)
 };
 
 static struct i2c_driver wm8994_i2c_driver = {
 	.driver = {
 		.name = "wm8994",
-		.pm = &wm8994_pm_ops,
+		.pm = pm_ptr(&wm8994_pm_ops),
 		.of_match_table = wm8994_of_match,
 	},
 	.probe = wm8994_i2c_probe,
-- 
2.35.1


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

* [PATCH v2 19/30] mfd: max77620: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (17 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 18/30] mfd: wm8994: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 20/30] mfd: t7l66xb: " Paul Cercueil
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/max77620.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
index a6661e07035b..42fa9c4b97aa 100644
--- a/drivers/mfd/max77620.c
+++ b/drivers/mfd/max77620.c
@@ -576,7 +576,6 @@ static int max77620_probe(struct i2c_client *client,
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max77620_set_fps_period(struct max77620_chip *chip,
 				   int fps_id, int time_period)
 {
@@ -683,7 +682,6 @@ static int max77620_i2c_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct i2c_device_id max77620_id[] = {
 	{"max77620", MAX77620},
@@ -692,14 +690,13 @@ static const struct i2c_device_id max77620_id[] = {
 	{},
 };
 
-static const struct dev_pm_ops max77620_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(max77620_pm_ops,
+				max77620_i2c_suspend, max77620_i2c_resume);
 
 static struct i2c_driver max77620_driver = {
 	.driver = {
 		.name = "max77620",
-		.pm = &max77620_pm_ops,
+		.pm = pm_sleep_ptr(&max77620_pm_ops),
 	},
 	.probe = max77620_probe,
 	.id_table = max77620_id,
-- 
2.35.1


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

* [PATCH v2 20/30] mfd: t7l66xb: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (18 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 19/30] mfd: max77620: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:40 ` [PATCH v2 21/30] mfd: arizona: " Paul Cercueil
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new pm_sleep_ptr() macro to handle the .suspend/.resume
callbacks.

This macro allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/t7l66xb.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c
index 663ffd4b8570..1d9d1d38d068 100644
--- a/drivers/mfd/t7l66xb.c
+++ b/drivers/mfd/t7l66xb.c
@@ -257,7 +257,6 @@ static void t7l66xb_detach_irq(struct platform_device *dev)
 
 /*--------------------------------------------------------------------------*/
 
-#ifdef CONFIG_PM
 static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
@@ -288,10 +287,6 @@ static int t7l66xb_resume(struct platform_device *dev)
 
 	return 0;
 }
-#else
-#define t7l66xb_suspend NULL
-#define t7l66xb_resume	NULL
-#endif
 
 /*--------------------------------------------------------------------------*/
 
@@ -416,8 +411,8 @@ static struct platform_driver t7l66xb_platform_driver = {
 	.driver = {
 		.name	= "t7l66xb",
 	},
-	.suspend	= t7l66xb_suspend,
-	.resume		= t7l66xb_resume,
+	.suspend	= pm_sleep_ptr(t7l66xb_suspend),
+	.resume		= pm_sleep_ptr(t7l66xb_resume),
 	.probe		= t7l66xb_probe,
 	.remove		= t7l66xb_remove,
 };
-- 
2.35.1


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

* [PATCH v2 21/30] mfd: arizona: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (19 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 20/30] mfd: t7l66xb: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-22  9:44   ` Charles Keepax
  2022-08-08 17:40 ` [PATCH v2 22/30] mfd: max14577: " Paul Cercueil
                   ` (9 subsequent siblings)
  30 siblings, 1 reply; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil, patches

Use the new EXPORT_GPL_DEV_PM_OPS() and pm_ptr() macros to handle the PM
callbacks.

These macros allow the PM functions to be automatically dropped by the
compiler when CONFIG_PM is disabled, without having to use #ifdef
guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---

V2: Use new EXPORT_GPL_DEV_PM_OPS() macro

Cc: patches@opensource.cirrus.com

 drivers/mfd/arizona-core.c | 19 +++++++------------
 drivers/mfd/arizona-i2c.c  |  2 +-
 drivers/mfd/arizona-spi.c  |  2 +-
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index cbf1dd90b70d..bd7ee3260d53 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -480,7 +480,6 @@ static int wm5102_clear_write_sequencer(struct arizona *arizona)
 	return 0;
 }
 
-#ifdef CONFIG_PM
 static int arizona_isolate_dcvdd(struct arizona *arizona)
 {
 	int ret;
@@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device *dev)
 
 	return 0;
 }
-#endif
 
-#ifdef CONFIG_PM_SLEEP
 static int arizona_suspend(struct device *dev)
 {
 	struct arizona *arizona = dev_get_drvdata(dev);
@@ -784,17 +781,15 @@ static int arizona_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-const struct dev_pm_ops arizona_pm_ops = {
-	SET_RUNTIME_PM_OPS(arizona_runtime_suspend,
-			   arizona_runtime_resume,
-			   NULL)
-	SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
-	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq,
-				      arizona_resume_noirq)
+EXPORT_GPL_DEV_PM_OPS(arizona_pm_ops) = {
+	RUNTIME_PM_OPS(arizona_runtime_suspend,
+		       arizona_runtime_resume,
+		       NULL)
+	SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
+	NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq,
+				  arizona_resume_noirq)
 };
-EXPORT_SYMBOL_GPL(arizona_pm_ops);
 
 #ifdef CONFIG_OF
 static int arizona_of_get_core_pdata(struct arizona *arizona)
diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c
index 6d83e6b9a692..8799d9183bee 100644
--- a/drivers/mfd/arizona-i2c.c
+++ b/drivers/mfd/arizona-i2c.c
@@ -119,7 +119,7 @@ static const struct of_device_id arizona_i2c_of_match[] = {
 static struct i2c_driver arizona_i2c_driver = {
 	.driver = {
 		.name	= "arizona",
-		.pm	= &arizona_pm_ops,
+		.pm	= pm_ptr(&arizona_pm_ops),
 		.of_match_table	= of_match_ptr(arizona_i2c_of_match),
 	},
 	.probe		= arizona_i2c_probe,
diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c
index 941b0267d09d..da05b966d48c 100644
--- a/drivers/mfd/arizona-spi.c
+++ b/drivers/mfd/arizona-spi.c
@@ -282,7 +282,7 @@ static const struct of_device_id arizona_spi_of_match[] = {
 static struct spi_driver arizona_spi_driver = {
 	.driver = {
 		.name	= "arizona",
-		.pm	= &arizona_pm_ops,
+		.pm	= pm_ptr(&arizona_pm_ops),
 		.of_match_table	= of_match_ptr(arizona_spi_of_match),
 		.acpi_match_table = ACPI_PTR(arizona_acpi_match),
 	},
-- 
2.35.1


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

* [PATCH v2 22/30] mfd: max14577: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (20 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 21/30] mfd: arizona: " Paul Cercueil
@ 2022-08-08 17:40 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 23/30] mfd: max77686: " Paul Cercueil
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:40 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil, Krzysztof Kozlowski, Chanwoo Choi

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

 drivers/mfd/max14577.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 6c487fa14e9c..9de29a8070c7 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -482,7 +482,6 @@ static const struct i2c_device_id max14577_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
 
-#ifdef CONFIG_PM_SLEEP
 static int max14577_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -515,14 +514,13 @@ static int max14577_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume);
 
 static struct i2c_driver max14577_i2c_driver = {
 	.driver = {
 		.name = "max14577",
-		.pm = &max14577_pm,
+		.pm = pm_sleep_ptr(&max14577_pm),
 		.of_match_table = max14577_dt_match,
 	},
 	.probe = max14577_i2c_probe,
-- 
2.35.1


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

* [PATCH v2 23/30] mfd: max77686: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (21 preceding siblings ...)
  2022-08-08 17:40 ` [PATCH v2 22/30] mfd: max14577: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 24/30] mfd: motorola-cpcap: " Paul Cercueil
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil, Krzysztof Kozlowski, Chanwoo Choi

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

 drivers/mfd/max77686.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 2ac64277fb84..f8e863f3fc95 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -226,7 +226,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int max77686_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = to_i2c_client(dev);
@@ -261,14 +260,13 @@ static int max77686_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume);
 
 static struct i2c_driver max77686_i2c_driver = {
 	.driver = {
 		   .name = "max77686",
-		   .pm = &max77686_pm,
+		   .pm = pm_sleep_ptr(&max77686_pm),
 		   .of_match_table = max77686_pmic_dt_match,
 	},
 	.probe_new = max77686_i2c_probe,
-- 
2.35.1


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

* [PATCH v2 24/30] mfd: motorola-cpcap: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (22 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 23/30] mfd: max77686: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 25/30] mfd: sprd-sc27xx: " Paul Cercueil
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/motorola-cpcap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c
index 265464b5d7cc..ae8930eff72d 100644
--- a/drivers/mfd/motorola-cpcap.c
+++ b/drivers/mfd/motorola-cpcap.c
@@ -221,7 +221,6 @@ static const struct regmap_config cpcap_regmap_config = {
 	.val_format_endian = REGMAP_ENDIAN_LITTLE,
 };
 
-#ifdef CONFIG_PM_SLEEP
 static int cpcap_suspend(struct device *dev)
 {
 	struct spi_device *spi = to_spi_device(dev);
@@ -239,9 +238,8 @@ static int cpcap_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume);
 
 static const struct mfd_cell cpcap_mfd_devices[] = {
 	{
@@ -346,7 +344,7 @@ static struct spi_driver cpcap_driver = {
 	.driver = {
 		.name = "cpcap-core",
 		.of_match_table = cpcap_of_match,
-		.pm = &cpcap_pm,
+		.pm = pm_sleep_ptr(&cpcap_pm),
 	},
 	.probe = cpcap_probe,
 	.id_table = cpcap_spi_ids,
-- 
2.35.1


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

* [PATCH v2 25/30] mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (23 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 24/30] mfd: motorola-cpcap: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 26/30] mfd: stmfx: " Paul Cercueil
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Paul Cercueil, Orson Zhai, Baolin Wang, Chunyan Zhang

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>

 drivers/mfd/sprd-sc27xx-spi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
index d05a47c5187f..ea68d73e5d1c 100644
--- a/drivers/mfd/sprd-sc27xx-spi.c
+++ b/drivers/mfd/sprd-sc27xx-spi.c
@@ -215,7 +215,6 @@ static int sprd_pmic_probe(struct spi_device *spi)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int sprd_pmic_suspend(struct device *dev)
 {
 	struct sprd_pmic *ddata = dev_get_drvdata(dev);
@@ -235,9 +234,9 @@ static int sprd_pmic_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops,
+				sprd_pmic_suspend, sprd_pmic_resume);
 
 static const struct of_device_id sprd_pmic_match[] = {
 	{ .compatible = "sprd,sc2730", .data = &sc2730_data },
@@ -257,7 +256,7 @@ static struct spi_driver sprd_pmic_driver = {
 	.driver = {
 		.name = "sc27xx-pmic",
 		.of_match_table = sprd_pmic_match,
-		.pm = &sprd_pmic_pm_ops,
+		.pm = pm_sleep_ptr(&sprd_pmic_pm_ops),
 	},
 	.probe = sprd_pmic_probe,
 	.id_table = sprd_pmic_spi_ids,
-- 
2.35.1


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

* [PATCH v2 26/30] mfd: stmfx: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (24 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 25/30] mfd: sprd-sc27xx: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 27/30] mfd: stmpe: " Paul Cercueil
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Paul Cercueil, Maxime Coquelin, Alexandre Torgue,
	linux-stm32, linux-arm-kernel

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---

V2: remove CONFIG_PM wrapper around fields in private struct

Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org

 drivers/mfd/stmfx.c       | 6 ++----
 include/linux/mfd/stmfx.h | 2 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c
index 122f96094410..94af27346669 100644
--- a/drivers/mfd/stmfx.c
+++ b/drivers/mfd/stmfx.c
@@ -476,7 +476,6 @@ static int stmfx_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stmfx_suspend(struct device *dev)
 {
 	struct stmfx *stmfx = dev_get_drvdata(dev);
@@ -542,9 +541,8 @@ static int stmfx_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume);
 
 static const struct of_device_id stmfx_of_match[] = {
 	{ .compatible = "st,stmfx-0300", },
@@ -556,7 +554,7 @@ static struct i2c_driver stmfx_driver = {
 	.driver = {
 		.name = "stmfx-core",
 		.of_match_table = stmfx_of_match,
-		.pm = &stmfx_dev_pm_ops,
+		.pm = pm_sleep_ptr(&stmfx_dev_pm_ops),
 	},
 	.probe = stmfx_probe,
 	.remove = stmfx_remove,
diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h
index 744dce63946e..967a2e486800 100644
--- a/include/linux/mfd/stmfx.h
+++ b/include/linux/mfd/stmfx.h
@@ -113,10 +113,8 @@ struct stmfx {
 	struct irq_domain *irq_domain;
 	struct mutex lock; /* IRQ bus lock */
 	u8 irq_src;
-#ifdef CONFIG_PM
 	u8 bkp_sysctrl;
 	u8 bkp_irqoutpin;
-#endif
 };
 
 int stmfx_function_enable(struct stmfx *stmfx, u32 func);
-- 
2.35.1


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

* [PATCH v2 27/30] mfd: stmpe: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (25 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 26/30] mfd: stmfx: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 28/30] mfd: tc3589x: " Paul Cercueil
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Paul Cercueil, Maxime Coquelin, Alexandre Torgue,
	linux-stm32, linux-arm-kernel

Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---

V2: remove duplicated "const".

Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org

 drivers/mfd/stmpe-i2c.c | 4 +---
 drivers/mfd/stmpe-spi.c | 4 +---
 drivers/mfd/stmpe.c     | 8 ++------
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index d3eedf3d607e..bf094cc9f9de 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -116,9 +116,7 @@ MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id);
 static struct i2c_driver stmpe_i2c_driver = {
 	.driver = {
 		.name = "stmpe-i2c",
-#ifdef CONFIG_PM
-		.pm = &stmpe_dev_pm_ops,
-#endif
+		.pm = pm_sleep_ptr(&stmpe_dev_pm_ops),
 		.of_match_table = stmpe_of_match,
 	},
 	.probe		= stmpe_i2c_probe,
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c
index ad8055a0e286..e9cbf33502b3 100644
--- a/drivers/mfd/stmpe-spi.c
+++ b/drivers/mfd/stmpe-spi.c
@@ -135,9 +135,7 @@ static struct spi_driver stmpe_spi_driver = {
 	.driver = {
 		.name	= "stmpe-spi",
 		.of_match_table = of_match_ptr(stmpe_spi_of_match),
-#ifdef CONFIG_PM
-		.pm	= &stmpe_dev_pm_ops,
-#endif
+		.pm	= pm_sleep_ptr(&stmpe_dev_pm_ops),
 	},
 	.probe		= stmpe_spi_probe,
 	.remove		= stmpe_spi_remove,
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index aeb9ea55f97d..89ffd5a7fab8 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -1508,7 +1508,6 @@ void stmpe_remove(struct stmpe *stmpe)
 	mfd_remove_devices(stmpe->dev);
 }
 
-#ifdef CONFIG_PM
 static int stmpe_suspend(struct device *dev)
 {
 	struct stmpe *stmpe = dev_get_drvdata(dev);
@@ -1529,8 +1528,5 @@ static int stmpe_resume(struct device *dev)
 	return 0;
 }
 
-const struct dev_pm_ops stmpe_dev_pm_ops = {
-	.suspend	= stmpe_suspend,
-	.resume		= stmpe_resume,
-};
-#endif
+EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops,
+			     stmpe_suspend, stmpe_resume);
-- 
2.35.1


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

* [PATCH v2 28/30] mfd: tc3589x: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (26 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 27/30] mfd: stmpe: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 29/30] mfd: tc6393xb: " Paul Cercueil
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/tc3589x.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index 13583cdb93b6..ab7e0f6f5489 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -438,7 +438,6 @@ static int tc3589x_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int tc3589x_suspend(struct device *dev)
 {
 	struct tc3589x *tc3589x = dev_get_drvdata(dev);
@@ -466,9 +465,9 @@ static int tc3589x_resume(struct device *dev)
 
 	return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops,
+				tc3589x_suspend, tc3589x_resume);
 
 static const struct i2c_device_id tc3589x_id[] = {
 	{ "tc35890", TC3589X_TC35890 },
@@ -485,7 +484,7 @@ MODULE_DEVICE_TABLE(i2c, tc3589x_id);
 static struct i2c_driver tc3589x_driver = {
 	.driver = {
 		.name	= "tc3589x",
-		.pm	= &tc3589x_dev_pm_ops,
+		.pm	= pm_sleep_ptr(&tc3589x_dev_pm_ops),
 		.of_match_table = of_match_ptr(tc3589x_match),
 	},
 	.probe		= tc3589x_probe,
-- 
2.35.1


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

* [PATCH v2 29/30] mfd: tc6393xb: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (27 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 28/30] mfd: tc3589x: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-08 17:41 ` [PATCH v2 30/30] mfd: intel-lpss: " Paul Cercueil
  2022-08-13 14:50 ` [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Jonathan Cameron
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new pm_sleep_ptr() macro to handle the .suspend/.resume
callbacks.

This macro allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/tc6393xb.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index aa903a31dd43..997bb8b5881d 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -813,7 +813,6 @@ static int tc6393xb_remove(struct platform_device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
 static int tc6393xb_suspend(struct platform_device *dev, pm_message_t state)
 {
 	struct tc6393xb_platform_data *tcpd = dev_get_platdata(&dev->dev);
@@ -876,16 +875,12 @@ static int tc6393xb_resume(struct platform_device *dev)
 
 	return 0;
 }
-#else
-#define tc6393xb_suspend NULL
-#define tc6393xb_resume NULL
-#endif
 
 static struct platform_driver tc6393xb_driver = {
 	.probe = tc6393xb_probe,
 	.remove = tc6393xb_remove,
-	.suspend = tc6393xb_suspend,
-	.resume = tc6393xb_resume,
+	.suspend = pm_sleep_ptr(tc6393xb_suspend),
+	.resume = pm_sleep_ptr(tc6393xb_resume),
 
 	.driver = {
 		.name = "tc6393xb",
-- 
2.35.1


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

* [PATCH v2 30/30] mfd: intel-lpss: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (28 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 29/30] mfd: tc6393xb: " Paul Cercueil
@ 2022-08-08 17:41 ` Paul Cercueil
  2022-08-13 14:50 ` [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Jonathan Cameron
  30 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-08-08 17:41 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Paul Cercueil

Use the new EXPORT_GPL_DEV_PM_OPS() and pm_sleep_ptr() / pm_ptr() macros
to handle the PM callbacks.

These macros allow the PM functions to be automatically dropped by the
compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef
guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Note that instead of exporting two dev_pm_ops structures containing the
exact same data, one in intel-lpss-acpi.c and one in intel-lpss-pci.c,
we export one single dev_pm_ops structure from intel-lpss.c using the
EXPORT_GP_DEV_PM_OPS() macro, which is then referenced from the -acpi.c
and -pci.c files.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/mfd/intel-lpss-acpi.c |  4 +---
 drivers/mfd/intel-lpss-pci.c  |  4 +---
 drivers/mfd/intel-lpss.c      | 15 +++++++++------
 drivers/mfd/intel-lpss.h      | 28 +---------------------------
 4 files changed, 12 insertions(+), 39 deletions(-)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index a143c8dca2d9..1d46a7aa1c61 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -203,15 +203,13 @@ static int intel_lpss_acpi_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static INTEL_LPSS_PM_OPS(intel_lpss_acpi_pm_ops);
-
 static struct platform_driver intel_lpss_acpi_driver = {
 	.probe = intel_lpss_acpi_probe,
 	.remove = intel_lpss_acpi_remove,
 	.driver = {
 		.name = "intel-lpss",
 		.acpi_match_table = intel_lpss_acpi_ids,
-		.pm = &intel_lpss_acpi_pm_ops,
+		.pm = pm_ptr(&intel_lpss_pm_ops),
 	},
 };
 
diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c
index bb08b7a73fe1..25f34cf05432 100644
--- a/drivers/mfd/intel-lpss-pci.c
+++ b/drivers/mfd/intel-lpss-pci.c
@@ -71,8 +71,6 @@ static void intel_lpss_pci_remove(struct pci_dev *pdev)
 	intel_lpss_remove(&pdev->dev);
 }
 
-static INTEL_LPSS_PM_OPS(intel_lpss_pci_pm_ops);
-
 static const struct intel_lpss_platform_info spt_info = {
 	.clk_rate = 120000000,
 };
@@ -507,7 +505,7 @@ static struct pci_driver intel_lpss_pci_driver = {
 	.probe = intel_lpss_pci_probe,
 	.remove = intel_lpss_pci_remove,
 	.driver = {
-		.pm = &intel_lpss_pci_pm_ops,
+		.pm = pm_ptr(&intel_lpss_pm_ops),
 	},
 };
 
diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index cfbee2cfba6b..9cdd0b52f8d8 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -468,7 +468,7 @@ static int resume_lpss_device(struct device *dev, void *data)
 	return 0;
 }
 
-int intel_lpss_prepare(struct device *dev)
+static int intel_lpss_prepare(struct device *dev)
 {
 	/*
 	 * Resume both child devices before entering system sleep. This
@@ -477,9 +477,8 @@ int intel_lpss_prepare(struct device *dev)
 	device_for_each_child_reverse(dev, NULL, resume_lpss_device);
 	return 0;
 }
-EXPORT_SYMBOL_GPL(intel_lpss_prepare);
 
-int intel_lpss_suspend(struct device *dev)
+static int intel_lpss_suspend(struct device *dev)
 {
 	struct intel_lpss *lpss = dev_get_drvdata(dev);
 	unsigned int i;
@@ -498,9 +497,8 @@ int intel_lpss_suspend(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(intel_lpss_suspend);
 
-int intel_lpss_resume(struct device *dev)
+static int intel_lpss_resume(struct device *dev)
 {
 	struct intel_lpss *lpss = dev_get_drvdata(dev);
 	unsigned int i;
@@ -513,7 +511,12 @@ int intel_lpss_resume(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(intel_lpss_resume);
+
+EXPORT_GPL_DEV_PM_OPS(intel_lpss_pm_ops) = {
+	.prepare = pm_sleep_ptr(intel_lpss_prepare),
+	LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume)
+	RUNTIME_PM_OPS(intel_lpss_suspend, intel_lpss_resume, NULL)
+};
 
 static int __init intel_lpss_init(void)
 {
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h
index 062ce95b68b9..c1d72b117ed5 100644
--- a/drivers/mfd/intel-lpss.h
+++ b/drivers/mfd/intel-lpss.h
@@ -30,32 +30,6 @@ int intel_lpss_probe(struct device *dev,
 		     const struct intel_lpss_platform_info *info);
 void intel_lpss_remove(struct device *dev);
 
-#ifdef CONFIG_PM
-int intel_lpss_prepare(struct device *dev);
-int intel_lpss_suspend(struct device *dev);
-int intel_lpss_resume(struct device *dev);
-
-#ifdef CONFIG_PM_SLEEP
-#define INTEL_LPSS_SLEEP_PM_OPS			\
-	.prepare = intel_lpss_prepare,		\
-	SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume)
-#else
-#define INTEL_LPSS_SLEEP_PM_OPS
-#endif
-
-#define INTEL_LPSS_RUNTIME_PM_OPS		\
-	.runtime_suspend = intel_lpss_suspend,	\
-	.runtime_resume = intel_lpss_resume,
-
-#else /* !CONFIG_PM */
-#define INTEL_LPSS_SLEEP_PM_OPS
-#define INTEL_LPSS_RUNTIME_PM_OPS
-#endif /* CONFIG_PM */
-
-#define INTEL_LPSS_PM_OPS(name)			\
-const struct dev_pm_ops name = {		\
-	INTEL_LPSS_SLEEP_PM_OPS			\
-	INTEL_LPSS_RUNTIME_PM_OPS		\
-}
+extern const struct dev_pm_ops intel_lpss_pm_ops;
 
 #endif /* __MFD_INTEL_LPSS_H */
-- 
2.35.1


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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-08-08 17:40 ` [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros Paul Cercueil
@ 2022-08-13 14:49   ` Jonathan Cameron
  2022-08-23 17:47   ` Rafael J. Wysocki
  1 sibling, 0 replies; 46+ messages in thread
From: Jonathan Cameron @ 2022-08-13 14:49 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Lee Jones, linux-kernel, Rafael J . Wysocki, linux-pm

On Mon,  8 Aug 2022 19:40:38 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> Update the _EXPORT_DEV_PM_OPS() internal macro. It was not used anywhere
> outside pm.h and pm_runtime.h, so it is safe to update it.
> 
> Before, this macro would take a few parameters to be used as sleep and
> runtime callbacks. This made it unsuitable to use with different
> callbacks, for instance the "noirq" ones.
> 
> It is now semantically different: instead of creating a conditionally
> exported dev_pm_ops structure, it only contains part of the definition.
> 
> This macro should however never be used directly (hence the trailing
> underscore). Instead, the following four macros are provided:
> - EXPORT_DEV_PM_OPS(name)
> - EXPORT_GPL_DEV_PM_OPS(name)
> - EXPORT_NS_DEV_PM_OPS(name, ns)
> - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
> 
> For instance, it is now possible to conditionally export noirq
> suspend/resume PM functions like this:
> 
> EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
>     NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> };
> 
> The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
> EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these new macros.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Looks good to me and much nicer than me making the situation worse
as I did in the proposal to have a macro that took even more callbacks
as it's parameters.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Cc: linux-pm <linux-pm@vger.kernel.org>
> 
>  include/linux/pm.h         | 37 +++++++++++++++++++++++--------------
>  include/linux/pm_runtime.h | 20 ++++++++++++--------
>  2 files changed, 35 insertions(+), 22 deletions(-)
> 
> diff --git a/include/linux/pm.h b/include/linux/pm.h
> index 871c9c49ec9d..93cd34f00822 100644
> --- a/include/linux/pm.h
> +++ b/include/linux/pm.h
> @@ -375,19 +375,20 @@ 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, ns)		\
> -	_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
> -			   runtime_resume_fn, idle_fn); \
> -	__EXPORT_SYMBOL(name, sec, ns)
> +#define _EXPORT_DEV_PM_OPS(name, sec, ns)				\
> +	const struct dev_pm_ops name;					\
> +	__EXPORT_SYMBOL(name, sec, ns);					\
> +	const struct dev_pm_ops name
>  #else
> -#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
> -			   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)
> +#define _EXPORT_DEV_PM_OPS(name, sec, ns)				\
> +	static __maybe_unused const struct dev_pm_ops __static_##name
>  #endif
>  
> +#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
> +#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "_gpl", "")
> +#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
> +#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "_gpl", #ns)
> +
>  /*
>   * Use this if you want to use the same suspend and resume callbacks for suspend
>   * to RAM and hibernation.
> @@ -399,13 +400,21 @@ 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) = { \
> +		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +	}
>  #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_GPL_DEV_PM_OPS(name) = { \
> +		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +	}
>  #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)
> +	EXPORT_NS_DEV_PM_OPS(name, ns) = { \
> +		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +	}
>  #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)
> +	EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
> +		SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +	}
>  
>  /* 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 9e4d056967c6..ba2077d9e366 100644
> --- a/include/linux/pm_runtime.h
> +++ b/include/linux/pm_runtime.h
> @@ -40,17 +40,21 @@
>  			   resume_fn, idle_fn)
>  
>  #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, "", "")
> +	EXPORT_DEV_PM_OPS(name) = { \
> +		RUNTIME_PM_OPS(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", "")
> +	EXPORT_GPL_DEV_PM_OPS(name) = { \
> +		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
> +	}
>  #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)
> +	EXPORT_NS_DEV_PM_OPS(name, ns) = { \
> +		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
> +	}
>  #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)
> +	EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
> +		RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
> +	}
>  
>  #ifdef CONFIG_PM
>  extern struct workqueue_struct *pm_wq;


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

* Re: [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions
  2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
                   ` (29 preceding siblings ...)
  2022-08-08 17:41 ` [PATCH v2 30/30] mfd: intel-lpss: " Paul Cercueil
@ 2022-08-13 14:50 ` Jonathan Cameron
  30 siblings, 0 replies; 46+ messages in thread
From: Jonathan Cameron @ 2022-08-13 14:50 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Lee Jones, linux-kernel, Rafael J . Wysocki, linux-pm

On Mon,  8 Aug 2022 19:40:37 +0200
Paul Cercueil <paul@crapouillou.net> wrote:

> Hi Lee,
> 
> Here's my revised patchset updated from the feedback I got in V1.
> This one is based on the current mfd-next-5.20.
> 
> I updated the PM macros in <linux/pm.h> and <linux/pm_runtime.h>, to
> make them more versatile. They now allow to conditionally export
> arbitrary dev_pm_ops structures. This is used in the "arizona" driver
> for instance, which has "noirq" callbacks.
> 
> I Cc'd Jonathan, whom might be interested by the PM patch to convert the
> IIO drivers to the new PM macros. Lee, if this patchset gets merged to
> the MFD tree, could you then create an immutable branch for Jonathan?

That would be much appreciated. Ideally the immutable branch would just
contain patch 1.  If it doesn't work out that way I can always pick up
the half dozen cases that would use the new infrastructure next cycle.

Thanks!

Jonathan
> 
> Changes:
> - [01/30] is new and adds the reworked PM macros.
> - [12/30] now only modifies intel_soc_pmic_core.c since Andy updated
>           the other file.
> - [21/30] uses the new EXPORT_GPL_DEV_PM_OPS() macro instead of the
>           trickery that was used before.
> - [26/30] removes a CONFIG_PM wrapper around fields in private struct
> - [27/30] removes a duplicated "const".
> - [30/30] is new, and updates the intel-lpss driver.
> - All patches: Reworded the last paragraph, hide the Cc's, remove
>                the Cc to Bartlomiej's email address.
> 
> Cheers,
> -Paul
> 
> Paul Cercueil (30):
>   pm: Improve EXPORT_*_DEV_PM_OPS macros
>   mfd: 88pm80x: Remove #ifdef guards for PM related functions
>   mfd: aat2870: Remove #ifdef guards for PM related functions
>   mfd: adp5520: Remove #ifdef guards for PM related functions
>   mfd: max8925-i2c: Remove #ifdef guards for PM related functions
>   mfd: mt6397-irq: Remove #ifdef guards for PM related functions
>   mfd: pcf50633: Remove #ifdef guards for PM related functions
>   mfd: rc5t583-irq: Remove #ifdef guards for PM related functions
>   mfd: stpmic1: Remove #ifdef guards for PM related functions
>   mfd: ucb1x00: Remove #ifdef guards for PM related functions
>   mfd: 88pm860x: Remove #ifdef guards for PM related functions
>   mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions
>   mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions
>   mfd: sec: Remove #ifdef guards for PM related functions
>   mfd: sm501: Remove #ifdef guards for PM related functions
>   mfd: tc6387xb: Remove #ifdef guards for PM related functions
>   mfd: tps6586x: Remove #ifdef guards for PM related functions
>   mfd: wm8994: Remove #ifdef guards for PM related functions
>   mfd: max77620: Remove #ifdef guards for PM related functions
>   mfd: t7l66xb: Remove #ifdef guards for PM related functions
>   mfd: arizona: Remove #ifdef guards for PM related functions
>   mfd: max14577: Remove #ifdef guards for PM related functions
>   mfd: max77686: Remove #ifdef guards for PM related functions
>   mfd: motorola-cpcap: Remove #ifdef guards for PM related functions
>   mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions
>   mfd: stmfx: Remove #ifdef guards for PM related functions
>   mfd: stmpe: Remove #ifdef guards for PM related functions
>   mfd: tc3589x: Remove #ifdef guards for PM related functions
>   mfd: tc6393xb: Remove #ifdef guards for PM related functions
>   mfd: intel-lpss: Remove #ifdef guards for PM related functions
> 
>  drivers/mfd/88pm800.c             |  2 +-
>  drivers/mfd/88pm805.c             |  2 +-
>  drivers/mfd/88pm80x.c             |  5 +----
>  drivers/mfd/88pm860x-core.c       |  6 ++---
>  drivers/mfd/aat2870-core.c        |  8 +++----
>  drivers/mfd/adp5520.c             |  6 ++---
>  drivers/mfd/arizona-core.c        | 19 ++++++----------
>  drivers/mfd/arizona-i2c.c         |  2 +-
>  drivers/mfd/arizona-spi.c         |  2 +-
>  drivers/mfd/intel-lpss-acpi.c     |  4 +---
>  drivers/mfd/intel-lpss-pci.c      |  4 +---
>  drivers/mfd/intel-lpss.c          | 15 ++++++++-----
>  drivers/mfd/intel-lpss.h          | 28 +----------------------
>  drivers/mfd/intel_soc_pmic_core.c |  8 +++----
>  drivers/mfd/max14577.c            |  6 ++---
>  drivers/mfd/max77620.c            |  9 +++-----
>  drivers/mfd/max77686.c            |  6 ++---
>  drivers/mfd/max8925-i2c.c         |  7 +++---
>  drivers/mfd/mcp-sa11x0.c          |  6 +----
>  drivers/mfd/motorola-cpcap.c      |  6 ++---
>  drivers/mfd/mt6397-irq.c          |  6 +----
>  drivers/mfd/pcf50633-core.c       | 22 +-----------------
>  drivers/mfd/pcf50633-irq.c        | 13 ++++++-----
>  drivers/mfd/rc5t583-irq.c         |  7 ++----
>  drivers/mfd/sec-core.c            |  7 +++---
>  drivers/mfd/sm501.c               | 10 ++-------
>  drivers/mfd/sprd-sc27xx-spi.c     |  7 +++---
>  drivers/mfd/stmfx.c               |  6 ++---
>  drivers/mfd/stmpe-i2c.c           |  4 +---
>  drivers/mfd/stmpe-spi.c           |  4 +---
>  drivers/mfd/stmpe.c               |  8 ++-----
>  drivers/mfd/stpmic1.c             |  6 ++---
>  drivers/mfd/t7l66xb.c             |  9 ++------
>  drivers/mfd/tc3589x.c             |  7 +++---
>  drivers/mfd/tc6387xb.c            |  9 ++------
>  drivers/mfd/tc6393xb.c            |  9 ++------
>  drivers/mfd/tps6586x.c            |  6 +----
>  drivers/mfd/ucb1x00-core.c        |  7 +++---
>  drivers/mfd/wm8994-core.c         |  6 ++---
>  include/linux/mfd/pcf50633/core.h |  6 ++---
>  include/linux/mfd/stmfx.h         |  2 --
>  include/linux/pm.h                | 37 +++++++++++++++++++------------
>  include/linux/pm_runtime.h        | 20 ++++++++++-------
>  43 files changed, 127 insertions(+), 242 deletions(-)
> 
> ---
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Cc: linux-pm <linux-pm@vger.kernel.org>


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

* Re: [PATCH v2 18/30] mfd: wm8994: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 ` [PATCH v2 18/30] mfd: wm8994: " Paul Cercueil
@ 2022-08-22  9:43   ` Charles Keepax
  0 siblings, 0 replies; 46+ messages in thread
From: Charles Keepax @ 2022-08-22  9:43 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Lee Jones, linux-kernel, patches

On Mon, Aug 08, 2022 at 07:40:55PM +0200, Paul Cercueil wrote:
> Use the new RUNTIME_PM_OPS() and pm_ptr() macros to handle the
> .runtime_suspend/.runtime_resume callbacks.
> 
> These macros allow the suspend and resume functions to be automatically
> dropped by the compiler when CONFIG_PM is disabled, without having
> to use #ifdef guards.
> 
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.
> 
> Note that this driver should probably use the new
> DEFINE_RUNTIME_DEV_PM_OPS() macro instead, which will provide
> .suspend/.resume callbacks, pointing to pm_runtime_force_suspend() and
> pm_runtime_force_resume() respectively; unless those callbacks really
> aren't needed.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH v2 21/30] mfd: arizona: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 ` [PATCH v2 21/30] mfd: arizona: " Paul Cercueil
@ 2022-08-22  9:44   ` Charles Keepax
  0 siblings, 0 replies; 46+ messages in thread
From: Charles Keepax @ 2022-08-22  9:44 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Lee Jones, linux-kernel, patches

On Mon, Aug 08, 2022 at 07:40:58PM +0200, Paul Cercueil wrote:
> Use the new EXPORT_GPL_DEV_PM_OPS() and pm_ptr() macros to handle the PM
> callbacks.
> 
> These macros allow the PM functions to be automatically dropped by the
> compiler when CONFIG_PM is disabled, without having to use #ifdef
> guards.
> 
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

* Re: [PATCH v2 12/30] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions
  2022-08-08 17:40 ` [PATCH v2 12/30] mfd: intel_soc_pmic: " Paul Cercueil
@ 2022-08-23 14:17   ` Andy Shevchenko
  0 siblings, 0 replies; 46+ messages in thread
From: Andy Shevchenko @ 2022-08-23 14:17 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: Lee Jones, linux-kernel, Andy Shevchenko

On Mon, Aug 08, 2022 at 07:40:49PM +0200, Paul Cercueil wrote:
> Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
> to handle the .suspend/.resume callbacks.
> 
> These macros allow the suspend and resume functions to be automatically
> dropped by the compiler when CONFIG_SUSPEND is disabled, without having
> to use #ifdef guards.
> 
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

But it needs to be rebased.

> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> Cc: Andy Shevchenko <andy@kernel.org>
> 
>  drivers/mfd/intel_soc_pmic_core.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
> index 5e8c94e008ed..96303aa87bc1 100644
> --- a/drivers/mfd/intel_soc_pmic_core.c
> +++ b/drivers/mfd/intel_soc_pmic_core.c
> @@ -104,7 +104,6 @@ static void intel_soc_pmic_shutdown(struct i2c_client *i2c)
>  	return;
>  }
>  
> -#if defined(CONFIG_PM_SLEEP)
>  static int intel_soc_pmic_suspend(struct device *dev)
>  {
>  	struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
> @@ -122,10 +121,9 @@ static int intel_soc_pmic_resume(struct device *dev)
>  
>  	return 0;
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_suspend,
> -			 intel_soc_pmic_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_suspend,
> +				intel_soc_pmic_resume);
>  
>  static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
>  	{ }
> @@ -143,7 +141,7 @@ MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
>  static struct i2c_driver intel_soc_pmic_i2c_driver = {
>  	.driver = {
>  		.name = "intel_soc_pmic_i2c",
> -		.pm = &intel_soc_pmic_pm_ops,
> +		.pm = pm_sleep_ptr(&intel_soc_pmic_pm_ops),
>  		.acpi_match_table = ACPI_PTR(intel_soc_pmic_acpi_match),
>  	},
>  	.probe = intel_soc_pmic_i2c_probe,
> -- 
> 2.35.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-08-08 17:40 ` [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros Paul Cercueil
  2022-08-13 14:49   ` Jonathan Cameron
@ 2022-08-23 17:47   ` Rafael J. Wysocki
  2022-08-25 22:42     ` Paul Cercueil
  1 sibling, 1 reply; 46+ messages in thread
From: Rafael J. Wysocki @ 2022-08-23 17:47 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Lee Jones, Linux Kernel Mailing List, Jonathan Cameron,
	Rafael J . Wysocki, linux-pm

On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
> Update the _EXPORT_DEV_PM_OPS() internal macro. It was not used anywhere
> outside pm.h and pm_runtime.h, so it is safe to update it.
>
> Before, this macro would take a few parameters to be used as sleep and
> runtime callbacks. This made it unsuitable to use with different
> callbacks, for instance the "noirq" ones.
>
> It is now semantically different: instead of creating a conditionally
> exported dev_pm_ops structure, it only contains part of the definition.
>
> This macro should however never be used directly (hence the trailing
> underscore). Instead, the following four macros are provided:
> - EXPORT_DEV_PM_OPS(name)
> - EXPORT_GPL_DEV_PM_OPS(name)
> - EXPORT_NS_DEV_PM_OPS(name, ns)
> - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
>
> For instance, it is now possible to conditionally export noirq
> suspend/resume PM functions like this:
>
> EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
>     NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> };
>
> The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
> EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these new macros.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

or please let me know if you need me to pick up this one.

> ---
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Rafael J. Wysocki <rafael@kernel.org>
> Cc: linux-pm <linux-pm@vger.kernel.org>
>
>  include/linux/pm.h         | 37 +++++++++++++++++++++++--------------
>  include/linux/pm_runtime.h | 20 ++++++++++++--------
>  2 files changed, 35 insertions(+), 22 deletions(-)
>
> diff --git a/include/linux/pm.h b/include/linux/pm.h
> index 871c9c49ec9d..93cd34f00822 100644
> --- a/include/linux/pm.h
> +++ b/include/linux/pm.h
> @@ -375,19 +375,20 @@ 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, ns)         \
> -       _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
> -                          runtime_resume_fn, idle_fn); \
> -       __EXPORT_SYMBOL(name, sec, ns)
> +#define _EXPORT_DEV_PM_OPS(name, sec, ns)                              \
> +       const struct dev_pm_ops name;                                   \
> +       __EXPORT_SYMBOL(name, sec, ns);                                 \
> +       const struct dev_pm_ops name
>  #else
> -#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
> -                          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)
> +#define _EXPORT_DEV_PM_OPS(name, sec, ns)                              \
> +       static __maybe_unused const struct dev_pm_ops __static_##name
>  #endif
>
> +#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
> +#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "_gpl", "")
> +#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
> +#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "_gpl", #ns)
> +
>  /*
>   * Use this if you want to use the same suspend and resume callbacks for suspend
>   * to RAM and hibernation.
> @@ -399,13 +400,21 @@ 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) = { \
> +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +       }
>  #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_GPL_DEV_PM_OPS(name) = { \
> +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +       }
>  #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)
> +       EXPORT_NS_DEV_PM_OPS(name, ns) = { \
> +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +       }
>  #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)
> +       EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
> +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> +       }
>
>  /* 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 9e4d056967c6..ba2077d9e366 100644
> --- a/include/linux/pm_runtime.h
> +++ b/include/linux/pm_runtime.h
> @@ -40,17 +40,21 @@
>                            resume_fn, idle_fn)
>
>  #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, "", "")
> +       EXPORT_DEV_PM_OPS(name) = { \
> +               RUNTIME_PM_OPS(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", "")
> +       EXPORT_GPL_DEV_PM_OPS(name) = { \
> +               RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
> +       }
>  #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)
> +       EXPORT_NS_DEV_PM_OPS(name, ns) = { \
> +               RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
> +       }
>  #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)
> +       EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
> +               RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
> +       }
>
>  #ifdef CONFIG_PM
>  extern struct workqueue_struct *pm_wq;
> --
> 2.35.1
>

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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-08-23 17:47   ` Rafael J. Wysocki
@ 2022-08-25 22:42     ` Paul Cercueil
  2022-09-25 14:52       ` Jonathan Cameron
  0 siblings, 1 reply; 46+ messages in thread
From: Paul Cercueil @ 2022-08-25 22:42 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lee Jones, Linux Kernel Mailing List, Jonathan Cameron, linux-pm

Hi Rafael,

Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki 
<rafael@kernel.org> a écrit :
> On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil <paul@crapouillou.net> 
> wrote:
>> 
>>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was not used 
>> anywhere
>>  outside pm.h and pm_runtime.h, so it is safe to update it.
>> 
>>  Before, this macro would take a few parameters to be used as sleep 
>> and
>>  runtime callbacks. This made it unsuitable to use with different
>>  callbacks, for instance the "noirq" ones.
>> 
>>  It is now semantically different: instead of creating a 
>> conditionally
>>  exported dev_pm_ops structure, it only contains part of the 
>> definition.
>> 
>>  This macro should however never be used directly (hence the trailing
>>  underscore). Instead, the following four macros are provided:
>>  - EXPORT_DEV_PM_OPS(name)
>>  - EXPORT_GPL_DEV_PM_OPS(name)
>>  - EXPORT_NS_DEV_PM_OPS(name, ns)
>>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
>> 
>>  For instance, it is now possible to conditionally export noirq
>>  suspend/resume PM functions like this:
>> 
>>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
>>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
>>  };
>> 
>>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
>>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these new 
>> macros.
>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> 
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> or please let me know if you need me to pick up this one.

Could you pick this one up then, and make a branch for Jonathan?

Cheers,
-Paul

> 
>>  ---
>>  Cc: Jonathan Cameron <jic23@kernel.org>
>>  Cc: Rafael J. Wysocki <rafael@kernel.org>
>>  Cc: linux-pm <linux-pm@vger.kernel.org>
>> 
>>   include/linux/pm.h         | 37 
>> +++++++++++++++++++++++--------------
>>   include/linux/pm_runtime.h | 20 ++++++++++++--------
>>   2 files changed, 35 insertions(+), 22 deletions(-)
>> 
>>  diff --git a/include/linux/pm.h b/include/linux/pm.h
>>  index 871c9c49ec9d..93cd34f00822 100644
>>  --- a/include/linux/pm.h
>>  +++ b/include/linux/pm.h
>>  @@ -375,19 +375,20 @@ 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, ns)     
>>     \
>>  -       _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, 
>> runtime_suspend_fn, \
>>  -                          runtime_resume_fn, idle_fn); \
>>  -       __EXPORT_SYMBOL(name, sec, ns)
>>  +#define _EXPORT_DEV_PM_OPS(name, sec, ns)                          
>>     \
>>  +       const struct dev_pm_ops name;                               
>>     \
>>  +       __EXPORT_SYMBOL(name, sec, ns);                             
>>     \
>>  +       const struct dev_pm_ops name
>>   #else
>>  -#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, 
>> runtime_suspend_fn, \
>>  -                          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)
>>  +#define _EXPORT_DEV_PM_OPS(name, sec, ns)                          
>>     \
>>  +       static __maybe_unused const struct dev_pm_ops 
>> __static_##name
>>   #endif
>> 
>>  +#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
>>  +#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, 
>> "_gpl", "")
>>  +#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, 
>> "", #ns)
>>  +#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) 
>> _EXPORT_DEV_PM_OPS(name, "_gpl", #ns)
>>  +
>>   /*
>>    * Use this if you want to use the same suspend and resume 
>> callbacks for suspend
>>    * to RAM and hibernation.
>>  @@ -399,13 +400,21 @@ 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) = { \
>>  +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
>>  +       }
>>   #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_GPL_DEV_PM_OPS(name) = { \
>>  +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
>>  +       }
>>   #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)
>>  +       EXPORT_NS_DEV_PM_OPS(name, ns) = { \
>>  +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
>>  +       }
>>   #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)
>>  +       EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
>>  +               SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
>>  +       }
>> 
>>   /* 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 9e4d056967c6..ba2077d9e366 100644
>>  --- a/include/linux/pm_runtime.h
>>  +++ b/include/linux/pm_runtime.h
>>  @@ -40,17 +40,21 @@
>>                             resume_fn, idle_fn)
>> 
>>   #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, "", "")
>>  +       EXPORT_DEV_PM_OPS(name) = { \
>>  +               RUNTIME_PM_OPS(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", 
>> "")
>>  +       EXPORT_GPL_DEV_PM_OPS(name) = { \
>>  +               RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
>>  +       }
>>   #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)
>>  +       EXPORT_NS_DEV_PM_OPS(name, ns) = { \
>>  +               RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
>>  +       }
>>   #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)
>>  +       EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
>>  +               RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
>>  +       }
>> 
>>   #ifdef CONFIG_PM
>>   extern struct workqueue_struct *pm_wq;
>>  --
>>  2.35.1
>> 



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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-08-25 22:42     ` Paul Cercueil
@ 2022-09-25 14:52       ` Jonathan Cameron
  2022-09-26 12:00         ` Rafael J. Wysocki
  0 siblings, 1 reply; 46+ messages in thread
From: Jonathan Cameron @ 2022-09-25 14:52 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Rafael J. Wysocki, Lee Jones, Linux Kernel Mailing List, linux-pm

On Thu, 25 Aug 2022 23:42:53 +0100
Paul Cercueil <paul@crapouillou.net> wrote:

> Hi Rafael,
> 
> Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki 
> <rafael@kernel.org> a écrit :
> > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil <paul@crapouillou.net> 
> > wrote:  
> >> 
> >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was not used 
> >> anywhere
> >>  outside pm.h and pm_runtime.h, so it is safe to update it.
> >> 
> >>  Before, this macro would take a few parameters to be used as sleep 
> >> and
> >>  runtime callbacks. This made it unsuitable to use with different
> >>  callbacks, for instance the "noirq" ones.
> >> 
> >>  It is now semantically different: instead of creating a 
> >> conditionally
> >>  exported dev_pm_ops structure, it only contains part of the 
> >> definition.
> >> 
> >>  This macro should however never be used directly (hence the trailing
> >>  underscore). Instead, the following four macros are provided:
> >>  - EXPORT_DEV_PM_OPS(name)
> >>  - EXPORT_GPL_DEV_PM_OPS(name)
> >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
> >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
> >> 
> >>  For instance, it is now possible to conditionally export noirq
> >>  suspend/resume PM functions like this:
> >> 
> >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
> >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> >>  };
> >> 
> >>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
> >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these new 
> >> macros.
> >> 
> >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>  
> > 
> > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > or please let me know if you need me to pick up this one.  
> 
> Could you pick this one up then, and make a branch for Jonathan?

Hi Paul, Rafael,

What happened to this in the end?  I can't immediately find it on 
any of the pm git tree branches.

At this stage in the cycle it would be great if this patch at least
makes the merge window, so we can make use of it next cycle.

Thanks,

Jonathan

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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-09-25 14:52       ` Jonathan Cameron
@ 2022-09-26 12:00         ` Rafael J. Wysocki
  2022-09-26 13:27           ` Paul Cercueil
  0 siblings, 1 reply; 46+ messages in thread
From: Rafael J. Wysocki @ 2022-09-26 12:00 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Paul Cercueil, Rafael J. Wysocki, Lee Jones,
	Linux Kernel Mailing List, linux-pm

On Sun, Sep 25, 2022 at 4:52 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Thu, 25 Aug 2022 23:42:53 +0100
> Paul Cercueil <paul@crapouillou.net> wrote:
>
> > Hi Rafael,
> >
> > Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki
> > <rafael@kernel.org> a écrit :
> > > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil <paul@crapouillou.net>
> > > wrote:
> > >>
> > >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was not used
> > >> anywhere
> > >>  outside pm.h and pm_runtime.h, so it is safe to update it.
> > >>
> > >>  Before, this macro would take a few parameters to be used as sleep
> > >> and
> > >>  runtime callbacks. This made it unsuitable to use with different
> > >>  callbacks, for instance the "noirq" ones.
> > >>
> > >>  It is now semantically different: instead of creating a
> > >> conditionally
> > >>  exported dev_pm_ops structure, it only contains part of the
> > >> definition.
> > >>
> > >>  This macro should however never be used directly (hence the trailing
> > >>  underscore). Instead, the following four macros are provided:
> > >>  - EXPORT_DEV_PM_OPS(name)
> > >>  - EXPORT_GPL_DEV_PM_OPS(name)
> > >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
> > >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
> > >>
> > >>  For instance, it is now possible to conditionally export noirq
> > >>  suspend/resume PM functions like this:
> > >>
> > >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
> > >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> > >>  };
> > >>
> > >>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
> > >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these new
> > >> macros.
> > >>
> > >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> > >
> > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > >
> > > or please let me know if you need me to pick up this one.
> >
> > Could you pick this one up then, and make a branch for Jonathan?
>
> Hi Paul, Rafael,
>
> What happened to this in the end?  I can't immediately find it on
> any of the pm git tree branches.
>
> At this stage in the cycle it would be great if this patch at least
> makes the merge window, so we can make use of it next cycle.

I thought that this would go in along with the other patches in the series.

I can apply it directly, though, if needed.

Thanks!

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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-09-26 12:00         ` Rafael J. Wysocki
@ 2022-09-26 13:27           ` Paul Cercueil
  2022-09-26 13:35             ` Rafael J. Wysocki
  0 siblings, 1 reply; 46+ messages in thread
From: Paul Cercueil @ 2022-09-26 13:27 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jonathan Cameron, Lee Jones, Linux Kernel Mailing List, linux-pm

Hi,

Le lun., sept. 26 2022 at 14:00:52 +0200, Rafael J. Wysocki 
<rafael@kernel.org> a écrit :
> On Sun, Sep 25, 2022 at 4:52 PM Jonathan Cameron <jic23@kernel.org> 
> wrote:
>> 
>>  On Thu, 25 Aug 2022 23:42:53 +0100
>>  Paul Cercueil <paul@crapouillou.net> wrote:
>> 
>>  > Hi Rafael,
>>  >
>>  > Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki
>>  > <rafael@kernel.org> a écrit :
>>  > > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil 
>> <paul@crapouillou.net>
>>  > > wrote:
>>  > >>
>>  > >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was not 
>> used
>>  > >> anywhere
>>  > >>  outside pm.h and pm_runtime.h, so it is safe to update it.
>>  > >>
>>  > >>  Before, this macro would take a few parameters to be used as 
>> sleep
>>  > >> and
>>  > >>  runtime callbacks. This made it unsuitable to use with 
>> different
>>  > >>  callbacks, for instance the "noirq" ones.
>>  > >>
>>  > >>  It is now semantically different: instead of creating a
>>  > >> conditionally
>>  > >>  exported dev_pm_ops structure, it only contains part of the
>>  > >> definition.
>>  > >>
>>  > >>  This macro should however never be used directly (hence the 
>> trailing
>>  > >>  underscore). Instead, the following four macros are provided:
>>  > >>  - EXPORT_DEV_PM_OPS(name)
>>  > >>  - EXPORT_GPL_DEV_PM_OPS(name)
>>  > >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
>>  > >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
>>  > >>
>>  > >>  For instance, it is now possible to conditionally export noirq
>>  > >>  suspend/resume PM functions like this:
>>  > >>
>>  > >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
>>  > >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
>>  > >>  };
>>  > >>
>>  > >>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
>>  > >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these 
>> new
>>  > >> macros.
>>  > >>
>>  > >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  > >
>>  > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>  > >
>>  > > or please let me know if you need me to pick up this one.
>>  >
>>  > Could you pick this one up then, and make a branch for Jonathan?
>> 
>>  Hi Paul, Rafael,
>> 
>>  What happened to this in the end?  I can't immediately find it on
>>  any of the pm git tree branches.
>> 
>>  At this stage in the cycle it would be great if this patch at least
>>  makes the merge window, so we can make use of it next cycle.
> 
> I thought that this would go in along with the other patches in the 
> series.
> 
> I can apply it directly, though, if needed.
> 
> Thanks!

I think at this point Jonathan can just take it in his tree with his 
own patchset. Then I'll rebase this patchset on v6.1-rc1.

Cheers,
-Paul



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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-09-26 13:27           ` Paul Cercueil
@ 2022-09-26 13:35             ` Rafael J. Wysocki
  2022-10-01 17:01               ` Jonathan Cameron
  0 siblings, 1 reply; 46+ messages in thread
From: Rafael J. Wysocki @ 2022-09-26 13:35 UTC (permalink / raw)
  To: Paul Cercueil, Jonathan Cameron
  Cc: Lee Jones, Linux Kernel Mailing List, linux-pm

On Mon, Sep 26, 2022 at 3:27 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
> Hi,
>
> Le lun., sept. 26 2022 at 14:00:52 +0200, Rafael J. Wysocki
> <rafael@kernel.org> a écrit :
> > On Sun, Sep 25, 2022 at 4:52 PM Jonathan Cameron <jic23@kernel.org>
> > wrote:
> >>
> >>  On Thu, 25 Aug 2022 23:42:53 +0100
> >>  Paul Cercueil <paul@crapouillou.net> wrote:
> >>
> >>  > Hi Rafael,
> >>  >
> >>  > Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki
> >>  > <rafael@kernel.org> a écrit :
> >>  > > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil
> >> <paul@crapouillou.net>
> >>  > > wrote:
> >>  > >>
> >>  > >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was not
> >> used
> >>  > >> anywhere
> >>  > >>  outside pm.h and pm_runtime.h, so it is safe to update it.
> >>  > >>
> >>  > >>  Before, this macro would take a few parameters to be used as
> >> sleep
> >>  > >> and
> >>  > >>  runtime callbacks. This made it unsuitable to use with
> >> different
> >>  > >>  callbacks, for instance the "noirq" ones.
> >>  > >>
> >>  > >>  It is now semantically different: instead of creating a
> >>  > >> conditionally
> >>  > >>  exported dev_pm_ops structure, it only contains part of the
> >>  > >> definition.
> >>  > >>
> >>  > >>  This macro should however never be used directly (hence the
> >> trailing
> >>  > >>  underscore). Instead, the following four macros are provided:
> >>  > >>  - EXPORT_DEV_PM_OPS(name)
> >>  > >>  - EXPORT_GPL_DEV_PM_OPS(name)
> >>  > >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
> >>  > >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
> >>  > >>
> >>  > >>  For instance, it is now possible to conditionally export noirq
> >>  > >>  suspend/resume PM functions like this:
> >>  > >>
> >>  > >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
> >>  > >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> >>  > >>  };
> >>  > >>
> >>  > >>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
> >>  > >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these
> >> new
> >>  > >> macros.
> >>  > >>
> >>  > >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> >>  > >
> >>  > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >>  > >
> >>  > > or please let me know if you need me to pick up this one.
> >>  >
> >>  > Could you pick this one up then, and make a branch for Jonathan?
> >>
> >>  Hi Paul, Rafael,
> >>
> >>  What happened to this in the end?  I can't immediately find it on
> >>  any of the pm git tree branches.
> >>
> >>  At this stage in the cycle it would be great if this patch at least
> >>  makes the merge window, so we can make use of it next cycle.
> >
> > I thought that this would go in along with the other patches in the
> > series.
> >
> > I can apply it directly, though, if needed.
> >
> > Thanks!
>
> I think at this point Jonathan can just take it in his tree with his
> own patchset. Then I'll rebase this patchset on v6.1-rc1.

Sure.

Jonathan, please go ahead and take the patch directly.

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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-09-26 13:35             ` Rafael J. Wysocki
@ 2022-10-01 17:01               ` Jonathan Cameron
  2022-10-02 11:18                 ` Paul Cercueil
  0 siblings, 1 reply; 46+ messages in thread
From: Jonathan Cameron @ 2022-10-01 17:01 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Paul Cercueil, Lee Jones, Linux Kernel Mailing List, linux-pm

On Mon, 26 Sep 2022 15:35:35 +0200
"Rafael J. Wysocki" <rafael@kernel.org> wrote:

> On Mon, Sep 26, 2022 at 3:27 PM Paul Cercueil <paul@crapouillou.net> wrote:
> >
> > Hi,
> >
> > Le lun., sept. 26 2022 at 14:00:52 +0200, Rafael J. Wysocki
> > <rafael@kernel.org> a écrit :  
> > > On Sun, Sep 25, 2022 at 4:52 PM Jonathan Cameron <jic23@kernel.org>
> > > wrote:  
> > >>
> > >>  On Thu, 25 Aug 2022 23:42:53 +0100
> > >>  Paul Cercueil <paul@crapouillou.net> wrote:
> > >>  
> > >>  > Hi Rafael,
> > >>  >
> > >>  > Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki
> > >>  > <rafael@kernel.org> a écrit :  
> > >>  > > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil  
> > >> <paul@crapouillou.net>  
> > >>  > > wrote:  
> > >>  > >>
> > >>  > >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was not  
> > >> used  
> > >>  > >> anywhere
> > >>  > >>  outside pm.h and pm_runtime.h, so it is safe to update it.
> > >>  > >>
> > >>  > >>  Before, this macro would take a few parameters to be used as  
> > >> sleep  
> > >>  > >> and
> > >>  > >>  runtime callbacks. This made it unsuitable to use with  
> > >> different  
> > >>  > >>  callbacks, for instance the "noirq" ones.
> > >>  > >>
> > >>  > >>  It is now semantically different: instead of creating a
> > >>  > >> conditionally
> > >>  > >>  exported dev_pm_ops structure, it only contains part of the
> > >>  > >> definition.
> > >>  > >>
> > >>  > >>  This macro should however never be used directly (hence the  
> > >> trailing  
> > >>  > >>  underscore). Instead, the following four macros are provided:
> > >>  > >>  - EXPORT_DEV_PM_OPS(name)
> > >>  > >>  - EXPORT_GPL_DEV_PM_OPS(name)
> > >>  > >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
> > >>  > >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
> > >>  > >>
> > >>  > >>  For instance, it is now possible to conditionally export noirq
> > >>  > >>  suspend/resume PM functions like this:
> > >>  > >>
> > >>  > >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
> > >>  > >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> > >>  > >>  };
> > >>  > >>
> > >>  > >>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() and
> > >>  > >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use these  
> > >> new  
> > >>  > >> macros.
> > >>  > >>
> > >>  > >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>  
> > >>  > >
> > >>  > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > >>  > >
> > >>  > > or please let me know if you need me to pick up this one.  
> > >>  >
> > >>  > Could you pick this one up then, and make a branch for Jonathan?  
> > >>
> > >>  Hi Paul, Rafael,
> > >>
> > >>  What happened to this in the end?  I can't immediately find it on
> > >>  any of the pm git tree branches.
> > >>
> > >>  At this stage in the cycle it would be great if this patch at least
> > >>  makes the merge window, so we can make use of it next cycle.  
> > >
> > > I thought that this would go in along with the other patches in the
> > > series.
> > >
> > > I can apply it directly, though, if needed.
> > >
> > > Thanks!  
> >
> > I think at this point Jonathan can just take it in his tree with his
> > own patchset. Then I'll rebase this patchset on v6.1-rc1.  
> 
> Sure.
> 
> Jonathan, please go ahead and take the patch directly.

Too late for me to take this for this cycle (I route via Greg KH so need to have things
in place a little bit before the merge window).  If Lee doesn't pick it up, I'll do an
immutable branch after rc1 is out with just this patch on it, then anyone who wants
it can pick it up.

Thanks,

Jonathan

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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-10-01 17:01               ` Jonathan Cameron
@ 2022-10-02 11:18                 ` Paul Cercueil
  2022-10-04 18:54                   ` Rafael J. Wysocki
  0 siblings, 1 reply; 46+ messages in thread
From: Paul Cercueil @ 2022-10-02 11:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jonathan Cameron, Lee Jones, Linux Kernel Mailing List, linux-pm



Le sam., oct. 1 2022 at 18:01:30 +0100, Jonathan Cameron 
<jic23@kernel.org> a écrit :
> On Mon, 26 Sep 2022 15:35:35 +0200
> "Rafael J. Wysocki" <rafael@kernel.org> wrote:
> 
>>  On Mon, Sep 26, 2022 at 3:27 PM Paul Cercueil 
>> <paul@crapouillou.net> wrote:
>>  >
>>  > Hi,
>>  >
>>  > Le lun., sept. 26 2022 at 14:00:52 +0200, Rafael J. Wysocki
>>  > <rafael@kernel.org> a écrit :
>>  > > On Sun, Sep 25, 2022 at 4:52 PM Jonathan Cameron 
>> <jic23@kernel.org>
>>  > > wrote:
>>  > >>
>>  > >>  On Thu, 25 Aug 2022 23:42:53 +0100
>>  > >>  Paul Cercueil <paul@crapouillou.net> wrote:
>>  > >>
>>  > >>  > Hi Rafael,
>>  > >>  >
>>  > >>  > Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki
>>  > >>  > <rafael@kernel.org> a écrit :
>>  > >>  > > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil
>>  > >> <paul@crapouillou.net>
>>  > >>  > > wrote:
>>  > >>  > >>
>>  > >>  > >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was 
>> not
>>  > >> used
>>  > >>  > >> anywhere
>>  > >>  > >>  outside pm.h and pm_runtime.h, so it is safe to update 
>> it.
>>  > >>  > >>
>>  > >>  > >>  Before, this macro would take a few parameters to be 
>> used as
>>  > >> sleep
>>  > >>  > >> and
>>  > >>  > >>  runtime callbacks. This made it unsuitable to use with
>>  > >> different
>>  > >>  > >>  callbacks, for instance the "noirq" ones.
>>  > >>  > >>
>>  > >>  > >>  It is now semantically different: instead of creating a
>>  > >>  > >> conditionally
>>  > >>  > >>  exported dev_pm_ops structure, it only contains part of 
>> the
>>  > >>  > >> definition.
>>  > >>  > >>
>>  > >>  > >>  This macro should however never be used directly (hence 
>> the
>>  > >> trailing
>>  > >>  > >>  underscore). Instead, the following four macros are 
>> provided:
>>  > >>  > >>  - EXPORT_DEV_PM_OPS(name)
>>  > >>  > >>  - EXPORT_GPL_DEV_PM_OPS(name)
>>  > >>  > >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
>>  > >>  > >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
>>  > >>  > >>
>>  > >>  > >>  For instance, it is now possible to conditionally 
>> export noirq
>>  > >>  > >>  suspend/resume PM functions like this:
>>  > >>  > >>
>>  > >>  > >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
>>  > >>  > >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
>>  > >>  > >>  };
>>  > >>  > >>
>>  > >>  > >>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS() 
>> and
>>  > >>  > >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use 
>> these
>>  > >> new
>>  > >>  > >> macros.
>>  > >>  > >>
>>  > >>  > >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  > >>  > >
>>  > >>  > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>  > >>  > >
>>  > >>  > > or please let me know if you need me to pick up this one.
>>  > >>  >
>>  > >>  > Could you pick this one up then, and make a branch for 
>> Jonathan?
>>  > >>
>>  > >>  Hi Paul, Rafael,
>>  > >>
>>  > >>  What happened to this in the end?  I can't immediately find 
>> it on
>>  > >>  any of the pm git tree branches.
>>  > >>
>>  > >>  At this stage in the cycle it would be great if this patch at 
>> least
>>  > >>  makes the merge window, so we can make use of it next cycle.
>>  > >
>>  > > I thought that this would go in along with the other patches in 
>> the
>>  > > series.
>>  > >
>>  > > I can apply it directly, though, if needed.
>>  > >
>>  > > Thanks!
>>  >
>>  > I think at this point Jonathan can just take it in his tree with 
>> his
>>  > own patchset. Then I'll rebase this patchset on v6.1-rc1.
>> 
>>  Sure.
>> 
>>  Jonathan, please go ahead and take the patch directly.
> 
> Too late for me to take this for this cycle (I route via Greg KH so 
> need to have things
> in place a little bit before the merge window).  If Lee doesn't pick 
> it up, I'll do an
> immutable branch after rc1 is out with just this patch on it, then 
> anyone who wants
> it can pick it up.

Rafael or Lee, can you take it now?

Or is it already too late? :(

-Paul



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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-10-02 11:18                 ` Paul Cercueil
@ 2022-10-04 18:54                   ` Rafael J. Wysocki
  2022-10-04 19:12                     ` Paul Cercueil
  0 siblings, 1 reply; 46+ messages in thread
From: Rafael J. Wysocki @ 2022-10-04 18:54 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Rafael J. Wysocki, Jonathan Cameron, Lee Jones,
	Linux Kernel Mailing List, linux-pm

On Sun, Oct 2, 2022 at 1:18 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
>
>
> Le sam., oct. 1 2022 at 18:01:30 +0100, Jonathan Cameron
> <jic23@kernel.org> a écrit :
> > On Mon, 26 Sep 2022 15:35:35 +0200
> > "Rafael J. Wysocki" <rafael@kernel.org> wrote:
> >
> >>  On Mon, Sep 26, 2022 at 3:27 PM Paul Cercueil
> >> <paul@crapouillou.net> wrote:
> >>  >
> >>  > Hi,
> >>  >
> >>  > Le lun., sept. 26 2022 at 14:00:52 +0200, Rafael J. Wysocki
> >>  > <rafael@kernel.org> a écrit :
> >>  > > On Sun, Sep 25, 2022 at 4:52 PM Jonathan Cameron
> >> <jic23@kernel.org>
> >>  > > wrote:
> >>  > >>
> >>  > >>  On Thu, 25 Aug 2022 23:42:53 +0100
> >>  > >>  Paul Cercueil <paul@crapouillou.net> wrote:
> >>  > >>
> >>  > >>  > Hi Rafael,
> >>  > >>  >
> >>  > >>  > Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. Wysocki
> >>  > >>  > <rafael@kernel.org> a écrit :
> >>  > >>  > > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil
> >>  > >> <paul@crapouillou.net>
> >>  > >>  > > wrote:
> >>  > >>  > >>
> >>  > >>  > >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It was
> >> not
> >>  > >> used
> >>  > >>  > >> anywhere
> >>  > >>  > >>  outside pm.h and pm_runtime.h, so it is safe to update
> >> it.
> >>  > >>  > >>
> >>  > >>  > >>  Before, this macro would take a few parameters to be
> >> used as
> >>  > >> sleep
> >>  > >>  > >> and
> >>  > >>  > >>  runtime callbacks. This made it unsuitable to use with
> >>  > >> different
> >>  > >>  > >>  callbacks, for instance the "noirq" ones.
> >>  > >>  > >>
> >>  > >>  > >>  It is now semantically different: instead of creating a
> >>  > >>  > >> conditionally
> >>  > >>  > >>  exported dev_pm_ops structure, it only contains part of
> >> the
> >>  > >>  > >> definition.
> >>  > >>  > >>
> >>  > >>  > >>  This macro should however never be used directly (hence
> >> the
> >>  > >> trailing
> >>  > >>  > >>  underscore). Instead, the following four macros are
> >> provided:
> >>  > >>  > >>  - EXPORT_DEV_PM_OPS(name)
> >>  > >>  > >>  - EXPORT_GPL_DEV_PM_OPS(name)
> >>  > >>  > >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
> >>  > >>  > >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
> >>  > >>  > >>
> >>  > >>  > >>  For instance, it is now possible to conditionally
> >> export noirq
> >>  > >>  > >>  suspend/resume PM functions like this:
> >>  > >>  > >>
> >>  > >>  > >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
> >>  > >>  > >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> >>  > >>  > >>  };
> >>  > >>  > >>
> >>  > >>  > >>  The existing helper macros EXPORT_*_SIMPLE_DEV_PM_OPS()
> >> and
> >>  > >>  > >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to use
> >> these
> >>  > >> new
> >>  > >>  > >> macros.
> >>  > >>  > >>
> >>  > >>  > >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> >>  > >>  > >
> >>  > >>  > > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >>  > >>  > >
> >>  > >>  > > or please let me know if you need me to pick up this one.
> >>  > >>  >
> >>  > >>  > Could you pick this one up then, and make a branch for
> >> Jonathan?
> >>  > >>
> >>  > >>  Hi Paul, Rafael,
> >>  > >>
> >>  > >>  What happened to this in the end?  I can't immediately find
> >> it on
> >>  > >>  any of the pm git tree branches.
> >>  > >>
> >>  > >>  At this stage in the cycle it would be great if this patch at
> >> least
> >>  > >>  makes the merge window, so we can make use of it next cycle.
> >>  > >
> >>  > > I thought that this would go in along with the other patches in
> >> the
> >>  > > series.
> >>  > >
> >>  > > I can apply it directly, though, if needed.
> >>  > >
> >>  > > Thanks!
> >>  >
> >>  > I think at this point Jonathan can just take it in his tree with
> >> his
> >>  > own patchset. Then I'll rebase this patchset on v6.1-rc1.
> >>
> >>  Sure.
> >>
> >>  Jonathan, please go ahead and take the patch directly.
> >
> > Too late for me to take this for this cycle (I route via Greg KH so
> > need to have things
> > in place a little bit before the merge window).  If Lee doesn't pick
> > it up, I'll do an
> > immutable branch after rc1 is out with just this patch on it, then
> > anyone who wants
> > it can pick it up.
>
> Rafael or Lee, can you take it now?
>
> Or is it already too late? :(

I've applied this patch as 6.1-rc material, thanks!

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

* Re: [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros
  2022-10-04 18:54                   ` Rafael J. Wysocki
@ 2022-10-04 19:12                     ` Paul Cercueil
  0 siblings, 0 replies; 46+ messages in thread
From: Paul Cercueil @ 2022-10-04 19:12 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jonathan Cameron, Lee Jones, Linux Kernel Mailing List, linux-pm



Le mar., oct. 4 2022 at 20:54:28 +0200, Rafael J. Wysocki 
<rafael@kernel.org> a écrit :
> On Sun, Oct 2, 2022 at 1:18 PM Paul Cercueil <paul@crapouillou.net> 
> wrote:
>> 
>> 
>> 
>>  Le sam., oct. 1 2022 at 18:01:30 +0100, Jonathan Cameron
>>  <jic23@kernel.org> a écrit :
>>  > On Mon, 26 Sep 2022 15:35:35 +0200
>>  > "Rafael J. Wysocki" <rafael@kernel.org> wrote:
>>  >
>>  >>  On Mon, Sep 26, 2022 at 3:27 PM Paul Cercueil
>>  >> <paul@crapouillou.net> wrote:
>>  >>  >
>>  >>  > Hi,
>>  >>  >
>>  >>  > Le lun., sept. 26 2022 at 14:00:52 +0200, Rafael J. Wysocki
>>  >>  > <rafael@kernel.org> a écrit :
>>  >>  > > On Sun, Sep 25, 2022 at 4:52 PM Jonathan Cameron
>>  >> <jic23@kernel.org>
>>  >>  > > wrote:
>>  >>  > >>
>>  >>  > >>  On Thu, 25 Aug 2022 23:42:53 +0100
>>  >>  > >>  Paul Cercueil <paul@crapouillou.net> wrote:
>>  >>  > >>
>>  >>  > >>  > Hi Rafael,
>>  >>  > >>  >
>>  >>  > >>  > Le mar., août 23 2022 at 19:47:57 +0200, Rafael J. 
>> Wysocki
>>  >>  > >>  > <rafael@kernel.org> a écrit :
>>  >>  > >>  > > On Mon, Aug 8, 2022 at 7:41 PM Paul Cercueil
>>  >>  > >> <paul@crapouillou.net>
>>  >>  > >>  > > wrote:
>>  >>  > >>  > >>
>>  >>  > >>  > >>  Update the _EXPORT_DEV_PM_OPS() internal macro. It 
>> was
>>  >> not
>>  >>  > >> used
>>  >>  > >>  > >> anywhere
>>  >>  > >>  > >>  outside pm.h and pm_runtime.h, so it is safe to 
>> update
>>  >> it.
>>  >>  > >>  > >>
>>  >>  > >>  > >>  Before, this macro would take a few parameters to be
>>  >> used as
>>  >>  > >> sleep
>>  >>  > >>  > >> and
>>  >>  > >>  > >>  runtime callbacks. This made it unsuitable to use 
>> with
>>  >>  > >> different
>>  >>  > >>  > >>  callbacks, for instance the "noirq" ones.
>>  >>  > >>  > >>
>>  >>  > >>  > >>  It is now semantically different: instead of 
>> creating a
>>  >>  > >>  > >> conditionally
>>  >>  > >>  > >>  exported dev_pm_ops structure, it only contains 
>> part of
>>  >> the
>>  >>  > >>  > >> definition.
>>  >>  > >>  > >>
>>  >>  > >>  > >>  This macro should however never be used directly 
>> (hence
>>  >> the
>>  >>  > >> trailing
>>  >>  > >>  > >>  underscore). Instead, the following four macros are
>>  >> provided:
>>  >>  > >>  > >>  - EXPORT_DEV_PM_OPS(name)
>>  >>  > >>  > >>  - EXPORT_GPL_DEV_PM_OPS(name)
>>  >>  > >>  > >>  - EXPORT_NS_DEV_PM_OPS(name, ns)
>>  >>  > >>  > >>  - EXPORT_NS_GPL_DEV_PM_OPS(name, ns)
>>  >>  > >>  > >>
>>  >>  > >>  > >>  For instance, it is now possible to conditionally
>>  >> export noirq
>>  >>  > >>  > >>  suspend/resume PM functions like this:
>>  >>  > >>  > >>
>>  >>  > >>  > >>  EXPORT_GPL_DEV_PM_OPS(foo_pm_ops) = {
>>  >>  > >>  > >>      NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
>>  >>  > >>  > >>  };
>>  >>  > >>  > >>
>>  >>  > >>  > >>  The existing helper macros 
>> EXPORT_*_SIMPLE_DEV_PM_OPS()
>>  >> and
>>  >>  > >>  > >>  EXPORT_*_RUNTIME_DEV_PM_OPS() have been updated to 
>> use
>>  >> these
>>  >>  > >> new
>>  >>  > >>  > >> macros.
>>  >>  > >>  > >>
>>  >>  > >>  > >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  >>  > >>  > >
>>  >>  > >>  > > Acked-by: Rafael J. Wysocki 
>> <rafael.j.wysocki@intel.com>
>>  >>  > >>  > >
>>  >>  > >>  > > or please let me know if you need me to pick up this 
>> one.
>>  >>  > >>  >
>>  >>  > >>  > Could you pick this one up then, and make a branch for
>>  >> Jonathan?
>>  >>  > >>
>>  >>  > >>  Hi Paul, Rafael,
>>  >>  > >>
>>  >>  > >>  What happened to this in the end?  I can't immediately 
>> find
>>  >> it on
>>  >>  > >>  any of the pm git tree branches.
>>  >>  > >>
>>  >>  > >>  At this stage in the cycle it would be great if this 
>> patch at
>>  >> least
>>  >>  > >>  makes the merge window, so we can make use of it next 
>> cycle.
>>  >>  > >
>>  >>  > > I thought that this would go in along with the other 
>> patches in
>>  >> the
>>  >>  > > series.
>>  >>  > >
>>  >>  > > I can apply it directly, though, if needed.
>>  >>  > >
>>  >>  > > Thanks!
>>  >>  >
>>  >>  > I think at this point Jonathan can just take it in his tree 
>> with
>>  >> his
>>  >>  > own patchset. Then I'll rebase this patchset on v6.1-rc1.
>>  >>
>>  >>  Sure.
>>  >>
>>  >>  Jonathan, please go ahead and take the patch directly.
>>  >
>>  > Too late for me to take this for this cycle (I route via Greg KH 
>> so
>>  > need to have things
>>  > in place a little bit before the merge window).  If Lee doesn't 
>> pick
>>  > it up, I'll do an
>>  > immutable branch after rc1 is out with just this patch on it, then
>>  > anyone who wants
>>  > it can pick it up.
>> 
>>  Rafael or Lee, can you take it now?
>> 
>>  Or is it already too late? :(
> 
> I've applied this patch as 6.1-rc material, thanks!

Awesome, thanks!

-Paul



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

end of thread, other threads:[~2022-10-04 19:13 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 17:40 [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 01/30] pm: Improve EXPORT_*_DEV_PM_OPS macros Paul Cercueil
2022-08-13 14:49   ` Jonathan Cameron
2022-08-23 17:47   ` Rafael J. Wysocki
2022-08-25 22:42     ` Paul Cercueil
2022-09-25 14:52       ` Jonathan Cameron
2022-09-26 12:00         ` Rafael J. Wysocki
2022-09-26 13:27           ` Paul Cercueil
2022-09-26 13:35             ` Rafael J. Wysocki
2022-10-01 17:01               ` Jonathan Cameron
2022-10-02 11:18                 ` Paul Cercueil
2022-10-04 18:54                   ` Rafael J. Wysocki
2022-10-04 19:12                     ` Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 02/30] mfd: 88pm80x: Remove #ifdef guards for PM related functions Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 03/30] mfd: aat2870: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 04/30] mfd: adp5520: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 05/30] mfd: max8925-i2c: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 06/30] mfd: mt6397-irq: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 07/30] mfd: pcf50633: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 08/30] mfd: rc5t583-irq: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 09/30] mfd: stpmic1: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 10/30] mfd: ucb1x00: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 11/30] mfd: 88pm860x: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 12/30] mfd: intel_soc_pmic: " Paul Cercueil
2022-08-23 14:17   ` Andy Shevchenko
2022-08-08 17:40 ` [PATCH v2 13/30] mfd: mcp-sa11x0: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 14/30] mfd: sec: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 15/30] mfd: sm501: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 16/30] mfd: tc6387xb: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 17/30] mfd: tps6586x: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 18/30] mfd: wm8994: " Paul Cercueil
2022-08-22  9:43   ` Charles Keepax
2022-08-08 17:40 ` [PATCH v2 19/30] mfd: max77620: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 20/30] mfd: t7l66xb: " Paul Cercueil
2022-08-08 17:40 ` [PATCH v2 21/30] mfd: arizona: " Paul Cercueil
2022-08-22  9:44   ` Charles Keepax
2022-08-08 17:40 ` [PATCH v2 22/30] mfd: max14577: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 23/30] mfd: max77686: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 24/30] mfd: motorola-cpcap: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 25/30] mfd: sprd-sc27xx: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 26/30] mfd: stmfx: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 27/30] mfd: stmpe: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 28/30] mfd: tc3589x: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 29/30] mfd: tc6393xb: " Paul Cercueil
2022-08-08 17:41 ` [PATCH v2 30/30] mfd: intel-lpss: " Paul Cercueil
2022-08-13 14:50 ` [PATCH v2 00/30] mfd: Remove #ifdef guards for PM functions Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).