Skip to contentSkip to conversation

ASoC: cs35l56: Define and export I2C/SPI pm_ops only if needed

PATCH In review Richard Fitzgerald 2 participants 5 messages Sep 14, 2023 – Sep 16, 2023

Subsystems (3)
lore
Share & tools
lore

Richard Fitzgerald

author maintainer
#0 lore raw

cover ASoC: cs35l56: Define and export I2C/SPI pm_ops only if needed

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(-)
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 1/3 ASoC: cs35l56: Use pm_ptr()

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.

---
 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(-)
sound/soc/codecs/cs35l56-i2c.c +1 -1
index d10e0e2380e8..9e5670b09af6 100644
@@ -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,
sound/soc/codecs/cs35l56-sdw.c +1 -1
index b433266b7844..ab960a1c171e 100644
@@ -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,
sound/soc/codecs/cs35l56-spi.c +1 -1
index 9962703915e1..768ffe8213dc 100644
@@ -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,
Signature · 1 line
2.30.2
author maintainer
#2 lore raw

PATCH 2/3 ASoC: cs35l56: Use new export macro for dev_pm_ops

In reply to Richard Fitzgerald

pm.h now has macros to create and export the dev_pm_ops struct only if CONFIG_PM is enabled.

---
 sound/soc/codecs/cs35l56.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/cs35l56.c +1 -2
index e6e366333a47..b7d3f768635b 100644
@@ -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);
Signature · 1 line
2.30.2
author maintainer
#3 lore raw

PATCH 3/3 ASoC: cs35l56: Omit cs35l56_pm_ops_i2c_spi if I2C/SPI not enabled

In reply to Richard Fitzgerald

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.

---
 sound/soc/codecs/cs35l56.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/codecs/cs35l56.c +2 -0
index b7d3f768635b..232af4e8faa4 100644
@@ -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);
Signature · 1 line
2.30.2
maintainer
#4 lore raw
In reply to Richard Fitzgerald
Quoted 9 lines · Richard Fitzgerald

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