diff options
author | Jonathan Cameron | 2022-06-21 21:27:09 +0100 |
---|---|---|
committer | Jonathan Cameron | 2022-07-18 18:48:18 +0100 |
commit | a79163d19ef7b385f48876898c28a58f35a1df35 (patch) | |
tree | 6542653b281f1db79bc2ca25f5294cae8ff763b6 /drivers | |
parent | fb4e8e2dadc91ea6478045910192e46bc880c32c (diff) |
iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc
Letting the compiler remove these functions when the kernel is built
without CONFIG_PM 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.
Very likely it would be safe to use DEFINE_RUNTIME_DEV_PM_OPS() here,
but that would be a functional change.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-27-jic23@kernel.org
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/iio/light/us5182d.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index cbd9978540fa..80d2299da561 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -922,7 +922,6 @@ static int us5182d_remove(struct i2c_client *client) return 0; } -#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM) static int us5182d_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -945,11 +944,10 @@ static int us5182d_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops us5182d_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) - SET_RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL) + SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) + RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL) }; static const struct acpi_device_id us5182d_acpi_match[] = { @@ -975,7 +973,7 @@ MODULE_DEVICE_TABLE(of, us5182d_of_match); static struct i2c_driver us5182d_driver = { .driver = { .name = US5182D_DRV_NAME, - .pm = &us5182d_pm_ops, + .pm = pm_ptr(&us5182d_pm_ops), .of_match_table = us5182d_of_match, .acpi_match_table = ACPI_PTR(us5182d_acpi_match), }, |