2022-08-07 15:22:35

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 00/28] mfd: Remove #ifdef guards for PM functions

Hi Lee,

Here is a set of 28 patches that should convert all MFD drivers to use
the proper PM macros introduced recently.

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

The rationale behind this change, is that these functions are now
always compiled independently of any Kconfig option, and thanks to that
bugs and regressions are easier to catch.

Most of the changes are trivial. Some patches come with a caveat:
- patch 06/28 moves the PM functions to pcf50633-irq.c, and uses
EXPORT_GPL_SIMPLE_DEV_PM_OPS(). This means that we're now exporting a
symbol that wasn't exported before. This is the only solution I found
in order to have all PM related functions dropped in case PM is
disabled.
- patch 12/28 was not compile-tested (all other were) since it doesn't
build on x86. The change is trivial though, so there's no reason why
it wouldn't compile.
- patch 14, 15, 19 and 28 use (platform_driver.suspend) instead of
(platform_driver.driver.pm.suspend). Is the former deprecated?
The scope of this patchset is just to convert to the new PM macros,
but it left me wondering if this should be using the standard
dev_pm_ops structure instead.
- patch 17/28 could probably use DEFINE_RUNTIME_DEV_PM_OPS(), which
registers pm_runtime_force_suspend() and pm_runtime_force_resume() as
the .suspend/.resume callbacks. I didn't know if the callbacks were
missing on purpose, so I chose not to use this macro.
- patch 20/28 is a bit messy, because the EXPORT_GPL_SIMPLE_DEV_PM_OPS()
does not support noirq callbacks. If you think it looks too bad, we
can maybe add a new PM macro to handle this case.
- patch 26/28 exports the "stmpe_dev_pm_ops", which wasn't exported
before. If you think this is a problem, we can export the symbol to a
stmpe namespace.

Cheers,
-Paul

Paul Cercueil (28):
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

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 | 21 +++++++++++----------
drivers/mfd/arizona-i2c.c | 2 +-
drivers/mfd/arizona-spi.c | 2 +-
drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +++----
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 ++----
37 files changed, 87 insertions(+), 181 deletions(-)

--
2.35.1


2022-08-07 15:23:06

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 28/28] mfd: tc6393xb: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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 0be5731685b4..9e1ecd92902c 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -814,7 +814,6 @@ static int tc6393xb_remove(struct platform_device *dev)
return ret;
}

-#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);
@@ -877,16 +876,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

2022-08-07 15:24:26

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 05/28] mfd: mt6397-irq: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
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 2924919da991..69009d119216 100644
--- a/drivers/mfd/mt6397-irq.c
+++ b/drivers/mfd/mt6397-irq.c
@@ -52,7 +52,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);
@@ -66,9 +65,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",
@@ -76,7 +72,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

2022-08-07 15:25:51

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 22/28] mfd: max77686: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Chanwoo Choi <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Bartlomiej Zolnierkiewicz <[email protected]>
---
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

2022-08-07 15:27:54

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 19/28] mfd: t7l66xb: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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 5369c67e3280..74d26dce2003 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

/*--------------------------------------------------------------------------*/

@@ -420,8 +415,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

2022-08-07 15:31:01

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 02/28] mfd: aat2870: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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

2022-08-07 15:33:07

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 03/28] mfd: adp5520: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Michael Hennerich <[email protected]>
---
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

2022-08-07 15:33:07

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 23/28] mfd: motorola-cpcap: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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

2022-08-07 15:33:39

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 25/28] mfd: stmfx: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
drivers/mfd/stmfx.c | 6 ++----
1 file changed, 2 insertions(+), 4 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,
--
2.35.1

2022-08-07 15:34:29

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 08/28] mfd: stpmic1: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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

2022-08-07 15:34:40

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 17/28] mfd: wm8994: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are 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 <[email protected]>
Cc: [email protected]
---
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

2022-08-07 15:36:39

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 11/28] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Andy Shevchenko <[email protected]>
---
drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +++----
drivers/mfd/intel_soc_pmic_core.c | 8 +++-----
2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
index bc069c4daa60..7110d91f7ace 100644
--- a/drivers/mfd/intel_soc_pmic_bxtwc.c
+++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
@@ -586,7 +586,6 @@ static void bxtwc_shutdown(struct platform_device *pdev)
disable_irq(pmic->irq);
}

-#ifdef CONFIG_PM_SLEEP
static int bxtwc_suspend(struct device *dev)
{
struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
@@ -603,8 +602,8 @@ static int bxtwc_resume(struct device *dev)
enable_irq(pmic->irq);
return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume);
+
+static DEFINE_SIMPLE_DEV_PM_OPS(bxtwc_pm_ops, bxtwc_suspend, bxtwc_resume);

static const struct acpi_device_id bxtwc_acpi_ids[] = {
{ "INT34D3", },
@@ -618,7 +617,7 @@ static struct platform_driver bxtwc_driver = {
.shutdown = bxtwc_shutdown,
.driver = {
.name = "BXTWC PMIC",
- .pm = &bxtwc_pm_ops,
+ .pm = pm_sleep_ptr(&bxtwc_pm_ops),
.acpi_match_table = ACPI_PTR(bxtwc_acpi_ids),
},
};
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

2022-08-07 15:37:51

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 16/28] mfd: tps6586x: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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

2022-08-07 15:37:54

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions

Only export the arizona_pm_ops if CONFIG_PM is set, but leave the
suspend/resume functions (and related code) outside #ifdef guards.

If CONFIG_PM is not set, the arizona_pm_ops will be defined as
"static __maybe_unused", and the structure plus all the callbacks will
be automatically dropped by the compiler.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: [email protected]
---
drivers/mfd/arizona-core.c | 21 +++++++++++----------
drivers/mfd/arizona-i2c.c | 2 +-
drivers/mfd/arizona-spi.c | 2 +-
3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index cbf1dd90b70d..c1acc9521f83 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,21 @@ static int arizona_resume(struct device *dev)

return 0;
}
-#endif

+#ifndef CONFIG_PM
+static __maybe_unused
+#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)
+ 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)
};
+#ifdef CONFIG_PM
EXPORT_SYMBOL_GPL(arizona_pm_ops);
+#endif

#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

2022-08-07 15:38:22

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 01/28] mfd: 88pm80x: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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 <[email protected]>");
--
2.35.1

2022-08-07 15:39:03

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 18/28] mfd: max77620: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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 fec2096474ad..e8ee4b132fb7 100644
--- a/drivers/mfd/max77620.c
+++ b/drivers/mfd/max77620.c
@@ -574,7 +574,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)
{
@@ -681,7 +680,6 @@ static int max77620_i2c_resume(struct device *dev)

return 0;
}
-#endif

static const struct i2c_device_id max77620_id[] = {
{"max77620", MAX77620},
@@ -690,14 +688,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

2022-08-07 15:39:17

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 24/28] mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Orson Zhai <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Chunyan Zhang <[email protected]>
---
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

2022-08-07 15:39:36

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 09/28] mfd: ucb1x00: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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

2022-08-07 15:39:37

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 14/28] mfd: sm501: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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

2022-08-07 15:40:26

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Bartlomiej Zolnierkiewicz <[email protected]>
Cc: [email protected]
---
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

2022-08-07 15:40:32

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 04/28] mfd: max8925-i2c: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
---
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

2022-08-07 15:41:34

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH 26/28] mfd: stmpe: Remove #ifdef guards for PM related functions

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.

The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.

Signed-off-by: Paul Cercueil <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
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..a88cc1103589 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
+const EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops,
+ stmpe_suspend, stmpe_resume);
--
2.35.1

2022-08-07 15:59:10

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 11/28] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions

On Sun, Aug 7, 2022 at 4:53 PM Paul Cercueil <[email protected]> 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.
>
> The advantage is then that these functions are now always compiled

is that

> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.

...

> drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +++----
> drivers/mfd/intel_soc_pmic_core.c | 8 +++-----

1. These are two different drivers, the patch needs to be split.
2. The Broxton Whiskey Cove should have a similar change. Which base
have you used for your patch? Please, rebase on top of for-mfd-next.
3. The PMIC core actually is Crystal Cove driver and I have a pending
series for that and I guess you know about it. Have you seen what have
been done there?

