aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/tmp102.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/tmp102.c')
-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)
253 return 0; 253 return 0;
254} 254}
255 255
256#ifdef CONFIG_PM 256#ifdef CONFIG_PM_SLEEP
257static int tmp102_suspend(struct device *dev) 257static int tmp102_suspend(struct device *dev)
258{ 258{
259 struct i2c_client *client = to_i2c_client(dev); 259 struct i2c_client *client = to_i2c_client(dev);
@@ -279,17 +279,10 @@ static int tmp102_resume(struct device *dev)
279 config &= ~TMP102_CONF_SD; 279 config &= ~TMP102_CONF_SD;
280 return i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, config); 280 return i2c_smbus_write_word_swapped(client, TMP102_CONF_REG, config);
281} 281}
282
283static const struct dev_pm_ops tmp102_dev_pm_ops = {
284 .suspend = tmp102_suspend,
285 .resume = tmp102_resume,
286};
287
288#define TMP102_DEV_PM_OPS (&tmp102_dev_pm_ops)
289#else
290#define TMP102_DEV_PM_OPS NULL
291#endif /* CONFIG_PM */ 282#endif /* CONFIG_PM */
292 283
284static SIMPLE_DEV_PM_OPS(tmp102_dev_pm_ops, tmp102_suspend, tmp102_resume);
285
293static const struct i2c_device_id tmp102_id[] = { 286static const struct i2c_device_id tmp102_id[] = {
294 { "tmp102", 0 }, 287 { "tmp102", 0 },
295 { } 288 { }
@@ -298,7 +291,7 @@ MODULE_DEVICE_TABLE(i2c, tmp102_id);
298 291
299static struct i2c_driver tmp102_driver = { 292static struct i2c_driver tmp102_driver = {
300 .driver.name = DRIVER_NAME, 293 .driver.name = DRIVER_NAME,
301 .driver.pm = TMP102_DEV_PM_OPS, 294 .driver.pm = &tmp102_dev_pm_ops,
302 .probe = tmp102_probe, 295 .probe = tmp102_probe,
303 .remove = tmp102_remove, 296 .remove = tmp102_remove,
304 .id_table = tmp102_id, 297 .id_table = tmp102_id,