Skip to content

Commit

Permalink
hwmon: (tmp103) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
jic23 authored and groeck committed Sep 25, 2022
1 parent 73568f9 commit a158b4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/hwmon/tmp103.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,23 @@ static int tmp103_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(hwmon_dev);
}

static int __maybe_unused tmp103_suspend(struct device *dev)
static int tmp103_suspend(struct device *dev)
{
struct regmap *regmap = dev_get_drvdata(dev);

return regmap_update_bits(regmap, TMP103_CONF_REG,
TMP103_CONF_SD_MASK, 0);
}

static int __maybe_unused tmp103_resume(struct device *dev)
static int tmp103_resume(struct device *dev)
{
struct regmap *regmap = dev_get_drvdata(dev);

return regmap_update_bits(regmap, TMP103_CONF_REG,
TMP103_CONF_SD_MASK, TMP103_CONF_SD);
}

static SIMPLE_DEV_PM_OPS(tmp103_dev_pm_ops, tmp103_suspend, tmp103_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(tmp103_dev_pm_ops, tmp103_suspend, tmp103_resume);

static const struct i2c_device_id tmp103_id[] = {
{ "tmp103", 0 },
Expand All @@ -212,7 +212,7 @@ static struct i2c_driver tmp103_driver = {
.driver = {
.name = "tmp103",
.of_match_table = of_match_ptr(tmp103_of_match),
.pm = &tmp103_dev_pm_ops,
.pm = pm_sleep_ptr(&tmp103_dev_pm_ops),
},
.probe_new = tmp103_probe,
.id_table = tmp103_id,
Expand Down

0 comments on commit a158b4e

Please sign in to comment.