--
With Best Regards,
Andy Shevchenko

2022-08-07 16:47:50

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 25/28] mfd: stmfx: Remove #ifdef guards for PM related functions

Hi Paul,

I love your patch! Yet something to improve:

[auto build test ERROR on v5.19]
[cannot apply to lee-mfd/for-mfd-next linus/master next-20220805]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
base: 3d7cb6b04c3f3115719235cc6866b10326de34cd
config: openrisc-randconfig-r015-20220807 (https://download.01.org/0day-ci/archive/20220807/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/5a39bd52d549e3f3be743fb336dd710eac75055d
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
git checkout 5a39bd52d549e3f3be743fb336dd710eac75055d
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/mfd/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/mfd/stmfx.c: In function 'stmfx_suspend':
>> drivers/mfd/stmfx.c:485:37: error: 'struct stmfx' has no member named 'bkp_sysctrl'
485 | &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
| ^~
drivers/mfd/stmfx.c:485:64: error: 'struct stmfx' has no member named 'bkp_sysctrl'
485 | &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
| ^~
>> drivers/mfd/stmfx.c:490:37: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
490 | &stmfx->bkp_irqoutpin,
| ^~
drivers/mfd/stmfx.c:491:43: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
491 | sizeof(stmfx->bkp_irqoutpin));
| ^~
drivers/mfd/stmfx.c: In function 'stmfx_resume':
drivers/mfd/stmfx.c:525:38: error: 'struct stmfx' has no member named 'bkp_sysctrl'
525 | &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
| ^~
drivers/mfd/stmfx.c:525:65: error: 'struct stmfx' has no member named 'bkp_sysctrl'
525 | &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
| ^~
drivers/mfd/stmfx.c:530:38: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
530 | &stmfx->bkp_irqoutpin,
| ^~
drivers/mfd/stmfx.c:531:44: error: 'struct stmfx' has no member named 'bkp_irqoutpin'
531 | sizeof(stmfx->bkp_irqoutpin));
| ^~


vim +485 drivers/mfd/stmfx.c

06252ade915665 Amelie Delaunay 2019-05-09 478
06252ade915665 Amelie Delaunay 2019-05-09 479 static int stmfx_suspend(struct device *dev)
06252ade915665 Amelie Delaunay 2019-05-09 480 {
06252ade915665 Amelie Delaunay 2019-05-09 481 struct stmfx *stmfx = dev_get_drvdata(dev);
06252ade915665 Amelie Delaunay 2019-05-09 482 int ret;
06252ade915665 Amelie Delaunay 2019-05-09 483
06252ade915665 Amelie Delaunay 2019-05-09 484 ret = regmap_raw_read(stmfx->map, STMFX_REG_SYS_CTRL,
06252ade915665 Amelie Delaunay 2019-05-09 @485 &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
06252ade915665 Amelie Delaunay 2019-05-09 486 if (ret)
06252ade915665 Amelie Delaunay 2019-05-09 487 return ret;
06252ade915665 Amelie Delaunay 2019-05-09 488
06252ade915665 Amelie Delaunay 2019-05-09 489 ret = regmap_raw_read(stmfx->map, STMFX_REG_IRQ_OUT_PIN,
06252ade915665 Amelie Delaunay 2019-05-09 @490 &stmfx->bkp_irqoutpin,
06252ade915665 Amelie Delaunay 2019-05-09 491 sizeof(stmfx->bkp_irqoutpin));
06252ade915665 Amelie Delaunay 2019-05-09 492 if (ret)
06252ade915665 Amelie Delaunay 2019-05-09 493 return ret;
06252ade915665 Amelie Delaunay 2019-05-09 494
97eda5dcc2cde5 Amelie Delaunay 2020-04-22 495 disable_irq(stmfx->irq);
97eda5dcc2cde5 Amelie Delaunay 2020-04-22 496
06252ade915665 Amelie Delaunay 2019-05-09 497 if (stmfx->vdd)
06252ade915665 Amelie Delaunay 2019-05-09 498 return regulator_disable(stmfx->vdd);
06252ade915665 Amelie Delaunay 2019-05-09 499
06252ade915665 Amelie Delaunay 2019-05-09 500 return 0;
06252ade915665 Amelie Delaunay 2019-05-09 501 }
06252ade915665 Amelie Delaunay 2019-05-09 502

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-07 16:50:18

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH 11/28] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions



Le dim., ao?t 7 2022 at 17:50:32 +0200, Andy Shevchenko
<[email protected]> a ?crit :
> On Sun, Aug 7, 2022 at 4:53 PM Paul Cercueil <[email protected]>
> 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.
>>
>> The advantage is then that these functions are now always compiled
>
> is that

I think that what I wrote is proper English.

>
>> independently of any Kconfig option, and thanks to that bugs and
>> regressions are easier to catch.
>
> ...
>
>> drivers/mfd/intel_soc_pmic_bxtwc.c | 7 +++----
>> drivers/mfd/intel_soc_pmic_core.c | 8 +++-----
>
> 1. These are two different drivers, the patch needs to be split.

Ok.

> 2. The Broxton Whiskey Cove should have a similar change. Which base
> have you used for your patch? Please, rebase on top of for-mfd-next.

That's based on v5.19.

> 3. The PMIC core actually is Crystal Cove driver and I have a pending
> series for that and I guess you know about it. Have you seen what have
> been done there?

No, I didn't know. I guess Lee can skip my patch 11/28 then.

Cheers,
-Paul


2022-08-07 16:53:41

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 26/28] mfd: stmpe: Remove #ifdef guards for PM related functions

Hi Paul,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v5.19]
[cannot apply to lee-mfd/for-mfd-next linus/master next-20220805]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
base: 3d7cb6b04c3f3115719235cc6866b10326de34cd
config: openrisc-randconfig-r015-20220807 (https://download.01.org/0day-ci/archive/20220808/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/e94df3ff809e588320625b95a2ef6485965ddc02
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
git checkout e94df3ff809e588320625b95a2ef6485965ddc02
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/mfd/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/mfd/stmpe.c:1531:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
1531 | const EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops,
| ^~~~~


vim +/static +1531 drivers/mfd/stmpe.c

1530
> 1531 const EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops,

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-07 17:16:40

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 26/28] mfd: stmpe: Remove #ifdef guards for PM related functions

Hi Paul,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v5.19]
[cannot apply to lee-mfd/for-mfd-next linus/master next-20220805]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
base: 3d7cb6b04c3f3115719235cc6866b10326de34cd
config: i386-randconfig-a015 (https://download.01.org/0day-ci/archive/20220808/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/e94df3ff809e588320625b95a2ef6485965ddc02
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
git checkout e94df3ff809e588320625b95a2ef6485965ddc02
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/mfd/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/mfd/stmpe.c:1531:7: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
const EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops,
^
include/linux/pm.h:404:2: note: expanded from macro 'EXPORT_GPL_SIMPLE_DEV_PM_OPS'
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", "")
^
include/linux/pm.h:380:2: note: expanded from macro '_EXPORT_DEV_PM_OPS'
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
^
include/linux/pm.h:371:55: note: expanded from macro '_DEFINE_DEV_PM_OPS'
runtime_suspend_fn, runtime_resume_fn, idle_fn) \
^
1 warning generated.


vim +/const +1531 drivers/mfd/stmpe.c

1530
> 1531 const EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops,

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-07 17:56:26

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions

Hi Paul,

I love your patch! Yet something to improve:

