aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2022-09-25 18:27:55 +0100
committerGuenter Roeck <linux@roeck-us.net>2022-09-25 14:22:12 -0700
commit73568f92d365d55c5261dda83ef9ec9944929f2e (patch)
tree2545397071b334d997491ef48d74bbb06874def0 /drivers/hwmon
parenthwmon: (pwm-fan) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() (diff)
downloadwireguard-linux-73568f92d365d55c5261dda83ef9ec9944929f2e.tar.xz
wireguard-linux-73568f92d365d55c5261dda83ef9ec9944929f2e.zip
hwmon: (tmp102) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
These newer PM macros allow the compiler to see what code it can remove if !CONFIG_PM_SLEEP. This allows the removal of #ifdef guards whilst achieving the same result. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20220925172759.3573439-15-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/tmp102.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index e867a0c2e539..2bf496a62206 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -260,7 +260,6 @@ static int tmp102_probe(struct i2c_client *client)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
static int tmp102_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -283,9 +282,8 @@ static int tmp102_resume(struct device *dev)
return err;
}
-#endif /* CONFIG_PM */
-static SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume);
static const struct i2c_device_id tmp102_id[] = {
{ "tmp102", 0 },
@@ -302,7 +300,7 @@ MODULE_DEVICE_TABLE(of, tmp102_of_match);
static struct i2c_driver tmp102_driver = {
.driver.name = DRIVER_NAME,
.driver.of_match_table = of_match_ptr(tmp102_of_match),
- .driver.pm = &tmp102_dev_pm_ops,
+ .driver.pm = pm_sleep_ptr(&tmp102_dev_pm_ops),
.probe_new = tmp102_probe,
.id_table = tmp102_id,
};