diff options
| author | Nathan Chancellor <nathan@kernel.org> | 2026-06-05 08:52:28 +0300 |
|---|---|---|
| committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2026-06-05 22:45:25 +0300 |
| commit | 4acc0138c4f2fba453da5a5076ad2bba08a7463b (patch) | |
| tree | eb32c0d4f1c7b986d7df03b6b65f9021bfd00d2e | |
| parent | 7e541f6dbd05921d0bbb99646028cb9982535707 (diff) | |
| download | linux-4acc0138c4f2fba453da5a5076ad2bba08a7463b.tar.xz | |
power: supply: max17042_battery: Use modern PM ops to clear up warning
When building for a platform that does not have power management, such
as s390, there is an unused function warning, as
max17042_suspend_soc_alerts() is only used in max17042_suspend(), which
is under a CONFIG_PM_SLEEP #ifdef.
drivers/power/supply/max17042_battery.c:957:13: error: 'max17042_suspend_soc_alerts' defined but not used [-Werror=unused-function]
957 | static void max17042_suspend_soc_alerts(struct max17042_chip *chip)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Use the modern DEFINE_SIMPLE_DEV_PM_OPS(), which allows the compiler to
see the functions as used while allowing it to eliminate them as unused
during the optimization phase. Use pm_ptr() to allow the compiler to
drop max17042_pm_ops when there is no PM support.
Fixes: 601885ffb5e9 ("power: supply: max17042_battery: Keep only critical alerts during suspend")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20260604-max17042_battery-fix-unused-suspend_soc_alerts-v1-1-3562a68e6f36@kernel.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| -rw-r--r-- | drivers/power/supply/max17042_battery.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index 0fb46c1c203f..639dacdb9b31 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -1296,7 +1296,6 @@ static int max17042_platform_probe(struct platform_device *pdev) return max17042_probe(i2c, dev, irq, id->driver_data); } -#ifdef CONFIG_PM_SLEEP static int max17042_suspend(struct device *dev) { struct max17042_chip *chip = dev_get_drvdata(dev); @@ -1327,10 +1326,9 @@ static int max17042_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(max17042_pm_ops, max17042_suspend, - max17042_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max17042_pm_ops, max17042_suspend, + max17042_resume); #ifdef CONFIG_ACPI static const struct acpi_device_id max17042_acpi_match[] = { @@ -1397,7 +1395,7 @@ static struct i2c_driver max17042_i2c_driver = { .name = "max17042", .acpi_match_table = ACPI_PTR(max17042_acpi_match), .of_match_table = of_match_ptr(max17042_dt_match), - .pm = &max17042_pm_ops, + .pm = pm_ptr(&max17042_pm_ops), }, .probe = max17042_i2c_probe, .id_table = max17042_id, @@ -1407,7 +1405,7 @@ static struct platform_driver max17042_platform_driver = { .driver = { .name = "max17042", .acpi_match_table = ACPI_PTR(max17042_acpi_match), - .pm = &max17042_pm_ops, + .pm = pm_ptr(&max17042_pm_ops), }, .probe = max17042_platform_probe, .id_table = max17042_platform_id, |