[auto build test ERROR on v5.19]
[cannot apply to lee-mfd/for-mfd-next linus/master next-20220805]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
base: 3d7cb6b04c3f3115719235cc6866b10326de34cd
config: hexagon-randconfig-r013-20220807 (https://download.01.org/0day-ci/archive/20220808/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/03342844cafff973ffa39ce471f64a76c4d87b06
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
git checkout 03342844cafff973ffa39ce471f64a76c4d87b06
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/mfd/arizona-core.c:788:25: error: static declaration of 'arizona_pm_ops' follows non-static declaration
const struct dev_pm_ops arizona_pm_ops = {
^
drivers/mfd/arizona.h:29:32: note: previous declaration is here
extern const struct dev_pm_ops arizona_pm_ops;
^
1 error generated.


vim +/arizona_pm_ops +788 drivers/mfd/arizona-core.c

dc781d0e10fca2 Mark Brown 2013-01-27 784
03342844cafff9 Paul Cercueil 2022-08-07 785 #ifndef CONFIG_PM
03342844cafff9 Paul Cercueil 2022-08-07 786 static __maybe_unused
03342844cafff9 Paul Cercueil 2022-08-07 787 #endif
3cc72986947501 Mark Brown 2012-06-19 @788 const struct dev_pm_ops arizona_pm_ops = {
03342844cafff9 Paul Cercueil 2022-08-07 789 RUNTIME_PM_OPS(arizona_runtime_suspend,
3cc72986947501 Mark Brown 2012-06-19 790 arizona_runtime_resume,
3cc72986947501 Mark Brown 2012-06-19 791 NULL)
03342844cafff9 Paul Cercueil 2022-08-07 792 SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
03342844cafff9 Paul Cercueil 2022-08-07 793 NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq,
3612b27cfb4a07 Charles Keepax 2016-08-30 794 arizona_resume_noirq)
3cc72986947501 Mark Brown 2012-06-19 795 };
03342844cafff9 Paul Cercueil 2022-08-07 796 #ifdef CONFIG_PM
3cc72986947501 Mark Brown 2012-06-19 797 EXPORT_SYMBOL_GPL(arizona_pm_ops);
03342844cafff9 Paul Cercueil 2022-08-07 798 #endif
3cc72986947501 Mark Brown 2012-06-19 799

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-07 18:17:08

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 25/28] mfd: stmfx: Remove #ifdef guards for PM related functions

Hi Paul,

I love your patch! Yet something to improve:

[auto build test ERROR on v5.19]
[cannot apply to lee-mfd/for-mfd-next linus/master next-20220805]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
base: 3d7cb6b04c3f3115719235cc6866b10326de34cd
config: hexagon-randconfig-r013-20220807 (https://download.01.org/0day-ci/archive/20220808/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/5a39bd52d549e3f3be743fb336dd710eac75055d
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Paul-Cercueil/mfd-Remove-ifdef-guards-for-PM-functions/20220807-225947
git checkout 5a39bd52d549e3f3be743fb336dd710eac75055d
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/mfd/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/mfd/stmfx.c:485:18: error: no member named 'bkp_sysctrl' in 'struct stmfx'
&stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
~~~~~ ^
drivers/mfd/stmfx.c:485:45: error: no member named 'bkp_sysctrl' in 'struct stmfx'
&stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
~~~~~ ^
>> drivers/mfd/stmfx.c:490:18: error: no member named 'bkp_irqoutpin' in 'struct stmfx'
&stmfx->bkp_irqoutpin,
~~~~~ ^
drivers/mfd/stmfx.c:491:24: error: no member named 'bkp_irqoutpin' in 'struct stmfx'
sizeof(stmfx->bkp_irqoutpin));
~~~~~ ^
drivers/mfd/stmfx.c:525:19: error: no member named 'bkp_sysctrl' in 'struct stmfx'
&stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
~~~~~ ^
drivers/mfd/stmfx.c:525:46: error: no member named 'bkp_sysctrl' in 'struct stmfx'
&stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
~~~~~ ^
drivers/mfd/stmfx.c:530:19: error: no member named 'bkp_irqoutpin' in 'struct stmfx'
&stmfx->bkp_irqoutpin,
~~~~~ ^
drivers/mfd/stmfx.c:531:25: error: no member named 'bkp_irqoutpin' in 'struct stmfx'
sizeof(stmfx->bkp_irqoutpin));
~~~~~ ^
8 errors generated.


vim +485 drivers/mfd/stmfx.c

06252ade915665 Amelie Delaunay 2019-05-09 478
06252ade915665 Amelie Delaunay 2019-05-09 479 static int stmfx_suspend(struct device *dev)
06252ade915665 Amelie Delaunay 2019-05-09 480 {
06252ade915665 Amelie Delaunay 2019-05-09 481 struct stmfx *stmfx = dev_get_drvdata(dev);
06252ade915665 Amelie Delaunay 2019-05-09 482 int ret;
06252ade915665 Amelie Delaunay 2019-05-09 483
06252ade915665 Amelie Delaunay 2019-05-09 484 ret = regmap_raw_read(stmfx->map, STMFX_REG_SYS_CTRL,
06252ade915665 Amelie Delaunay 2019-05-09 @485 &stmfx->bkp_sysctrl, sizeof(stmfx->bkp_sysctrl));
06252ade915665 Amelie Delaunay 2019-05-09 486 if (ret)
06252ade915665 Amelie Delaunay 2019-05-09 487 return ret;
06252ade915665 Amelie Delaunay 2019-05-09 488
06252ade915665 Amelie Delaunay 2019-05-09 489 ret = regmap_raw_read(stmfx->map, STMFX_REG_IRQ_OUT_PIN,
06252ade915665 Amelie Delaunay 2019-05-09 @490 &stmfx->bkp_irqoutpin,
06252ade915665 Amelie Delaunay 2019-05-09 491 sizeof(stmfx->bkp_irqoutpin));
06252ade915665 Amelie Delaunay 2019-05-09 492 if (ret)
06252ade915665 Amelie Delaunay 2019-05-09 493 return ret;
06252ade915665 Amelie Delaunay 2019-05-09 494
97eda5dcc2cde5 Amelie Delaunay 2020-04-22 495 disable_irq(stmfx->irq);
97eda5dcc2cde5 Amelie Delaunay 2020-04-22 496
06252ade915665 Amelie Delaunay 2019-05-09 497 if (stmfx->vdd)
06252ade915665 Amelie Delaunay 2019-05-09 498 return regulator_disable(stmfx->vdd);
06252ade915665 Amelie Delaunay 2019-05-09 499
06252ade915665 Amelie Delaunay 2019-05-09 500 return 0;
06252ade915665 Amelie Delaunay 2019-05-09 501 }
06252ade915665 Amelie Delaunay 2019-05-09 502

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-08-08 07:59:33

by Hennerich, Michael

[permalink] [raw]
Subject: RE: [PATCH 03/28] mfd: adp5520: Remove #ifdef guards for PM related functions



> -----Original Message-----
> From: Paul Cercueil <[email protected]>
> Sent: Sonntag, 7. August 2022 16:52
> To: Lee Jones <[email protected]>
> Cc: [email protected]; Paul Cercueil <[email protected]>;
> Hennerich, Michael <[email protected]>
> Subject: [PATCH 03/28] mfd: adp5520: Remove #ifdef guards for PM related
> functions
>
>
> 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.
>
> The advantage is then that these functions are now always compiled
> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.
>
> Signed-off-by: Paul Cercueil <[email protected]>
> Cc: Michael Hennerich <[email protected]>

Acked-by: Michael Hennerich <[email protected]>

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

2022-08-08 09:24:29

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

On 07/08/2022 17:52, 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.
>
> The advantage is then that these functions are now always compiled
> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.
>
> Signed-off-by: Paul Cercueil <[email protected]>
> Cc: Krzysztof Kozlowski <[email protected]>
> Cc: Bartlomiej Zolnierkiewicz <[email protected]>

The address does not work. Please don't add it to commit log.

> Cc: [email protected]

This is also not really needed in commit log... it's just a mailing list...

I actually never understood why people want to add to commit log, so to
something which will last 10 years, Cc-ing other folks, instead of
adding such tags after '---'. Imagine 10 years from now:

1. What's the point to be cced on this patch after 10 years instead of
using maintainers file (the one in 10 years)? Why Cc-ing me in 10 years?
If I am a maintainer of this driver in that time, I will be C-ced based
on maintainers file. If I am not a maintainer in 10 years, why the heck
cc-ing me based on some 10-year old commit? Just because I was a
maintainer once, like 10 years ago?

2. Or why cc-ing such people when backporting to stable?

It's quite a lot of unnecessary emails which many of us won't actually
handle later...

