[PATCH] ASoC: cs35l56: Use RUNTIME_PM_OPS() instead of SET_RUNTIME_PM_OPS()

From: Richard Fitzgerald

Date: Fri Dec 04 2026 - 08:08:48 EST


Use the newer RUNTIME_PM_OPS() macro so we can remove all the
__maybe_unused attributes on the functions.

Also remove the #if conditional around the cs35l56_pm_ops_i2c_spi
instantiation, because this was requiring a couple of the __maybe_unused.
The conditional was to allow dropping the PM functions for I2C/SPI if the
driver was built without I2C/SPI support. But the size of code and data
removed by the #if was trivial, and standard downstream distro kernels
include the I2C/SPI support.

Signed-off-by: Richard Fitzgerald <rf@xxxxxxxxxxxxxxxxxxxxx>
---
sound/soc/codecs/cs35l56-sdw.c | 10 +++++-----
sound/soc/codecs/cs35l56.c | 8 +++-----
2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/cs35l56-sdw.c b/sound/soc/codecs/cs35l56-sdw.c
index 770a5fcd843f..f53797f89479 100644
--- a/sound/soc/codecs/cs35l56-sdw.c
+++ b/sound/soc/codecs/cs35l56-sdw.c
@@ -337,7 +337,7 @@ static const struct sdw_slave_ops cs35l56_sdw_ops = {
.update_status = cs35l56_sdw_update_status,
};

-static int __maybe_unused cs35l56_sdw_handle_unattach(struct cs35l56_private *cs35l56)
+static int cs35l56_sdw_handle_unattach(struct cs35l56_private *cs35l56)
{
struct sdw_slave *peripheral = cs35l56->sdw_peripheral;
int ret;
@@ -358,7 +358,7 @@ static int __maybe_unused cs35l56_sdw_handle_unattach(struct cs35l56_private *cs
return 0;
}

-static int __maybe_unused cs35l56_sdw_runtime_suspend(struct device *dev)
+static int cs35l56_sdw_runtime_suspend(struct device *dev)
{
struct cs35l56_private *cs35l56 = dev_get_drvdata(dev);

@@ -368,7 +368,7 @@ static int __maybe_unused cs35l56_sdw_runtime_suspend(struct device *dev)
return cs35l56_runtime_suspend_common(&cs35l56->base);
}

-static int __maybe_unused cs35l56_sdw_runtime_resume(struct device *dev)
+static int cs35l56_sdw_runtime_resume(struct device *dev)
{
struct cs35l56_private *cs35l56 = dev_get_drvdata(dev);
int ret;
@@ -398,7 +398,7 @@ static int cs35l56_sdw_system_suspend_prepare(struct device *dev)
return 0;
}

-static int __maybe_unused cs35l56_sdw_system_suspend(struct device *dev)
+static int cs35l56_sdw_system_suspend(struct device *dev)
{
struct cs35l56_private *cs35l56 = dev_get_drvdata(dev);
int ret;
@@ -485,7 +485,7 @@ static void cs35l56_sdw_remove(struct sdw_slave *peripheral)

static const struct dev_pm_ops cs35l56_sdw_pm = {
.prepare = cs35l56_sdw_system_suspend_prepare,
- SET_RUNTIME_PM_OPS(cs35l56_sdw_runtime_suspend, cs35l56_sdw_runtime_resume, NULL)
+ RUNTIME_PM_OPS(cs35l56_sdw_runtime_suspend, cs35l56_sdw_runtime_resume, NULL)
SYSTEM_SLEEP_PM_OPS(cs35l56_sdw_system_suspend, cs35l56_system_resume)
LATE_SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend_late, cs35l56_system_resume_early)
/* NOIRQ stage not needed, SoundWire doesn't use a hard IRQ */
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 34588245a8f3..6be0e7eb23d7 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -1614,14 +1614,14 @@ static const struct snd_soc_component_driver soc_component_dev_cs35l56 = {
.suspend_bias_off = 1, /* see cs35l56_system_resume() */
};

-static int __maybe_unused cs35l56_runtime_suspend_i2c_spi(struct device *dev)
+static int cs35l56_runtime_suspend_i2c_spi(struct device *dev)
{
struct cs35l56_private *cs35l56 = dev_get_drvdata(dev);

return cs35l56_runtime_suspend_common(&cs35l56->base);
}

-static int __maybe_unused cs35l56_runtime_resume_i2c_spi(struct device *dev)
+static int cs35l56_runtime_resume_i2c_spi(struct device *dev)
{
struct cs35l56_private *cs35l56 = dev_get_drvdata(dev);

@@ -2436,14 +2436,12 @@ 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)
+ 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

static int cs35l56_reboot_notify(struct notifier_block *nb,
unsigned long action, void *data)
--
2.47.3