Skip to content

Commit 1efe2b2

Browse files
jic23groeck
authored andcommitted
hwmon: (tmp108) 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 __maybe_unused markings whilst achieving the same result. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20220925172759.3573439-17-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent a158b4e commit 1efe2b2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/hwmon/tmp108.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ static int tmp108_probe(struct i2c_client *client)
390390
return PTR_ERR_OR_ZERO(hwmon_dev);
391391
}
392392

393-
static int __maybe_unused tmp108_suspend(struct device *dev)
393+
static int tmp108_suspend(struct device *dev)
394394
{
395395
struct tmp108 *tmp108 = dev_get_drvdata(dev);
396396

397397
return regmap_update_bits(tmp108->regmap, TMP108_REG_CONF,
398398
TMP108_CONF_MODE_MASK, TMP108_MODE_SHUTDOWN);
399399
}
400400

401-
static int __maybe_unused tmp108_resume(struct device *dev)
401+
static int tmp108_resume(struct device *dev)
402402
{
403403
struct tmp108 *tmp108 = dev_get_drvdata(dev);
404404
int err;
@@ -410,7 +410,7 @@ static int __maybe_unused tmp108_resume(struct device *dev)
410410
return err;
411411
}
412412

413-
static SIMPLE_DEV_PM_OPS(tmp108_dev_pm_ops, tmp108_suspend, tmp108_resume);
413+
static DEFINE_SIMPLE_DEV_PM_OPS(tmp108_dev_pm_ops, tmp108_suspend, tmp108_resume);
414414

415415
static const struct i2c_device_id tmp108_i2c_ids[] = {
416416
{ "tmp108", 0 },
@@ -429,7 +429,7 @@ MODULE_DEVICE_TABLE(of, tmp108_of_ids);
429429
static struct i2c_driver tmp108_driver = {
430430
.driver = {
431431
.name = DRIVER_NAME,
432-
.pm = &tmp108_dev_pm_ops,
432+
.pm = pm_sleep_ptr(&tmp108_dev_pm_ops),
433433
.of_match_table = of_match_ptr(tmp108_of_ids),
434434
},
435435
.probe_new = tmp108_probe,

0 commit comments

Comments
 (0)