I sincerely admit I was once also adding such Cc-tags. But that time my
employer was counting lines-of-patch (including commit log)... crazy, right?


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

Did you test W=1 with !CONFIG_PM_SLEEP? No warnings?


Best regards,
Krzysztof

2022-08-08 09:41:50

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

Hi Krzysztof,

Le lun., ao?t 8 2022 at 12:11:02 +0300, Krzysztof Kozlowski
<[email protected]> a ?crit :
> On 07/08/2022 17:52, 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.
>>
>> The advantage is then that these functions are now always compiled
>> independently of any Kconfig option, and thanks to that bugs and
>> regressions are easier to catch.
>>
>> Signed-off-by: Paul Cercueil <[email protected]>
>> Cc: Krzysztof Kozlowski <[email protected]>
>> Cc: Bartlomiej Zolnierkiewicz <[email protected]>
>
> The address does not work. Please don't add it to commit log.

That's what get-maintainers gave me, and I didn't get any error sending
at that address. But I'll take your word.

>> Cc: [email protected]
>
> This is also not really needed in commit log... it's just a mailing
> list...
>
> I actually never understood why people want to add to commit log, so
> to
> something which will last 10 years, Cc-ing other folks, instead of
> adding such tags after '---'. Imagine 10 years from now:
>
> 1. What's the point to be cced on this patch after 10 years instead of
> using maintainers file (the one in 10 years)? Why Cc-ing me in 10
> years?
> If I am a maintainer of this driver in that time, I will be C-ced
> based
> on maintainers file. If I am not a maintainer in 10 years, why the
> heck
> cc-ing me based on some 10-year old commit? Just because I was a
> maintainer once, like 10 years ago?
>
> 2. Or why cc-ing such people when backporting to stable?
>
> It's quite a lot of unnecessary emails which many of us won't actually
> handle later...
>
> I sincerely admit I was once also adding such Cc-tags. But that time
> my
> employer was counting lines-of-patch (including commit log)... crazy,
> right?

Yeah, well, I can add these tags after the '---' line. Nobody ever told
me that I was doing it wrong, and I see Cc: tags quite often in commit
messages, so I thought it was common practice.

>> ---
>> 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)
>
> Did you test W=1 with !CONFIG_PM_SLEEP? No warnings?

I tested the PR with !CONFIG_PM_SLEEP, correct. sec-core.o compiles
fine. No warnings with W=1.
>
Cheers,
-Paul


2022-08-08 09:46:15

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 22/28] mfd: max77686: Remove #ifdef guards for PM related functions

On 07/08/2022 17:52, 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.
>
> The advantage is then that these functions are now always compiled
> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.
>
> Signed-off-by: Paul Cercueil <[email protected]>
> Cc: Chanwoo Choi <[email protected]>
> Cc: Krzysztof Kozlowski <[email protected]>
> Cc: Bartlomiej Zolnierkiewicz <[email protected]>

Drop the address. Does not work.

Although of course I wished address was fixed (about which we were all
pinging long time ago).

Best regards,
Krzysztof

2022-08-08 09:59:00

by Richard Fitzgerald

[permalink] [raw]
Subject: Re: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions

On 07/08/2022 15:52, Paul Cercueil wrote:
> Only export the arizona_pm_ops if CONFIG_PM is set, but leave the
> suspend/resume functions (and related code) outside #ifdef guards.
>
> If CONFIG_PM is not set, the arizona_pm_ops will be defined as
> "static __maybe_unused", and the structure plus all the callbacks will
> be automatically dropped by the compiler.
>
> The advantage is then that these functions are now always compiled
> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.
>
> Signed-off-by: Paul Cercueil <[email protected]>
> Cc: [email protected]
> ---
> drivers/mfd/arizona-core.c | 21 +++++++++++----------
> drivers/mfd/arizona-i2c.c | 2 +-
> drivers/mfd/arizona-spi.c | 2 +-
> 3 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
> index cbf1dd90b70d..c1acc9521f83 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)

__maybe_unused?

> {
> int ret;
> @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device *dev)

__maybe_unused?

>
> return 0;
> }
> -#endif
>
> -#ifdef CONFIG_PM_SLEEP
> static int arizona_suspend(struct device *dev)

__maybe_unused?

> {
> struct arizona *arizona = dev_get_drvdata(dev);
> @@ -784,17 +781,21 @@ static int arizona_resume(struct device *dev)

__maybe_unused?

>
> return 0;
> }
> -#endif
>
> +#ifndef CONFIG_PM
> +static __maybe_unused
> +#endif

No need to ifdef a __maybe_unused.

> 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)
> + 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)
> };
> +#ifdef CONFIG_PM
> EXPORT_SYMBOL_GPL(arizona_pm_ops);
> +#endif

This ifdeffing is ugly. Why must the structure only be exported if
CONFIG_PM is set?

>
> #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),
> },

2022-08-08 10:17:15

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions


[...]

>>>> ---
>>>> 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)
>>>
>>> Did you test W=1 with !CONFIG_PM_SLEEP? No warnings?
>>
>> I tested the PR with !CONFIG_PM_SLEEP, correct. sec-core.o compiles
>> fine. No warnings with W=1.
>
> Ah, I see now. _DEFINE_DEV_PM_OPS uses __maybe_unused for such case.

Actually it doesn't :) Since the (dev_pm_ops) structure is always (and
should always be) referenced through pm_sleep_ptr() or pm_ptr(), the
symbols are never seen as unused by the compiler, but are automatically
dropped by the compiler when the related config option is turned off.

Cheers,
-Paul


2022-08-08 10:17:51

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 22/28] mfd: max77686: Remove #ifdef guards for PM related functions

On 07/08/2022 17:52, 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.
>
> The advantage is then that these functions are now always compiled
> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.
>
> Signed-off-by: Paul Cercueil <[email protected]>
> Cc: Chanwoo Choi <[email protected]>
> Cc: Krzysztof Kozlowski <[email protected]>
> Cc: Bartlomiej Zolnierkiewicz <[email protected]>

With dropped Bartlomiej:

Reviewed-by: Krzysztof Kozlowski <[email protected]>


Best regards,
Krzysztof

2022-08-08 10:28:30

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

On 08/08/2022 12:28, Paul Cercueil wrote:
> Hi Krzysztof,
>
> Le lun., août 8 2022 at 12:11:02 +0300, Krzysztof Kozlowski
> <[email protected]> a écrit :
>> On 07/08/2022 17:52, 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.
>>>
>>> The advantage is then that these functions are now always compiled
>>> independently of any Kconfig option, and thanks to that bugs and
>>> regressions are easier to catch.
>>>
>>> Signed-off-by: Paul Cercueil <[email protected]>
>>> Cc: Krzysztof Kozlowski <[email protected]>
>>> Cc: Bartlomiej Zolnierkiewicz <[email protected]>
>>
>> The address does not work. Please don't add it to commit log.
>
> That's what get-maintainers gave me, and I didn't get any error sending
> at that address.

I know, I was bugging Bartlomiej and other Samsung folks to fix it and
we reached some kind of conclusion but it never resulted in a patch.

> But I'll take your word.
>
>>> Cc: [email protected]
>>
>> This is also not really needed in commit log... it's just a mailing
>> list...
>>
>> I actually never understood why people want to add to commit log, so
>> to
>> something which will last 10 years, Cc-ing other folks, instead of
>> adding such tags after '---'. Imagine 10 years from now:
>>
>> 1. What's the point to be cced on this patch after 10 years instead of
>> using maintainers file (the one in 10 years)? Why Cc-ing me in 10
>> years?
>> If I am a maintainer of this driver in that time, I will be C-ced
>> based
>> on maintainers file. If I am not a maintainer in 10 years, why the
>> heck
>> cc-ing me based on some 10-year old commit? Just because I was a
>> maintainer once, like 10 years ago?
>>
>> 2. Or why cc-ing such people when backporting to stable?
>>
>> It's quite a lot of unnecessary emails which many of us won't actually
>> handle later...
>>
>> I sincerely admit I was once also adding such Cc-tags. But that time
>> my
>> employer was counting lines-of-patch (including commit log)... crazy,
>> right?
>
> Yeah, well, I can add these tags after the '---' line. Nobody ever told
> me that I was doing it wrong, and I see Cc: tags quite often in commit
> messages, so I thought it was common practice.

