Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: rt5682-sdw: Convert to RUNTIME_PM_OPS() & co

Use the newer RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() macros
instead of 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.

Cc: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250317095603.20073-37-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Takashi Iwai and committed by
Mark Brown
ef57148d 71ba303a

+6 -6
+6 -6
sound/soc/codecs/rt5682-sdw.c
··· 709 709 }; 710 710 MODULE_DEVICE_TABLE(sdw, rt5682_id); 711 711 712 - static int __maybe_unused rt5682_dev_suspend(struct device *dev) 712 + static int rt5682_dev_suspend(struct device *dev) 713 713 { 714 714 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); 715 715 ··· 725 725 return 0; 726 726 } 727 727 728 - static int __maybe_unused rt5682_dev_system_suspend(struct device *dev) 728 + static int rt5682_dev_system_suspend(struct device *dev) 729 729 { 730 730 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); 731 731 struct sdw_slave *slave = dev_to_sdw_dev(dev); ··· 753 753 return rt5682_dev_suspend(dev); 754 754 } 755 755 756 - static int __maybe_unused rt5682_dev_resume(struct device *dev) 756 + static int rt5682_dev_resume(struct device *dev) 757 757 { 758 758 struct sdw_slave *slave = dev_to_sdw_dev(dev); 759 759 struct rt5682_priv *rt5682 = dev_get_drvdata(dev); ··· 791 791 } 792 792 793 793 static const struct dev_pm_ops rt5682_pm = { 794 - SET_SYSTEM_SLEEP_PM_OPS(rt5682_dev_system_suspend, rt5682_dev_resume) 795 - SET_RUNTIME_PM_OPS(rt5682_dev_suspend, rt5682_dev_resume, NULL) 794 + SYSTEM_SLEEP_PM_OPS(rt5682_dev_system_suspend, rt5682_dev_resume) 795 + RUNTIME_PM_OPS(rt5682_dev_suspend, rt5682_dev_resume, NULL) 796 796 }; 797 797 798 798 static struct sdw_driver rt5682_sdw_driver = { 799 799 .driver = { 800 800 .name = "rt5682", 801 - .pm = &rt5682_pm, 801 + .pm = pm_ptr(&rt5682_pm), 802 802 }, 803 803 .probe = rt5682_sdw_probe, 804 804 .remove = rt5682_sdw_remove,