summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorGrygorii Strashko <Grygorii.Strashko@linaro.org>2015-02-03 17:01:58 +0200
committerGuenter Roeck <linux@roeck-us.net>2015-02-03 12:17:12 -0800
commitdd378b1bcaa0ef5b14cca1e52b58ef9a3279fd8b (patch)
tree2fe042e39cac88aac18ca67c062673f1c4acae4c /drivers
parent7f444bf0a28c030d40925c5d0073d3e5ed8ca1e3 (diff)
hwmon: (tmp102) add hibernation callbacks
Setting a dev_pm_ops suspend/resume pair but not a set of hibernation functions means those pm functions will not be called upon hibernation. Fix this by using SIMPLE_DEV_PM_OPS, which appropriately assigns the suspend and hibernation handlers and move mp102_suspend/tmp102_resume under CONFIG_PM_SLEEP to avoid build warnings. Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org> [groeck: Declare tmp102_dev_pm_ops as static variable] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/tmp102.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index ba9f478f64ee..9da2735f1424 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -253,7 +253,7 @@ static int tmp102_remove(struct i2c_client *client)
return 0;
}
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
static int tmp102_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -279,17 +279,10 @@ static int tmp102_resume(struct device *dev)
config &= ~TMP102_CONF_SD;
return i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, config);
}
-
-static const struct dev_pm_ops tmp102_dev_pm_ops = {
- .suspend = tmp102_suspend,
- .resume = tmp102_resume,
-};
-
-#define TMP102_DEV_PM_OPS (&tmp102_dev_pm_ops)
-#else
-#define TMP102_DEV_PM_OPS NULL
#endif /* CONFIG_PM */
+static SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume);
+
static const struct i2c_device_id tmp102_id[] = {
{ "tmp102", 0 },
{ }
@@ -298,7 +291,7 @@ MODULE_DEVICE_TABLE(i2c, tmp102_id);
static struct i2c_driver tmp102_driver = {
.driver.name = DRIVER_NAME,
- .driver.pm = TMP102_DEV_PM_OPS,
+ .driver.pm = &tmp102_dev_pm_ops,
.probe = tmp102_probe,
.remove = tmp102_remove,
.id_table = tmp102_id,