It indeed is a practice, which I do not understand. :) My complaining
about it was just complaining, not as a feedback required to change.

>
>>> ---
>>> 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)
>>
>> Did you test W=1 with !CONFIG_PM_SLEEP? No warnings?
>
> I tested the PR with !CONFIG_PM_SLEEP, correct. sec-core.o compiles
> fine. No warnings with W=1.

Ah, I see now. _DEFINE_DEV_PM_OPS uses __maybe_unused for such case.

Looks fine then. With dropped Bartlomiej Cc:

Reviewed-by: Krzysztof Kozlowski <[email protected]>


Best regards,
Krzysztof

2022-08-08 10:29:59

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions

Hi Richard,

Le lun., ao?t 8 2022 at 10:53:54 +0100, Richard Fitzgerald
<[email protected]> a ?crit :
> On 07/08/2022 15:52, Paul Cercueil wrote:
>> Only export the arizona_pm_ops if CONFIG_PM is set, but leave the
>> suspend/resume functions (and related code) outside #ifdef guards.
>>
>> If CONFIG_PM is not set, the arizona_pm_ops will be defined as
>> "static __maybe_unused", and the structure plus all the callbacks
>> will
>> be automatically dropped by the compiler.
>>
>> The advantage is then that these functions are now always compiled
>> independently of any Kconfig option, and thanks to that bugs and
>> regressions are easier to catch.
>>
>> Signed-off-by: Paul Cercueil <[email protected]>
>> Cc: [email protected]
>> ---
>> drivers/mfd/arizona-core.c | 21 +++++++++++----------
>> drivers/mfd/arizona-i2c.c | 2 +-
>> drivers/mfd/arizona-spi.c | 2 +-
>> 3 files changed, 13 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
>> index cbf1dd90b70d..c1acc9521f83 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)
>
> __maybe_unused?

No need. The symbols are always referenced.

>> {
>> int ret;
>> @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device
>> *dev)
>
> __maybe_unused?
>
>>  return 0;
>> }
>> -#endif
>> -#ifdef CONFIG_PM_SLEEP
>> static int arizona_suspend(struct device *dev)
>
> __maybe_unused?
>
>> {
>> struct arizona *arizona = dev_get_drvdata(dev);
>> @@ -784,17 +781,21 @@ static int arizona_resume(struct device *dev)
>
> __maybe_unused?
>
>>  return 0;
>> }
>> -#endif
>> +#ifndef CONFIG_PM
>> +static __maybe_unused
>> +#endif
>
> No need to ifdef a __maybe_unused.

Yes, it is needed, because the symbol is conditionally exported. If
!CONFIG_PM, we want the compiler to discard the dev_pm_ops and all the
callbacks, hence the "static __maybe_unused". That's the same trick
used in _EXPORT_DEV_PM_OPS().

(note that this patch is broken as it does not change the struct name,
in the !PM case, which causes conflicts with the .h. I'll fix in v2)

>> 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)
>> + 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)
>> };
>> +#ifdef CONFIG_PM
>> EXPORT_SYMBOL_GPL(arizona_pm_ops);
>> +#endif
>
> This ifdeffing is ugly. Why must the structure only be exported if
> CONFIG_PM is set?

So that all the PM code is garbage-collected by the compiler if
!CONFIG_PM.

Ideally I would use something like EXPORT_SIMPLE_DEV_PM_OPS() which
would make the patch much cleaner, but it doesn't support noirq
callbacks - and that's why I suggested in the cover letter that maybe a
new PM macro can be added if this patch is deemed too messy.

Cheers,
-Paul

>>  #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),
>> },


2022-08-08 10:48:24

by Richard Fitzgerald

[permalink] [raw]
Subject: Re: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions

On 08/08/2022 11:06, Paul Cercueil wrote:
> Hi Richard,
>
> Le lun., août 8 2022 at 10:53:54 +0100, Richard Fitzgerald
> <[email protected]> a écrit :
>> On 07/08/2022 15:52, Paul Cercueil wrote:
>>> Only export the arizona_pm_ops if CONFIG_PM is set, but leave the
>>> suspend/resume functions (and related code) outside #ifdef guards.
>>>
>>> If CONFIG_PM is not set, the arizona_pm_ops will be defined as
>>> "static __maybe_unused", and the structure plus all the callbacks will
>>> be automatically dropped by the compiler.
>>>
>>> The advantage is then that these functions are now always compiled
>>> independently of any Kconfig option, and thanks to that bugs and
>>> regressions are easier to catch.
>>>
>>> Signed-off-by: Paul Cercueil <[email protected]>
>>> Cc: [email protected]
>>> ---
>>>   drivers/mfd/arizona-core.c | 21 +++++++++++----------
>>>   drivers/mfd/arizona-i2c.c  |  2 +-
>>>   drivers/mfd/arizona-spi.c  |  2 +-
>>>   3 files changed, 13 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
>>> index cbf1dd90b70d..c1acc9521f83 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)
>>
>> __maybe_unused?
>
> No need. The symbols are always referenced.
>
>>>   {
>>>       int ret;
>>> @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device
>>> *dev)
>>
>> __maybe_unused?
>>
>>>         return 0;
>>>   }
>>> -#endif
>>>   -#ifdef CONFIG_PM_SLEEP
>>>   static int arizona_suspend(struct device *dev)
>>
>> __maybe_unused?
>>
>>>   {
>>>       struct arizona *arizona = dev_get_drvdata(dev);
>>> @@ -784,17 +781,21 @@ static int arizona_resume(struct device *dev)
>>
>> __maybe_unused?
>>
>>>         return 0;
>>>   }
>>> -#endif
>>>   +#ifndef CONFIG_PM
>>> +static __maybe_unused
>>> +#endif
>>
>> No need to ifdef a __maybe_unused.
>
> Yes, it is needed, because the symbol is conditionally exported. If

Why conditionally export it?

> !CONFIG_PM, we want the compiler to discard the dev_pm_ops
and all the
> callbacks, hence the "static __maybe_unused". That's the same trick used > in _EXPORT_DEV_PM_OPS().
>
> (note that this patch is broken as it does not change the struct name,
> in the !PM case, which causes conflicts with the .h. I'll fix in v2)
>
>>>   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)
>>> +    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)
>>>   };
>>> +#ifdef CONFIG_PM
>>>   EXPORT_SYMBOL_GPL(arizona_pm_ops);
>>> +#endif
>>
>> This ifdeffing is ugly. Why must the structure only be exported if
>> CONFIG_PM is set?
>
> So that all the PM code is garbage-collected by the compiler if !CONFIG_PM.

The functions will be dropped if they are not referenced. That doesn't
answer why the struct must not be exported.

What is the aim of omitting the struct export?

>
> Ideally I would use something like EXPORT_SIMPLE_DEV_PM_OPS() which
> would make the patch much cleaner, but it doesn't support noirq
> callbacks - and that's why I suggested in the cover letter that maybe a
> new PM macro can be added if this patch is deemed too messy.
>
> Cheers,
> -Paul
>
>>>     #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),
>>>       },
>
>

2022-08-08 11:06:03

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions



