These 3 patches update the pm_ops for I2C/SPI so that they are only built
and exported if they are needed.
Richard Fitzgerald (3):
ASoC: cs35l56: Use pm_ptr()
ASoC: cs35l56: Use new export macro for dev_pm_ops
ASoC: cs35l56: Omit cs35l56_pm_ops_i2c_spi if I2C/SPI not enabled
sound/soc/codecs/cs35l56-i2c.c | 2 +-
sound/soc/codecs/cs35l56-sdw.c | 2 +-
sound/soc/codecs/cs35l56-spi.c | 2 +-
sound/soc/codecs/cs35l56.c | 5 +++--
4 files changed, 6 insertions(+), 5 deletions(-)
--
2.30.2
Use pm_ptr() when setting the pointer to the dev_pm_ops so that it
will be NULL if CONFIG_PM is disabled. This allows the dev_pm_ops to be
compiled out in that case.
Signed-off-by: Richard Fitzgerald <[email protected]>
---
sound/soc/codecs/cs35l56-i2c.c | 2 +-
sound/soc/codecs/cs35l56-sdw.c | 2 +-
sound/soc/codecs/cs35l56-spi.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/cs35l56-i2c.c b/sound/soc/codecs/cs35l56-i2c.c
index d10e0e2380e8..9e5670b09af6 100644
--- a/sound/soc/codecs/cs35l56-i2c.c
+++ b/sound/soc/codecs/cs35l56-i2c.c
@@ -72,7 +72,7 @@ MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
static struct i2c_driver cs35l56_i2c_driver = {
.driver = {
.name = "cs35l56",
- .pm = &cs35l56_pm_ops_i2c_spi,
+ .pm = pm_ptr(&cs35l56_pm_ops_i2c_spi),
.acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
},
.id_table = cs35l56_id_i2c,
diff --git a/sound/soc/codecs/cs35l56-sdw.c b/sound/soc/codecs/cs35l56-sdw.c
index b433266b7844..ab960a1c171e 100644
--- a/sound/soc/codecs/cs35l56-sdw.c
+++ b/sound/soc/codecs/cs35l56-sdw.c
@@ -550,7 +550,7 @@ MODULE_DEVICE_TABLE(sdw, cs35l56_sdw_id);
static struct sdw_driver cs35l56_sdw_driver = {
.driver = {
.name = "cs35l56",
- .pm = &cs35l56_sdw_pm,
+ .pm = pm_ptr(&cs35l56_sdw_pm),
},
.probe = cs35l56_sdw_probe,
.remove = cs35l56_sdw_remove,
diff --git a/sound/soc/codecs/cs35l56-spi.c b/sound/soc/codecs/cs35l56-spi.c
index 9962703915e1..768ffe8213dc 100644
--- a/sound/soc/codecs/cs35l56-spi.c
+++ b/sound/soc/codecs/cs35l56-spi.c
@@ -70,7 +70,7 @@ MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
static struct spi_driver cs35l56_spi_driver = {
.driver = {
.name = "cs35l56",
- .pm = &cs35l56_pm_ops_i2c_spi,
+ .pm = pm_ptr(&cs35l56_pm_ops_i2c_spi),
.acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
},
.id_table = cs35l56_id_spi,
--
2.30.2
pm.h now has macros to create and export the dev_pm_ops struct
only if CONFIG_PM is enabled.
Signed-off-by: Richard Fitzgerald <[email protected]>
---
sound/soc/codecs/cs35l56.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index e6e366333a47..b7d3f768635b 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -1229,13 +1229,12 @@ void cs35l56_remove(struct cs35l56_private *cs35l56)
}
EXPORT_SYMBOL_NS_GPL(cs35l56_remove, SND_SOC_CS35L56_CORE);
-const struct dev_pm_ops cs35l56_pm_ops_i2c_spi = {
+EXPORT_NS_GPL_DEV_PM_OPS(cs35l56_pm_ops_i2c_spi, SND_SOC_CS35L56_CORE) = {
SET_RUNTIME_PM_OPS(cs35l56_runtime_suspend_i2c_spi, cs35l56_runtime_resume_i2c_spi, NULL)
SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend, cs35l56_system_resume)
LATE_SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend_late, cs35l56_system_resume_early)
NOIRQ_SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend_no_irq, cs35l56_system_resume_no_irq)
};
-EXPORT_SYMBOL_NS_GPL(cs35l56_pm_ops_i2c_spi, SND_SOC_CS35L56_CORE);
MODULE_DESCRIPTION("ASoC CS35L56 driver");
MODULE_IMPORT_NS(SND_SOC_CS35L56_SHARED);
--
2.30.2
The cs35l56_pm_ops_i2c_spi struct is only needed if either the
I2C or SPI modules are selected for building. Otherwise it would
be unused bytes, so in that case omit it.
Signed-off-by: Richard Fitzgerald <[email protected]>
---
sound/soc/codecs/cs35l56.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index b7d3f768635b..232af4e8faa4 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -1229,12 +1229,14 @@ void cs35l56_remove(struct cs35l56_private *cs35l56)
}
EXPORT_SYMBOL_NS_GPL(cs35l56_remove, SND_SOC_CS35L56_CORE);
+#if IS_ENABLED(CONFIG_SND_SOC_CS35L56_I2C) || IS_ENABLED(CONFIG_SND_SOC_CS35L56_SPI)
EXPORT_NS_GPL_DEV_PM_OPS(cs35l56_pm_ops_i2c_spi, SND_SOC_CS35L56_CORE) = {
SET_RUNTIME_PM_OPS(cs35l56_runtime_suspend_i2c_spi, cs35l56_runtime_resume_i2c_spi, NULL)
SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend, cs35l56_system_resume)
LATE_SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend_late, cs35l56_system_resume_early)
NOIRQ_SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend_no_irq, cs35l56_system_resume_no_irq)
};
+#endif
MODULE_DESCRIPTION("ASoC CS35L56 driver");
MODULE_IMPORT_NS(SND_SOC_CS35L56_SHARED);
--
2.30.2
On Thu, 14 Sep 2023 16:09:15 +0100, Richard Fitzgerald wrote:
> These 3 patches update the pm_ops for I2C/SPI so that they are only built
> and exported if they are needed.
>
> Richard Fitzgerald (3):
> ASoC: cs35l56: Use pm_ptr()
> ASoC: cs35l56: Use new export macro for dev_pm_ops
> ASoC: cs35l56: Omit cs35l56_pm_ops_i2c_spi if I2C/SPI not enabled
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: cs35l56: Use pm_ptr()
commit: 3d3a86679541044a65ea23175cb95206921c8fe2
[2/3] ASoC: cs35l56: Use new export macro for dev_pm_ops
commit: 6399eb58254b98bbe42c9d14e07c50e1c3d9f8cd
[3/3] ASoC: cs35l56: Omit cs35l56_pm_ops_i2c_spi if I2C/SPI not enabled
commit: 01e76ee227564008d71ddce6e43132b36d2d2252
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark