Commit 20cadda3 authored by Jonathan Cameron's avatar Jonathan Cameron

iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based config guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Icenowy Zheng <icenowy@aosc.io>
Cc: Luca Weiss <luca@z3ntu.xyz>
Cc: Martijn Braam <martijn@brixit.nl>
Reviewed-by: default avatarPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-25-jic23@kernel.org
parent d03da051
...@@ -632,7 +632,6 @@ static int stk3310_remove(struct i2c_client *client) ...@@ -632,7 +632,6 @@ static int stk3310_remove(struct i2c_client *client)
return stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY); return stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY);
} }
#ifdef CONFIG_PM_SLEEP
static int stk3310_suspend(struct device *dev) static int stk3310_suspend(struct device *dev)
{ {
struct stk3310_data *data; struct stk3310_data *data;
...@@ -656,12 +655,8 @@ static int stk3310_resume(struct device *dev) ...@@ -656,12 +655,8 @@ static int stk3310_resume(struct device *dev)
return stk3310_set_state(data, state); return stk3310_set_state(data, state);
} }
static SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, stk3310_resume); static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend,
stk3310_resume);
#define STK3310_PM_OPS (&stk3310_pm_ops)
#else
#define STK3310_PM_OPS NULL
#endif
static const struct i2c_device_id stk3310_i2c_id[] = { static const struct i2c_device_id stk3310_i2c_id[] = {
{"STK3310", 0}, {"STK3310", 0},
...@@ -692,7 +687,7 @@ static struct i2c_driver stk3310_driver = { ...@@ -692,7 +687,7 @@ static struct i2c_driver stk3310_driver = {
.driver = { .driver = {
.name = "stk3310", .name = "stk3310",
.of_match_table = stk3310_of_match, .of_match_table = stk3310_of_match,
.pm = STK3310_PM_OPS, .pm = pm_sleep_ptr(&stk3310_pm_ops),
.acpi_match_table = ACPI_PTR(stk3310_acpi_id), .acpi_match_table = ACPI_PTR(stk3310_acpi_id),
}, },
.probe = stk3310_probe, .probe = stk3310_probe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment