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

ASoC: cs42l42: 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: patches@opensource.cirrus.com
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250317095603.20073-10-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Takashi Iwai and committed by
Mark Brown
227b1323 fd24b93e

+11 -11
+3 -3
sound/soc/codecs/cs42l42-i2c.c
··· 48 48 cs42l42_common_remove(cs42l42); 49 49 } 50 50 51 - static int __maybe_unused cs42l42_i2c_resume(struct device *dev) 51 + static int cs42l42_i2c_resume(struct device *dev) 52 52 { 53 53 int ret; 54 54 ··· 62 62 } 63 63 64 64 static const struct dev_pm_ops cs42l42_i2c_pm_ops = { 65 - SET_SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l42_i2c_resume) 65 + SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l42_i2c_resume) 66 66 }; 67 67 68 68 static const struct of_device_id __maybe_unused cs42l42_of_match[] = { ··· 87 87 static struct i2c_driver cs42l42_i2c_driver = { 88 88 .driver = { 89 89 .name = "cs42l42", 90 - .pm = &cs42l42_i2c_pm_ops, 90 + .pm = pm_ptr(&cs42l42_i2c_pm_ops), 91 91 .of_match_table = of_match_ptr(cs42l42_of_match), 92 92 .acpi_match_table = ACPI_PTR(cs42l42_acpi_match), 93 93 },
+8 -8
sound/soc/codecs/cs42l42-sdw.c
··· 411 411 .port_prep = cs42l42_sdw_port_prep, 412 412 }; 413 413 414 - static int __maybe_unused cs42l42_sdw_runtime_suspend(struct device *dev) 414 + static int cs42l42_sdw_runtime_suspend(struct device *dev) 415 415 { 416 416 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev); 417 417 ··· 426 426 return 0; 427 427 } 428 428 429 - static const struct reg_sequence __maybe_unused cs42l42_soft_reboot_seq[] = { 429 + static const struct reg_sequence cs42l42_soft_reboot_seq[] = { 430 430 REG_SEQ0(CS42L42_SOFT_RESET_REBOOT, 0x1e), 431 431 }; 432 432 433 - static int __maybe_unused cs42l42_sdw_handle_unattach(struct cs42l42_private *cs42l42) 433 + static int cs42l42_sdw_handle_unattach(struct cs42l42_private *cs42l42) 434 434 { 435 435 struct sdw_slave *peripheral = cs42l42->sdw_peripheral; 436 436 ··· 460 460 return 0; 461 461 } 462 462 463 - static int __maybe_unused cs42l42_sdw_runtime_resume(struct device *dev) 463 + static int cs42l42_sdw_runtime_resume(struct device *dev) 464 464 { 465 465 static const unsigned int ts_dbnce_ms[] = { 0, 125, 250, 500, 750, 1000, 1250, 1500}; 466 466 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev); ··· 491 491 return 0; 492 492 } 493 493 494 - static int __maybe_unused cs42l42_sdw_resume(struct device *dev) 494 + static int cs42l42_sdw_resume(struct device *dev) 495 495 { 496 496 struct cs42l42_private *cs42l42 = dev_get_drvdata(dev); 497 497 int ret; ··· 596 596 } 597 597 598 598 static const struct dev_pm_ops cs42l42_sdw_pm = { 599 - SET_SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l42_sdw_resume) 600 - SET_RUNTIME_PM_OPS(cs42l42_sdw_runtime_suspend, cs42l42_sdw_runtime_resume, NULL) 599 + SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l42_sdw_resume) 600 + RUNTIME_PM_OPS(cs42l42_sdw_runtime_suspend, cs42l42_sdw_runtime_resume, NULL) 601 601 }; 602 602 603 603 static const struct sdw_device_id cs42l42_sdw_id[] = { ··· 609 609 static struct sdw_driver cs42l42_sdw_driver = { 610 610 .driver = { 611 611 .name = "cs42l42-sdw", 612 - .pm = &cs42l42_sdw_pm, 612 + .pm = pm_ptr(&cs42l42_sdw_pm), 613 613 }, 614 614 .probe = cs42l42_sdw_probe, 615 615 .remove = cs42l42_sdw_remove,