Le lun., ao?t 8 2022 at 11:43:31 +0100, Richard Fitzgerald
<[email protected]> a ?crit :
> On 08/08/2022 11:06, Paul Cercueil wrote:
>> Hi Richard,
>>
>> Le lun., ao?t 8 2022 at 10:53:54 +0100, Richard Fitzgerald
>> <[email protected]> a ?crit :
>>> On 07/08/2022 15:52, Paul Cercueil wrote:
>>>> Only export the arizona_pm_ops if CONFIG_PM is set, but leave the
>>>> suspend/resume functions (and related code) outside #ifdef guards.
>>>>
>>>> If CONFIG_PM is not set, the arizona_pm_ops will be defined as
>>>> "static __maybe_unused", and the structure plus all the callbacks
>>>> will
>>>> be automatically dropped by the compiler.
>>>>
>>>> The advantage is then that these functions are now always compiled
>>>> independently of any Kconfig option, and thanks to that bugs and
>>>> regressions are easier to catch.
>>>>
>>>> Signed-off-by: Paul Cercueil <[email protected]>
>>>> Cc: [email protected]
>>>> ---
>>>> drivers/mfd/arizona-core.c | 21 +++++++++++----------
>>>> drivers/mfd/arizona-i2c.c | 2 +-
>>>> drivers/mfd/arizona-spi.c | 2 +-
>>>> 3 files changed, 13 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/drivers/mfd/arizona-core.c
>>>> b/drivers/mfd/arizona-core.c
>>>> index cbf1dd90b70d..c1acc9521f83 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)
>>>
>>> __maybe_unused?
>>
>> No need. The symbols are always referenced.
>>
>>>> {
>>>> int ret;
>>>> @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct
>>>> device *dev)
>>>
>>> __maybe_unused?
>>>
>>>>  return 0;
>>>> }
>>>> -#endif
>>>> -#ifdef CONFIG_PM_SLEEP
>>>> static int arizona_suspend(struct device *dev)
>>>
>>> __maybe_unused?
>>>
>>>> {
>>>> struct arizona *arizona = dev_get_drvdata(dev);
>>>> @@ -784,17 +781,21 @@ static int arizona_resume(struct device *dev)
>>>
>>> __maybe_unused?
>>>
>>>>  return 0;
>>>> }
>>>> -#endif
>>>> +#ifndef CONFIG_PM
>>>> +static __maybe_unused
>>>> +#endif
>>>
>>> No need to ifdef a __maybe_unused.
>>
>> Yes, it is needed, because the symbol is conditionally exported. If
>
> Why conditionally export it?
>
>> !CONFIG_PM, we want the compiler to discard the dev_pm_ops
> and all the
>> callbacks, hence the "static __maybe_unused". That's the same trick
>> used > in _EXPORT_DEV_PM_OPS().
>>
>> (note that this patch is broken as it does not change the struct
>> name, in the !PM case, which causes conflicts with the .h. I'll fix
>> in v2)
>>
>>>> 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)
>>>> + 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)
>>>> };
>>>> +#ifdef CONFIG_PM
>>>> EXPORT_SYMBOL_GPL(arizona_pm_ops);
>>>> +#endif
>>>
>>> This ifdeffing is ugly. Why must the structure only be exported if
>>> CONFIG_PM is set?
>>
>> So that all the PM code is garbage-collected by the compiler if
>> !CONFIG_PM.
>
> The functions will be dropped if they are not referenced. That doesn't
> answer why the struct must not be exported.
>
> What is the aim of omitting the struct export?

The functions are always referenced by the dev_pm_ops structure.
Omitting the struct export means that the struct can now be a "static
__maybe_unused" symbol in the !CONFIG_PM case, and everything related
to PM will be automatically removed by the compiler.

Otherwise, the symbol is exported as usual. The symbol being
conditionally exported is not a problem - the struct is always
referenced (as it should be) using the pm_sleep_ptr() or pm_ptr()
macros.

This is basically what EXPORT_SIMPLE_DEV_PM_OPS() does by the way.

Cheers,
-Paul

>>
>> Ideally I would use something like EXPORT_SIMPLE_DEV_PM_OPS() which
>> would make the patch much cleaner, but it doesn't support noirq
>> callbacks - and that's why I suggested in the cover letter that
>> maybe a new PM macro can be added if this patch is deemed too messy.
>>
>> Cheers,
>> -Paul
>>
>>>>  #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),
>>>> },
>>
>>


2022-08-08 12:08:36

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 11/28] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions

On Sun, Aug 7, 2022 at 5:58 PM Paul Cercueil <[email protected]> wrote:
> Le dim., août 7 2022 at 17:50:32 +0200, Andy Shevchenko
> <[email protected]> a écrit :
> > On Sun, Aug 7, 2022 at 4:53 PM Paul Cercueil <[email protected]>
> > wrote:

...

> >> The advantage is then that these functions are now always compiled
> >
> > is that
>
> I think that what I wrote is proper English.

Okay, Google just shows 100x times less the above form in comparison
to one w/o "then".

> >> independently of any Kconfig option, and thanks to that bugs and
> >> regressions are easier to catch.

...

> > 3. The PMIC core actually is Crystal Cove driver and I have a pending
> > series for that and I guess you know about it. Have you seen what have
> > been done there?
>
> No, I didn't know. I guess Lee can skip my patch 11/28 then.

I probably memorized the name of a guy, who sent a patch against this
driver a week ago or so, wrongly. Sorry for that.

--
With Best Regards,
Andy Shevchenko

2022-08-08 12:54:01

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 11/28] mfd: intel_soc_pmic: Remove #ifdef guards for PM related functions

On Mon, 08 Aug 2022, Andy Shevchenko wrote:

> On Sun, Aug 7, 2022 at 5:58 PM Paul Cercueil <[email protected]> wrote:
> > Le dim., août 7 2022 at 17:50:32 +0200, Andy Shevchenko
> > <[email protected]> a écrit :
> > > On Sun, Aug 7, 2022 at 4:53 PM Paul Cercueil <[email protected]>
> > > wrote:
>
> ...
>
> > >> The advantage is then that these functions are now always compiled
> > >
> > > is that
> >
> > I think that what I wrote is proper English.
>
> Okay, Google just shows 100x times less the above form in comparison
> to one w/o "then".

> The advantage is then that these functions are now always compile
> independently of any Kconfig option, and thanks to that bugs and
> regressions are easier to catch.

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

> > >> independently of any Kconfig option, and thanks to that bugs and
> > >> regressions are easier to catch.
>
> ...
>
> > > 3. The PMIC core actually is Crystal Cove driver and I have a pending
> > > series for that and I guess you know about it. Have you seen what have
> > > been done there?
> >
> > No, I didn't know. I guess Lee can skip my patch 11/28 then.
>
> I probably memorized the name of a guy, who sent a patch against this
> driver a week ago or so, wrongly. Sorry for that.
>

--
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

2022-08-08 14:11:34

by Richard Fitzgerald

[permalink] [raw]
Subject: Re: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions

