Skip to content

Commit

Permalink
hwmon: (tmp103) Use SIMPLE_DEV_PM_OPS helper macro
Browse files Browse the repository at this point in the history
Replace ifdefs with SIMPLE_DEV_PM_OPS helper macro.

Signed-off-by: Rahul Bedarkar <rahulbedarkar89@gmail.com>
Acked-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Rahul Bedarkar authored and Guenter Roeck committed Apr 24, 2017
1 parent 4abdf38 commit 39c382a
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions drivers/hwmon/tmp103.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,23 @@ static int tmp103_probe(struct i2c_client *client,
return PTR_ERR_OR_ZERO(hwmon_dev);
}

#ifdef CONFIG_PM
static int tmp103_suspend(struct device *dev)
static int __maybe_unused 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 tmp103_resume(struct device *dev)
static int __maybe_unused 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 const struct dev_pm_ops tmp103_dev_pm_ops = {
.suspend = tmp103_suspend,
.resume = tmp103_resume,
};

#define TMP103_DEV_PM_OPS (&tmp103_dev_pm_ops)
#else
#define TMP103_DEV_PM_OPS NULL
#endif /* CONFIG_PM */
static SIMPLE_DEV_PM_OPS(tmp103_dev_pm_ops, tmp103_suspend, tmp103_resume);

static const struct i2c_device_id tmp103_id[] = {
{ "tmp103", 0 },
Expand All @@ -193,7 +184,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 = &tmp103_dev_pm_ops,
},
.probe = tmp103_probe,
.id_table = tmp103_id,
Expand Down

0 comments on commit 39c382a

Please sign in to comment.