ALSA: PM code cleanups
Subsystems (4)
cover ALSA: PM code cleanups
This is a patch set to convert to the newer PM macros.
All systematically converted, and should be no influence on the driver behavior (except that it can save a few bytes when CONFIG_PM is disabled).
Takashi
===
Takashi Iwai (9):
ALSA: ac97: Convert to RUNTIME_PM_OPS() macro
ALSA: atmel: Convert to DEFINE_SIMPLE_DEV_PM_OPS() macro
ALSA: pcm: Convert to SYSTEM_SLEEP_PM_OPS()
ALSA: hda: Use RUNTIME_PM_OPS() and pm_ptr()
ALSA: hda-intel: Convert to RUNTIME_PM_OPS()
ALSA: hda/tegra: Convert to RUNTIME_PM_OPS() & co
ALSA: oxygen: Convert to EXPORT_SIMPLE_DEV_PM_OPS()
ALSA: vx222: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
ALSA: intel-hdmi-audio: Convert to SYSTEM_SLEEP_PM_OPS()
sound/ac97/bus.c | 9 ++------- sound/atmel/ac97c.c | 9 ++------- sound/core/pcm.c | 4 +--- sound/pci/hda/hda_bind.c | 2 +- sound/pci/hda/hda_codec.c | 3 +-- sound/pci/hda/hda_intel.c | 12 ++++++------ sound/pci/hda/hda_tegra.c | 16 +++++++--------- sound/pci/oxygen/oxygen.c | 4 +--- sound/pci/oxygen/oxygen.h | 2 -- sound/pci/oxygen/oxygen_lib.c | 5 +---- sound/pci/oxygen/se6x.c | 4 +--- sound/pci/oxygen/virtuoso.c | 4 +--- sound/pci/vx222/vx222.c | 9 ++------- sound/x86/intel_hdmi_audio.c | 8 ++++---- 14 files changed, 30 insertions(+), 61 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/9 ALSA: ac97: Convert to RUNTIME_PM_OPS() macro
Use a newer RUNTIME_PM_OPS() macro instead of SET_RUNTIME_PM_OPS() together with pm_ptr(), which makes CONFIG_PM ifdefs superfluous.
This optimizes slightly when CONFIG_PM is disabled, too.
--- sound/ac97/bus.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/ac97/bus.c +2 -7
@@ -387,7 +387,6 @@ void snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl) }EXPORT_SYMBOL_GPL (snd_ac97_controller_unregister); -#ifdef CONFIG_PM static int ac97_pm_runtime_suspend (struct device *dev) {struct ac97_codec_device *codec =to_ac97_device (dev);
@@ -419,7 +418,6 @@ static int ac97_pm_runtime_resume(struct device *dev)return pm_generic_runtime_resume (dev); } -#endif /* CONFIG_PM */ static const struct dev_pm_ops ac97_pm = { .suspend = pm_generic_suspend,
@@ -428,10 +426,7 @@ static const struct dev_pm_ops ac97_pm = { .thaw = pm_generic_thaw, .poweroff = pm_generic_poweroff, .restore = pm_generic_restore, -SET_RUNTIME_PM_OPS ( - ac97_pm_runtime_suspend, - ac97_pm_runtime_resume, -NULL ) + RUNTIME_PM_OPS(ac97_pm_runtime_suspend, ac97_pm_runtime_resume, NULL) };static int ac97_get_enable_clk (struct ac97_codec_device *adev)
@@ -535,7 +530,7 @@ const struct bus_type ac97_bus_type = { .name = "ac97bus", .dev_groups = ac97_dev_groups, .match = ac97_bus_match, - .pm = &ac97_pm, + .pm = pm_ptr(&ac97_pm), .probe = ac97_bus_probe, .remove = ac97_bus_remove, };
Signature · 1 line
2.43.0
PATCH 2/9 ALSA: atmel: Convert to DEFINE_SIMPLE_DEV_PM_OPS() macro
In reply to Takashi IwaiUse the newer DEFINE_SIMPLE_DEV_PM_OPS() macro instead of SIMPLE_DEV_PM_OPS() together with pm_ptr(), which makes CONFIG_PM_SLEEP ifdefs superfluous.
Merely a cleanup, there should be no actual code change.
--- sound/atmel/ac97c.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/atmel/ac97c.c +2 -7
@@ -817,7 +817,6 @@ static int atmel_ac97c_probe(struct platform_device *pdev)return retval; } -#ifdef CONFIG_PM_SLEEP static int atmel_ac97c_suspend (struct device *pdev) {struct snd_card *card =dev_get_drvdata (pdev);
@@ -836,11 +835,7 @@ static int atmel_ac97c_resume(struct device *pdev)return ret; } -static SIMPLE_DEV_PM_OPS(atmel_ac97c_pm, atmel_ac97c_suspend, atmel_ac97c_resume); -#define ATMEL_AC97C_PM_OPS &atmel_ac97c_pm -#else -#define ATMEL_AC97C_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(atmel_ac97c_pm, atmel_ac97c_suspend, atmel_ac97c_resume);static void atmel_ac97c_remove (struct platform_device *pdev) {
@@ -864,7 +859,7 @@ static struct platform_driver atmel_ac97c_driver = { .remove = atmel_ac97c_remove, .driver = { .name = "atmel_ac97c", - .pm = ATMEL_AC97C_PM_OPS, + .pm = pm_ptr(&atmel_ac97c_pm), .of_match_table = atmel_ac97c_dt_ids, }, };
Signature · 1 line
2.43.0
PATCH 3/9 ALSA: pcm: Convert to SYSTEM_SLEEP_PM_OPS()
In reply to Takashi IwaiUse the newer SYSTEM_SLEEP_PM_OPS() macro instead of SET_SYSTEM_SLEEP_PM_OPS(), which makes CONFIG_PM_SLEEP ifdefs superfluous.
Merely a cleanup, there should be no actual code change.
--- sound/core/pcm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
sound/core/pcm.c +1 -3
@@ -592,7 +592,6 @@ static const struct attribute_group *pcm_dev_attr_groups[];* PM callbacks: we need to deal only with suspend here, as the resume is * triggered either from user-space or the driver's resume callback */ -#ifdef CONFIG_PM_SLEEP static int do_pcm_suspend (struct device *dev) {struct snd_pcm_str *pstr =dev_get_drvdata (dev);
@@ -601,10 +600,9 @@ static int do_pcm_suspend(struct device *dev)snd_pcm_suspend_all (pstr->pcm);return 0 ; } -#endif static const struct dev_pm_ops pcm_dev_pm_ops = { -SET_SYSTEM_SLEEP_PM_OPS (do_pcm_suspend,NULL ) +SYSTEM_SLEEP_PM_OPS (do_pcm_suspend,NULL ) };/* device type for PCM -- basically only for passing PM callbacks */
Signature · 1 line
2.43.0
PATCH 4/9 ALSA: hda: Use RUNTIME_PM_OPS() and pm_ptr()
In reply to Takashi IwaiClean up the code with the helper macros, and also assure that no PM ops is assigned without CONFIG_PM via pm_ptr().
Merely a cleanup, there should be no actual code change.
--- sound/pci/hda/hda_bind.c | 2 +- sound/pci/hda/hda_codec.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
sound/pci/hda/hda_bind.c +1 -1
@@ -185,7 +185,7 @@ int __hda_codec_driver_register(struct hda_codec_driver *drv, const char *name, drv->core.driver.probe = hda_codec_driver_probe; drv->core.driver.remove = hda_codec_driver_remove; drv->core.driver.shutdown = hda_codec_driver_shutdown; - drv->core.driver.pm = &hda_codec_driver_pm; + drv->core.driver.pm =pm_ptr (&hda_codec_driver_pm); drv->core.type =HDA_DEV_LEGACY ; drv->core.match = hda_codec_match; drv->core.unsol_event = hda_codec_unsol_event;
sound/pci/hda/hda_codec.c +1 -2
@@ -3037,8 +3037,7 @@ const struct dev_pm_ops hda_codec_driver_pm = { .thaw = pm_sleep_ptr(hda_codec_pm_thaw), .poweroff = pm_sleep_ptr(hda_codec_pm_suspend), .restore = pm_sleep_ptr(hda_codec_pm_restore), - .runtime_suspend = pm_ptr(hda_codec_runtime_suspend), - .runtime_resume = pm_ptr(hda_codec_runtime_resume), + RUNTIME_PM_OPS(hda_codec_runtime_suspend, hda_codec_runtime_resume, NULL) };/* suspend the codec at shutdown; called from driver's shutdown callback */
Signature · 1 line
2.43.0
PATCH 5/9 ALSA: hda-intel: Convert to RUNTIME_PM_OPS()
In reply to Takashi IwaiUse the newer RUNTIME_PM_OPS() macro instead of SET_RUNTIME_PM_OPS() together with pm_ptr(), which allows us dropping ugly __maybe_unused attributes.
This optimizes slightly when CONFIG_PM is disabled, too.
--- sound/pci/hda/hda_intel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/pci/hda/hda_intel.c +6 -6
@@ -1051,7 +1051,7 @@ static int azx_suspend(struct device *dev)return 0 ; } -static int __maybe_unused azx_resume (struct device *dev) +static int azx_resume (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);struct azx *chip;
@@ -1098,7 +1098,7 @@ static int azx_thaw_noirq(struct device *dev)return 0 ; } -static int __maybe_unused azx_runtime_suspend (struct device *dev) +static int azx_runtime_suspend (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);struct azx *chip;
@@ -1115,7 +1115,7 @@ static int __maybe_unused azx_runtime_suspend(struct device *dev)return 0 ; } -static int __maybe_unused azx_runtime_resume (struct device *dev) +static int azx_runtime_resume (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);struct azx *chip;
@@ -1132,7 +1132,7 @@ static int __maybe_unused azx_runtime_resume(struct device *dev)return 0 ; } -static int __maybe_unused azx_runtime_idle (struct device *dev) +static int azx_runtime_idle (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);struct azx *chip;
@@ -1163,7 +1163,7 @@ static const struct dev_pm_ops azx_pm = { .complete = pm_sleep_ptr(azx_complete), .freeze_noirq = pm_sleep_ptr(azx_freeze_noirq), .thaw_noirq = pm_sleep_ptr(azx_thaw_noirq), - SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle) + RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle) };
@@ -2795,7 +2795,7 @@ static struct pci_driver azx_driver = { .remove = azx_remove, .shutdown = azx_shutdown, .driver = { - .pm = &azx_pm, + .pm = pm_ptr(&azx_pm), }, };
Signature · 1 line
2.43.0
PATCH 6/9 ALSA: hda/tegra: Convert to RUNTIME_PM_OPS() & co
In reply to Takashi IwaiUse the newer RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() macros instead of SET_SET_RUNTIME_PM_OPS() and SET_SYSTEM_SLEEP_PM_OPS() together with pm_ptr(), which allows us dropping ugly __maybe_unused attributes.
This optimizes slightly when CONFIG_PM is disabled, too.
--- sound/pci/hda/hda_tegra.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
sound/pci/hda/hda_tegra.c +7 -9
@@ -125,7 +125,7 @@ static void hda_tegra_init(struct hda_tegra *hda)/* * power management */ -static int __maybe_unused hda_tegra_suspend (struct device *dev) +static int hda_tegra_suspend (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);int rc;
@@ -138,7 +138,7 @@ static int __maybe_unused hda_tegra_suspend(struct device *dev)return 0 ; } -static int __maybe_unused hda_tegra_resume (struct device *dev) +static int hda_tegra_resume (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);int rc;
@@ -151,7 +151,7 @@ static int __maybe_unused hda_tegra_resume(struct device *dev)return 0 ; } -static int __maybe_unused hda_tegra_runtime_suspend (struct device *dev) +static int hda_tegra_runtime_suspend (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);struct azx *chip = card->private_data;
@@ -170,7 +170,7 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev)return 0 ; } -static int __maybe_unused hda_tegra_runtime_resume (struct device *dev) +static int hda_tegra_runtime_resume (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);struct azx *chip = card->private_data;
@@ -204,10 +204,8 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) }static const struct dev_pm_ops hda_tegra_pm = { - SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) -SET_RUNTIME_PM_OPS (hda_tegra_runtime_suspend, - hda_tegra_runtime_resume, -NULL ) + SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) +RUNTIME_PM_OPS (hda_tegra_runtime_suspend, hda_tegra_runtime_resume,NULL ) };static int hda_tegra_dev_disconnect (struct snd_device *device)
@@ -602,7 +600,7 @@ static void hda_tegra_shutdown(struct platform_device *pdev)static struct platform_driver tegra_platform_hda = { .driver = { .name ="tegra-hda" , - .pm = &hda_tegra_pm, + .pm =pm_ptr (&hda_tegra_pm), .of_match_table = hda_tegra_match, }, .probe = hda_tegra_probe,
Signature · 1 line
2.43.0
PATCH 7/9 ALSA: oxygen: Convert to EXPORT_SIMPLE_DEV_PM_OPS()
In reply to Takashi IwaiUse the newer EXPORT_SIMPLE_DEV_PM_OPS() macro instead of SIPLE_DEV_PM_OPS() and manual export, together with pm_ptr() macro, which makes CONFIG_PM_SLEEP ifdefs superfluous.
Merely a cleanup, there should be no actual code change.
--- sound/pci/oxygen/oxygen.c | 4 +--- sound/pci/oxygen/oxygen.h | 2 -- sound/pci/oxygen/oxygen_lib.c | 5 +---- sound/pci/oxygen/se6x.c | 4 +--- sound/pci/oxygen/virtuoso.c | 4 +--- 5 files changed, 4 insertions(+), 15 deletions(-)
sound/pci/oxygen/oxygen.c +1 -3
@@ -854,11 +854,9 @@ static struct pci_driver oxygen_driver = { .name = KBUILD_MODNAME, .id_table = oxygen_ids, .probe = generic_oxygen_probe, -#ifdef CONFIG_PM_SLEEP .driver = { - .pm = &oxygen_pci_pm, + .pm = pm_ptr(&oxygen_pci_pm), }, -#endif };module_pci_driver (oxygen_driver);
sound/pci/oxygen/oxygen.h +0 -2
@@ -161,9 +161,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,const struct pci_device_id *id ) ); -#ifdef CONFIG_PM_SLEEP extern const struct dev_pm_ops oxygen_pci_pm; -#endif void oxygen_pci_shutdown (struct pci_dev *pci);/* oxygen_mixer.c */
sound/pci/oxygen/oxygen_lib.c +1 -4
@@ -713,7 +713,6 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, }EXPORT_SYMBOL (oxygen_pci_probe); -#ifdef CONFIG_PM_SLEEP static int oxygen_pci_suspend (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);
@@ -789,9 +788,7 @@ static int oxygen_pci_resume(struct device *dev)return 0 ; } -SIMPLE_DEV_PM_OPS (oxygen_pci_pm, oxygen_pci_suspend, oxygen_pci_resume); -EXPORT_SYMBOL (oxygen_pci_pm); -#endif /* CONFIG_PM_SLEEP */ +EXPORT_SIMPLE_DEV_PM_OPS (oxygen_pci_pm, oxygen_pci_suspend, oxygen_pci_resume);void oxygen_pci_shutdown (struct pci_dev *pci) {
sound/pci/oxygen/se6x.c +1 -3
@@ -137,11 +137,9 @@ static struct pci_driver se6x_driver = { .name = KBUILD_MODNAME, .id_table = se6x_ids, .probe = se6x_probe, -#ifdef CONFIG_PM_SLEEP .driver = { - .pm = &oxygen_pci_pm, + .pm = pm_ptr(&oxygen_pci_pm), }, -#endif .shutdown = oxygen_pci_shutdown, };
sound/pci/oxygen/virtuoso.c +1 -3
@@ -82,11 +82,9 @@ static struct pci_driver xonar_driver = { .name = KBUILD_MODNAME, .id_table = xonar_ids, .probe = xonar_probe, -#ifdef CONFIG_PM_SLEEP .driver = { - .pm = &oxygen_pci_pm, + .pm = pm_ptr(&oxygen_pci_pm), }, -#endif .shutdown = oxygen_pci_shutdown, };
Signature · 1 line
2.43.0
PATCH 8/9 ALSA: vx222: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
In reply to Takashi IwaiUse the newer DEFINE_SIMPLE_DEV_PM_OPS() macro instead of SIMPLE_DEV_PM_OPS() together with pm_ptr(), which makes CONFIG_PM_SLEEP ifdefs superfluous.
Merely a cleanup, there should be no actual code change.
--- sound/pci/vx222/vx222.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/pci/vx222/vx222.c +2 -7
@@ -204,7 +204,6 @@ static int snd_vx222_probe(struct pci_dev *pci,return 0 ; } -#ifdef CONFIG_PM_SLEEP static int snd_vx222_suspend (struct device *dev) {struct snd_card *card =dev_get_drvdata (dev);
@@ -221,18 +220,14 @@ static int snd_vx222_resume(struct device *dev)return snd_vx_resume (&vx->core); } -static SIMPLE_DEV_PM_OPS(snd_vx222_pm, snd_vx222_suspend, snd_vx222_resume); -#define SND_VX222_PM_OPS &snd_vx222_pm -#else -#define SND_VX222_PM_OPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(snd_vx222_pm, snd_vx222_suspend, snd_vx222_resume);static struct pci_driver vx222_driver = { .name =KBUILD_MODNAME , .id_table = snd_vx222_ids, .probe = snd_vx222_probe, .driver = { - .pm =SND_VX222_PM_OPS , + .pm =pm_ptr (&snd_vx222_pm), }, };
Signature · 1 line
2.43.0
PATCH 9/9 ALSA: intel-hdmi-audio: Convert to SYSTEM_SLEEP_PM_OPS()
In reply to Takashi IwaiUse the newer SYSTEM_SLEEP_PM_OPS() macro instead of SET_SYSTEM_SLEEP_PM_OPS() together with pm_ptr(), which allows us dropping ugly __maybe_unused attributes.
This optimizes slightly when CONFIG_PM is disabled, too.
--- sound/x86/intel_hdmi_audio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/x86/intel_hdmi_audio.c +4 -4
@@ -1617,7 +1617,7 @@ static int had_create_jack(struct snd_intelhad *ctx,* PM callbacks */ -static int __maybe_unused hdmi_lpe_audio_suspend (struct device *dev) +static int hdmi_lpe_audio_suspend (struct device *dev) {struct snd_intelhad_card *card_ctx =dev_get_drvdata (dev);
@@ -1626,7 +1626,7 @@ static int __maybe_unused hdmi_lpe_audio_suspend(struct device *dev)return 0 ; } -static int __maybe_unused hdmi_lpe_audio_resume (struct device *dev) +static int hdmi_lpe_audio_resume (struct device *dev) {struct snd_intelhad_card *card_ctx =dev_get_drvdata (dev);
@@ -1833,13 +1833,13 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) }static const struct dev_pm_ops hdmi_lpe_audio_pm = { -SET_SYSTEM_SLEEP_PM_OPS (hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) +SYSTEM_SLEEP_PM_OPS (hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume) };static struct platform_driver hdmi_lpe_audio_driver = { .driver = { .name ="hdmi-lpe-audio" , - .pm = &hdmi_lpe_audio_pm, + .pm =pm_ptr (&hdmi_lpe_audio_pm), }, .probe = hdmi_lpe_audio_probe, };
Signature · 1 line
2.43.0