aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/ltr501.c
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2022-01-30 19:31:20 +0000
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-02-18 11:45:29 +0000
commitd03da05124677adbd1d6f54ac5fa32f1ab870b98 (patch)
tree9275d21650b7119e536d957d1d63ee71e320550e /drivers/iio/light/ltr501.c
parentiio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc (diff)
downloadlinux-dev-d03da05124677adbd1d6f54ac5fa32f1ab870b98.tar.xz
linux-dev-d03da05124677adbd1d6f54ac5fa32f1ab870b98.zip
iio:light:ltr501: 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: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Maslov Dmitry <maslovdmitry@seeed.cc> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20220130193147.279148-24-jic23@kernel.org
Diffstat (limited to 'drivers/iio/light/ltr501.c')
-rw-r--r--drivers/iio/light/ltr501.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index d1532ef5f08b..679a1e1086ae 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -1611,7 +1611,6 @@ static int ltr501_remove(struct i2c_client *client)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
static int ltr501_suspend(struct device *dev)
{
struct ltr501_data *data = iio_priv(i2c_get_clientdata(
@@ -1627,9 +1626,8 @@ static int ltr501_resume(struct device *dev)
return ltr501_write_contr(data, data->als_contr,
data->ps_contr);
}
-#endif
-static SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume);
static const struct acpi_device_id ltr_acpi_match[] = {
{ "LTER0501", ltr501 },
@@ -1661,7 +1659,7 @@ static struct i2c_driver ltr501_driver = {
.driver = {
.name = LTR501_DRV_NAME,
.of_match_table = ltr501_of_match,
- .pm = &ltr501_pm_ops,
+ .pm = pm_sleep_ptr(&ltr501_pm_ops),
.acpi_match_table = ACPI_PTR(ltr_acpi_match),
},
.probe = ltr501_probe,