On 08/08/2022 12:01, Paul Cercueil wrote:
>
>
> Le lun., août 8 2022 at 11:43:31 +0100, Richard Fitzgerald
> <[email protected]> a écrit :
>> On 08/08/2022 11:06, Paul Cercueil wrote:
>>> Hi Richard,
>>>
>>> Le lun., août 8 2022 at 10:53:54 +0100, Richard Fitzgerald
>>> <[email protected]> a écrit :
>>>> On 07/08/2022 15:52, Paul Cercueil wrote:
>>>>> Only export the arizona_pm_ops if CONFIG_PM is set, but leave the
>>>>> suspend/resume functions (and related code) outside #ifdef guards.
>>>>>
>>>>> If CONFIG_PM is not set, the arizona_pm_ops will be defined as
>>>>> "static __maybe_unused", and the structure plus all the callbacks will
>>>>> be automatically dropped by the compiler.
>>>>>
>>>>> The advantage is then that these functions are now always compiled
>>>>> independently of any Kconfig option, and thanks to that bugs and
>>>>> regressions are easier to catch.
>>>>>
>>>>> Signed-off-by: Paul Cercueil <[email protected]>
>>>>> Cc: [email protected]
>>>>> ---
>>>>>   drivers/mfd/arizona-core.c | 21 +++++++++++----------
>>>>>   drivers/mfd/arizona-i2c.c  |  2 +-
>>>>>   drivers/mfd/arizona-spi.c  |  2 +-
>>>>>   3 files changed, 13 insertions(+), 12 deletions(-)
>>>>>
>>>>> diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
>>>>> index cbf1dd90b70d..c1acc9521f83 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)
>>>>
>>>> __maybe_unused?
>>>
>>> No need. The symbols are always referenced.
>>>
>>>>>   {
>>>>>       int ret;
>>>>> @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct
>>>>> device *dev)
>>>>
>>>> __maybe_unused?
>>>>
>>>>>         return 0;
>>>>>   }
>>>>> -#endif
>>>>>   -#ifdef CONFIG_PM_SLEEP
>>>>>   static int arizona_suspend(struct device *dev)
>>>>
>>>> __maybe_unused?
>>>>
>>>>>   {
>>>>>       struct arizona *arizona = dev_get_drvdata(dev);
>>>>> @@ -784,17 +781,21 @@ static int arizona_resume(struct device *dev)
>>>>
>>>> __maybe_unused?
>>>>
>>>>>         return 0;
>>>>>   }
>>>>> -#endif
>>>>>   +#ifndef CONFIG_PM
>>>>> +static __maybe_unused
>>>>> +#endif
>>>>
>>>> No need to ifdef a __maybe_unused.
>>>
>>> Yes, it is needed, because the symbol is conditionally exported. If
>>
>> Why conditionally export it?
>>
>>> !CONFIG_PM, we want the compiler to discard the dev_pm_ops
>>  and all the
>>> callbacks, hence the "static __maybe_unused". That's the same trick
>>> used > in _EXPORT_DEV_PM_OPS().
>>>
>>> (note that this patch is broken as it does not change the struct
>>> name, in the !PM case, which causes conflicts with the .h. I'll fix
>>> in v2)
>>>
>>>>>   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)
>>>>> +    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)
>>>>>   };
>>>>> +#ifdef CONFIG_PM
>>>>>   EXPORT_SYMBOL_GPL(arizona_pm_ops);
>>>>> +#endif
>>>>
>>>> This ifdeffing is ugly. Why must the structure only be exported if
>>>> CONFIG_PM is set?
>>>
>>> So that all the PM code is garbage-collected by the compiler if
>>> !CONFIG_PM.
>>
>> The functions will be dropped if they are not referenced. That doesn't
>> answer why the struct must not be exported.
>>
>> What is the aim of omitting the struct export?
>
> The functions are always referenced by the dev_pm_ops structure.
> Omitting the struct export means that the struct can now be a "static
> __maybe_unused" symbol in the !CONFIG_PM case, and everything related to
> PM will be automatically removed by the compiler.
>
> Otherwise, the symbol is exported as usual. The symbol being
> conditionally exported is not a problem - the struct is always
> referenced (as it should be) using the pm_sleep_ptr() or pm_ptr() macros.
>
> This is basically what EXPORT_SIMPLE_DEV_PM_OPS() does by the way.
>
> Cheers,
> -Paul
>
Ok,
Well ultimately it's up to Lee as the maintainer of the MFD subsystem.

But the open-coded #ifdef around "static __maybe_unused" is ugly, so if
this is going to be a common pattern a new macro would be nice.

>>>
>>> Ideally I would use something like EXPORT_SIMPLE_DEV_PM_OPS() which
>>> would make the patch much cleaner, but it doesn't support noirq
>>> callbacks - and that's why I suggested in the cover letter that
>>> maybe a new PM macro can be added if this patch is deemed too messy.
>>>
>>> Cheers,
>>> -Paul
>>>
>>>>>     #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),
>>>>>       },
>>>
>>>
>
>

2022-08-08 15:18:14

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 20/28] mfd: arizona: Remove #ifdef guards for PM related functions

On Mon, 08 Aug 2022, Richard Fitzgerald wrote:

> On 08/08/2022 12:01, Paul Cercueil wrote:
> >
> >
> > Le lun., ao?t 8 2022 at 11:43:31 +0100, Richard Fitzgerald
> > <[email protected]> a ?crit :
> > > On 08/08/2022 11:06, Paul Cercueil wrote:
> > > > Hi Richard,
> > > >
> > > > Le lun., ao?t 8 2022 at 10:53:54 +0100, Richard Fitzgerald
> > > > <[email protected]> a ?crit :
> > > > > On 07/08/2022 15:52, Paul Cercueil wrote:
> > > > > > Only export the arizona_pm_ops if CONFIG_PM is set, but leave the
> > > > > > suspend/resume functions (and related code) outside #ifdef guards.
> > > > > >
> > > > > > If CONFIG_PM is not set, the arizona_pm_ops will be defined as
> > > > > > "static __maybe_unused", and the structure plus all the callbacks will
> > > > > > be automatically dropped by the compiler.
> > > > > >
> > > > > > The advantage is then that these functions are now always compiled
> > > > > > independently of any Kconfig option, and thanks to that bugs and
> > > > > > regressions are easier to catch.
> > > > > >
> > > > > > Signed-off-by: Paul Cercueil <[email protected]>
> > > > > > Cc: [email protected]
> > > > > > ---
> > > > > > ? drivers/mfd/arizona-core.c | 21 +++++++++++----------
> > > > > > ? drivers/mfd/arizona-i2c.c? |? 2 +-
> > > > > > ? drivers/mfd/arizona-spi.c? |? 2 +-
> > > > > > ? 3 files changed, 13 insertions(+), 12 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
> > > > > > index cbf1dd90b70d..c1acc9521f83 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)
> > > > >
> > > > > __maybe_unused?
> > > >
> > > > No need. The symbols are always referenced.
> > > >
> > > > > > ? {
> > > > > > ????? int ret;
> > > > > > @@ -742,9 +741,7 @@ static int
> > > > > > arizona_runtime_suspend(struct device *dev)
> > > > >
> > > > > __maybe_unused?
> > > > >
> > > > > > ? ????? return 0;
> > > > > > ? }
> > > > > > -#endif
> > > > > > ? -#ifdef CONFIG_PM_SLEEP
> > > > > > ? static int arizona_suspend(struct device *dev)
> > > > >
> > > > > __maybe_unused?
> > > > >
> > > > > > ? {
> > > > > > ????? struct arizona *arizona = dev_get_drvdata(dev);
> > > > > > @@ -784,17 +781,21 @@ static int arizona_resume(struct device *dev)
> > > > >
> > > > > __maybe_unused?
> > > > >
> > > > > > ? ????? return 0;
> > > > > > ? }
> > > > > > -#endif
> > > > > > ? +#ifndef CONFIG_PM
> > > > > > +static __maybe_unused
> > > > > > +#endif
> > > > >
> > > > > No need to ifdef a __maybe_unused.
> > > >
> > > > Yes, it is needed, because the symbol is conditionally exported. If
> > >
> > > Why conditionally export it?
> > >
> > > > !CONFIG_PM, we want the compiler to discard the dev_pm_ops
> > > ?and all the
> > > > callbacks, hence the "static __maybe_unused". That's the same
> > > > trick used > in _EXPORT_DEV_PM_OPS().
> > > >
> > > > (note that this patch is broken as it does not change the struct
> > > > name, in the !PM case, which causes conflicts with the .h. I'll
> > > > fix in v2)
> > > >
> > > > > > ? 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)
> > > > > > +??? 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)
> > > > > > ? };
> > > > > > +#ifdef CONFIG_PM
> > > > > > ? EXPORT_SYMBOL_GPL(arizona_pm_ops);
> > > > > > +#endif
> > > > >
> > > > > This ifdeffing is ugly. Why must the structure only be exported if
> > > > > CONFIG_PM is set?
> > > >
> > > > So that all the PM code is garbage-collected by the compiler if
> > > > !CONFIG_PM.
> > >
> > > The functions will be dropped if they are not referenced. That doesn't
> > > answer why the struct must not be exported.
> > >
> > > What is the aim of omitting the struct export?
> >
> > The functions are always referenced by the dev_pm_ops structure.
> > Omitting the struct export means that the struct can now be a "static
> > __maybe_unused" symbol in the !CONFIG_PM case, and everything related to
> > PM will be automatically removed by the compiler.
> >
> > Otherwise, the symbol is exported as usual. The symbol being
> > conditionally exported is not a problem - the struct is always
> > referenced (as it should be) using the pm_sleep_ptr() or pm_ptr()
> > macros.
> >
> > This is basically what EXPORT_SIMPLE_DEV_PM_OPS() does by the way.
> >
> > Cheers,
> > -Paul
> >
> Ok,
> Well ultimately it's up to Lee as the maintainer of the MFD subsystem.
>
> But the open-coded #ifdef around "static __maybe_unused" is ugly, so if
> this is going to be a common pattern a new macro would be nice.

