mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
power: pm2301-charger: use __maybe_unused to hide pm functions
The pm2301 charger driver uses nested #ifdefs to check for both CONFIG_PM and CONFIG_PM_SLEEP in an attempt to hide its suspend and runtime-pm operations when they are unused, but it does not hide the clear_lpn_pin() function in the same way, so we get a build warning when everything is disabled: drivers/power/pm2301_charger.c:123:13: error: 'clear_lpn_pin' defined but not used [-Werror=unused-function] This removes all the #ifdef and instead uses __maybe_unused annotations to let the compiler know it can silently drop the function definition. For the PM2XXX_PM_OPS, we can use an IS_ENABLED() check to avoid defining the structure when CONFIG_PM is not set without the #ifdef. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>
This commit is contained in:
parent
298cb0f192
commit
0df6e32b0e
@ -911,11 +911,7 @@ static struct pm2xxx_irq pm2xxx_charger_irq[] = {
|
|||||||
{"PM2XXX_IRQ_INT", pm2xxx_irq_int},
|
{"PM2XXX_IRQ_INT", pm2xxx_irq_int},
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
static int __maybe_unused pm2xxx_wall_charger_resume(struct device *dev)
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
|
||||||
|
|
||||||
static int pm2xxx_wall_charger_resume(struct device *dev)
|
|
||||||
{
|
{
|
||||||
struct i2c_client *i2c_client = to_i2c_client(dev);
|
struct i2c_client *i2c_client = to_i2c_client(dev);
|
||||||
struct pm2xxx_charger *pm2;
|
struct pm2xxx_charger *pm2;
|
||||||
@ -931,7 +927,7 @@ static int pm2xxx_wall_charger_resume(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pm2xxx_wall_charger_suspend(struct device *dev)
|
static int __maybe_unused pm2xxx_wall_charger_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct i2c_client *i2c_client = to_i2c_client(dev);
|
struct i2c_client *i2c_client = to_i2c_client(dev);
|
||||||
struct pm2xxx_charger *pm2;
|
struct pm2xxx_charger *pm2;
|
||||||
@ -949,9 +945,7 @@ static int pm2xxx_wall_charger_suspend(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
static int __maybe_unused pm2xxx_runtime_suspend(struct device *dev)
|
||||||
|
|
||||||
static int pm2xxx_runtime_suspend(struct device *dev)
|
|
||||||
{
|
{
|
||||||
struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
|
struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
|
||||||
struct pm2xxx_charger *pm2;
|
struct pm2xxx_charger *pm2;
|
||||||
@ -962,7 +956,7 @@ static int pm2xxx_runtime_suspend(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pm2xxx_runtime_resume(struct device *dev)
|
static int __maybe_unused pm2xxx_runtime_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
|
struct i2c_client *pm2xxx_i2c_client = to_i2c_client(dev);
|
||||||
struct pm2xxx_charger *pm2;
|
struct pm2xxx_charger *pm2;
|
||||||
@ -975,15 +969,11 @@ static int pm2xxx_runtime_resume(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dev_pm_ops pm2xxx_pm_ops = {
|
static const struct dev_pm_ops pm2xxx_pm_ops __maybe_unused = {
|
||||||
SET_SYSTEM_SLEEP_PM_OPS(pm2xxx_wall_charger_suspend,
|
SET_SYSTEM_SLEEP_PM_OPS(pm2xxx_wall_charger_suspend,
|
||||||
pm2xxx_wall_charger_resume)
|
pm2xxx_wall_charger_resume)
|
||||||
SET_RUNTIME_PM_OPS(pm2xxx_runtime_suspend, pm2xxx_runtime_resume, NULL)
|
SET_RUNTIME_PM_OPS(pm2xxx_runtime_suspend, pm2xxx_runtime_resume, NULL)
|
||||||
};
|
};
|
||||||
#define PM2XXX_PM_OPS (&pm2xxx_pm_ops)
|
|
||||||
#else
|
|
||||||
#define PM2XXX_PM_OPS NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
|
static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client,
|
||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
@ -1244,7 +1234,7 @@ static struct i2c_driver pm2xxx_charger_driver = {
|
|||||||
.remove = pm2xxx_wall_charger_remove,
|
.remove = pm2xxx_wall_charger_remove,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "pm2xxx-wall_charger",
|
.name = "pm2xxx-wall_charger",
|
||||||
.pm = PM2XXX_PM_OPS,
|
.pm = IS_ENABLED(CONFIG_PM) ? &pm2xxx_pm_ops : NULL,
|
||||||
},
|
},
|
||||||
.id_table = pm2xxx_id,
|
.id_table = pm2xxx_id,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user