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

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: max98388: fix unused function warnings

The PM functions are never referenced when CONFIG_PM_SLEEP is
disabled:

sound/soc/codecs/max98388.c:854:12: error: unused function 'max98388_suspend' [-Werror,-Wunused-function]
static int max98388_suspend(struct device *dev)
^
sound/soc/codecs/max98388.c:864:12: error: unused function 'max98388_resume' [-Werror,-Wunused-function]
static int max98388_resume(struct device *dev)

Fix this by using the modern SYSTEM_SLEEP_PM_OPS() macro in place of
the deprecated SET_SYSTEM_SLEEP_PM_OPS() version, and use pm_sleep_ptr()
to hide the entire structure as well.

On a related note, the of_match_ptr() and ACPI_PTR() macros have the same
problem and would cause the device id table to be unused when the driver
is built-in and the respective subsystems are disabled. This does not
cause warnings unless -Wunused-const-variable is passed to the compiler,
but it's better to just not use the macros at all here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230616090156.2347850-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Arnd Bergmann and committed by
Mark Brown
0c340ba0 fadccca8

+4 -4
+4 -4
sound/soc/codecs/max98388.c
··· 873 873 } 874 874 875 875 static const struct dev_pm_ops max98388_pm = { 876 - SET_SYSTEM_SLEEP_PM_OPS(max98388_suspend, max98388_resume) 876 + SYSTEM_SLEEP_PM_OPS(max98388_suspend, max98388_resume) 877 877 }; 878 878 879 879 static const struct regmap_config max98388_regmap = { ··· 998 998 static struct i2c_driver max98388_i2c_driver = { 999 999 .driver = { 1000 1000 .name = "max98388", 1001 - .of_match_table = of_match_ptr(max98388_of_match), 1002 - .acpi_match_table = ACPI_PTR(max98388_acpi_match), 1003 - .pm = &max98388_pm, 1001 + .of_match_table = max98388_of_match, 1002 + .acpi_match_table = max98388_acpi_match, 1003 + .pm = pm_sleep_ptr(&max98388_pm), 1004 1004 }, 1005 1005 .probe = max98388_i2c_probe, 1006 1006 .id_table = max98388_i2c_id,