I like to avoid #ifery in C files wherever possible.

--
DEPRECATED: Please use [email protected]

2022-08-09 15:57:13

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

On 09/08/2022 18:33, Lee Jones wrote:
> On Mon, 08 Aug 2022, Krzysztof Kozlowski wrote:
>
>> On 07/08/2022 17:52, 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.
>>>
>>> The advantage is then that these functions are now always compiled
>>> independently of any Kconfig option, and thanks to that bugs and
>>> regressions are easier to catch.
>>>
>>> Signed-off-by: Paul Cercueil <[email protected]>
>>> Cc: Krzysztof Kozlowski <[email protected]>
>>> Cc: Bartlomiej Zolnierkiewicz <[email protected]>
>>
>> The address does not work. Please don't add it to commit log.
>>
>>> Cc: [email protected]
>>
>> This is also not really needed in commit log... it's just a mailing list...
>>
>> I actually never understood why people want to add to commit log, so to
>> something which will last 10 years, Cc-ing other folks, instead of
>> adding such tags after '---'. Imagine 10 years from now:
>>
>> 1. What's the point to be cced on this patch after 10 years instead of
>> using maintainers file (the one in 10 years)? Why Cc-ing me in 10 years?
>> If I am a maintainer of this driver in that time, I will be C-ced based
>> on maintainers file. If I am not a maintainer in 10 years, why the heck
>> cc-ing me based on some 10-year old commit? Just because I was a
>> maintainer once, like 10 years ago?
>
> Why would that happen?
>
> These tags are only used during initial submission.

No, the tags are used in any other resends, backports etc while
traveling through different trees. I think only stable-backports do not
use them, but all other gfp+git-send will follow the tags.

>
>> 2. Or why cc-ing such people when backporting to stable?
>
> That doesn't happen either.

Indeed, stable does not use these Cc.

>
>> It's quite a lot of unnecessary emails which many of us won't actually
>> handle later...
>>
>> I sincerely admit I was once also adding such Cc-tags. But that time my
>> employer was counting lines-of-patch (including commit log)... crazy, right?
>
> Nothing wrong with adding these tags IMHO. It's what they're for.
>
> I use them when I'm maintaining a large amount of out-of-tree, but
> to-be-upstreamed patches over several versions. Re-applying the
> recipients list can become pretty labour-some after several
> iterations.

You can do it still while keeping the tags after ---. Only patch-related
workflows strip such tags. If you cherry-pick, rebase, merge, you always
get the content of ---.

The same as typical changelog (not cover letter but one in the patch) -
you keep it after --- and it does not disappear.

>
> Adding them under the '---' doesn't work when the purpose of them is
> to keep the recipients list in Git history.

This I understand, what I did not understand (and you did not explain)
is what would be the purpose to keep them in Git history. What is the
point to have them in commit log of 10 year old commit?

Best regards,
Krzysztof

2022-08-09 16:12:36

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

On Mon, 08 Aug 2022, Krzysztof Kozlowski wrote:

> On 07/08/2022 17:52, 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.
> >
> > The advantage is then that these functions are now always compiled
> > independently of any Kconfig option, and thanks to that bugs and
> > regressions are easier to catch.
> >
> > Signed-off-by: Paul Cercueil <[email protected]>
> > Cc: Krzysztof Kozlowski <[email protected]>
> > Cc: Bartlomiej Zolnierkiewicz <[email protected]>
>
> The address does not work. Please don't add it to commit log.
>
> > Cc: [email protected]
>
> This is also not really needed in commit log... it's just a mailing list...
>
> I actually never understood why people want to add to commit log, so to
> something which will last 10 years, Cc-ing other folks, instead of
> adding such tags after '---'. Imagine 10 years from now:
>
> 1. What's the point to be cced on this patch after 10 years instead of
> using maintainers file (the one in 10 years)? Why Cc-ing me in 10 years?
> If I am a maintainer of this driver in that time, I will be C-ced based
> on maintainers file. If I am not a maintainer in 10 years, why the heck
> cc-ing me based on some 10-year old commit? Just because I was a
> maintainer once, like 10 years ago?

Why would that happen?

These tags are only used during initial submission.

> 2. Or why cc-ing such people when backporting to stable?

That doesn't happen either.

> It's quite a lot of unnecessary emails which many of us won't actually
> handle later...
>
> I sincerely admit I was once also adding such Cc-tags. But that time my
> employer was counting lines-of-patch (including commit log)... crazy, right?

Nothing wrong with adding these tags IMHO. It's what they're for.

I use them when I'm maintaining a large amount of out-of-tree, but
to-be-upstreamed patches over several versions. Re-applying the
recipients list can become pretty labour-some after several
iterations.

Adding them under the '---' doesn't work when the purpose of them is
to keep the recipients list in Git history.

--
DEPRECATED: Please use [email protected]

2022-08-09 17:56:19

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 13/28] mfd: sec: Remove #ifdef guards for PM related functions

On Tue, 09 Aug 2022, Krzysztof Kozlowski wrote:

> On 09/08/2022 18:33, Lee Jones wrote:
> > On Mon, 08 Aug 2022, Krzysztof Kozlowski wrote:
> >
> >> On 07/08/2022 17:52, 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.
> >>>
> >>> The advantage is then that these functions are now always compiled
> >>> independently of any Kconfig option, and thanks to that bugs and
> >>> regressions are easier to catch.
> >>>
> >>> Signed-off-by: Paul Cercueil <[email protected]>
> >>> Cc: Krzysztof Kozlowski <[email protected]>
> >>> Cc: Bartlomiej Zolnierkiewicz <[email protected]>
> >>
> >> The address does not work. Please don't add it to commit log.
> >>
> >>> Cc: [email protected]
> >>
> >> This is also not really needed in commit log... it's just a mailing list...
> >>
> >> I actually never understood why people want to add to commit log, so to
> >> something which will last 10 years, Cc-ing other folks, instead of
> >> adding such tags after '---'. Imagine 10 years from now:
> >>
> >> 1. What's the point to be cced on this patch after 10 years instead of
> >> using maintainers file (the one in 10 years)? Why Cc-ing me in 10 years?
> >> If I am a maintainer of this driver in that time, I will be C-ced based
> >> on maintainers file. If I am not a maintainer in 10 years, why the heck
> >> cc-ing me based on some 10-year old commit? Just because I was a
> >> maintainer once, like 10 years ago?
> >
> > Why would that happen?
> >
> > These tags are only used during initial submission.
>
> No, the tags are used in any other resends, backports etc while
> traveling through different trees. I think only stable-backports do not
> use them, but all other gfp+git-send will follow the tags.
>
> >
> >> 2. Or why cc-ing such people when backporting to stable?
> >
> > That doesn't happen either.
>
> Indeed, stable does not use these Cc.
>
> >> It's quite a lot of unnecessary emails which many of us won't actually
> >> handle later...
> >>
> >> I sincerely admit I was once also adding such Cc-tags. But that time my
> >> employer was counting lines-of-patch (including commit log)... crazy, right?
> >
> > Nothing wrong with adding these tags IMHO. It's what they're for.
> >
> > I use them when I'm maintaining a large amount of out-of-tree, but
> > to-be-upstreamed patches over several versions. Re-applying the
> > recipients list can become pretty labour-some after several
> > iterations.
>
> You can do it still while keeping the tags after ---. Only patch-related
> workflows strip such tags. If you cherry-pick, rebase, merge, you always
> get the content of ---.
>
> The same as typical changelog (not cover letter but one in the patch) -
> you keep it after --- and it does not disappear.

I'll have to try this next time.

> > Adding them under the '---' doesn't work when the purpose of them is
> > to keep the recipients list in Git history.
>
> This I understand, what I did not understand (and you did not explain)
> is what would be the purpose to keep them in Git history. What is the
> point to have them in commit log of 10 year old commit?

Here is a documented use for the tags:

"If a person has had the opportunity to comment on a patch, but has not
provided such comments, you may optionally add a ``Cc:`` tag to the patch."

Thus, when a recipient replies with a *-by tag, I strip out the
corresponding Cc: line.

Obviously this does not apply to mailing lists.

--
DEPRECATED: Please use [email protected]