aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio/magnetometer
diff options
context:
space:
mode:
authorGravatar Jonathan Cameron <Jonathan.Cameron@huawei.com> 2022-01-30 19:31:28 +0000
committerGravatar Jonathan Cameron <Jonathan.Cameron@huawei.com> 2022-02-18 11:45:30 +0000
commitc9f384b87b328379090eb1eb57773043e0320349 (patch)
tree3fadac8cdfe35da7514ebf7d08ca78470340da08 /drivers/iio/magnetometer
parentiio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc (diff)
downloadlinux-c9f384b87b328379090eb1eb57773043e0320349.tar.gz
linux-c9f384b87b328379090eb1eb57773043e0320349.tar.bz2
linux-c9f384b87b328379090eb1eb57773043e0320349.zip
iio:magn:mmc35240: 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. Also use SIMPLE_DEV_PM_OPS instead of open-coding the equivalent. Removing instances of this approach from IIO also stops them being copied into new drivers. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20220130193147.279148-32-jic23@kernel.org
Diffstat (limited to 'drivers/iio/magnetometer')
-rw-r--r--drivers/iio/magnetometer/mmc35240.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index 65f3d1ed0d59..186edfcda0b7 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -521,7 +521,6 @@ static int mmc35240_probe(struct i2c_client *client,
return devm_iio_device_register(&client->dev, indio_dev);
}
-#ifdef CONFIG_PM_SLEEP
static int mmc35240_suspend(struct device *dev)
{
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -548,11 +547,9 @@ static int mmc35240_resume(struct device *dev)
return 0;
}
-#endif
-static const struct dev_pm_ops mmc35240_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(mmc35240_suspend, mmc35240_resume)
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(mmc35240_pm_ops, mmc35240_suspend,
+ mmc35240_resume);
static const struct of_device_id mmc35240_of_match[] = {
{ .compatible = "memsic,mmc35240", },
@@ -576,7 +573,7 @@ static struct i2c_driver mmc35240_driver = {
.driver = {
.name = MMC35240_DRV_NAME,
.of_match_table = mmc35240_of_match,
- .pm = &mmc35240_pm_ops,
+ .pm = pm_sleep_ptr(&mmc35240_pm_ops),
.acpi_match_table = ACPI_PTR(mmc35240_acpi_match),
},
.probe = mmc35240_probe,