mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
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: 601885ffb5 ("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>
This commit is contained in:
parent
7e541f6dbd
commit
4acc0138c4
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user