Skip to contentSkip to conversation

hwmon: max6639: Convert to dev_pm_ops

PATCH Applied Mark Brown 2 participants 5 messages Mar 22, 2012 – Mar 26, 2012 Hardware monitoring

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 hwmon: max6639: Convert to dev_pm_ops

The I2C specific PM operations have been deprecated and printing a warning on boot for over a year now.

---
 drivers/hwmon/max6639.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
drivers/hwmon/max6639.c +9 -4
index 193067e..c7ee58e 100644
@@ -596,8 +596,9 @@ static int max6639_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int max6639_suspend(struct i2c_client *client, pm_message_t mesg)
+static int max6639_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG);
 	if (data < 0)
 		return data;
@@ -606,8 +607,9 @@ static int max6639_suspend(struct i2c_client *client, pm_message_t mesg)
 			MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY);
 }
 
-static int max6639_resume(struct i2c_client *client)
+static int max6639_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG);
 	if (data < 0)
 		return data;
@@ -623,15 +625,18 @@ static const struct i2c_device_id max6639_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, max6639_id);
 
+static const struct dev_pm_ops max6639_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(max6639_suspend, max6639_resume)
+};
+
 static struct i2c_driver max6639_driver = {
 	.class = I2C_CLASS_HWMON,
 	.driver = {
 		   .name = "max6639",
+		   .pm = &max6639_pm_ops,
 		   },
 	.probe = max6639_probe,
 	.remove = max6639_remove,
-	.suspend = max6639_suspend,
-	.resume = max6639_resume,
 	.id_table = max6639_id,
 	.detect = max6639_detect,
 	.address_list = normal_i2c,
Signature · 7 lines
1.7.9.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Mark Brown

Hi Mark,

Quoted 5 lines · Mark Brown

The I2C specific PM operations have been deprecated and printing a warning on boot for over a year now.

---

Actually, there is a problem with your patch. With the patch applied, my nightly builds tell me:

Build: /home/groeck/local/linux-staging:hwmon:2:3

/tmp/linux.6026/drivers/hwmon/max6639.c:599: warning: 'max6639_suspend' defined but not used /tmp/linux.6026/drivers/hwmon/max6639.c:610: warning: 'max6639_resume' defined but not used
--------------------

This suggests that something is wrong if CONFIG_PM is not set (missing #ifdef around the suspend/resume functions ? Or is there some better way to do this without #ifdef ?).

I'll back out your patch for now. Please have a look.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

author
#3 lore raw

PATCH 1/1 hwmon: max6639: Convert to dev_pm_ops

In reply to Mark Brown

The I2C specific PM operations have been deprecated and printing a warning on boot for over a year now.

---
 drivers/hwmon/max6639.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
drivers/hwmon/max6639.c +10 -4
index 193067e..c028fd5 100644
@@ -596,8 +596,9 @@ static int max6639_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int max6639_suspend(struct i2c_client *client, pm_message_t mesg)
+static int max6639_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG);
 	if (data < 0)
 		return data;
@@ -606,8 +607,9 @@ static int max6639_suspend(struct i2c_client *client, pm_message_t mesg)
 			MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY);
 }
 
-static int max6639_resume(struct i2c_client *client)
+static int max6639_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG);
 	if (data < 0)
 		return data;
@@ -623,15 +625,19 @@ static const struct i2c_device_id max6639_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, max6639_id);
 
+static const struct dev_pm_ops max6639_pm_ops = {
+	.suspend = max6639_suspend,
+	.resume = max6639_resume,
+};
+
 static struct i2c_driver max6639_driver = {
 	.class = I2C_CLASS_HWMON,
 	.driver = {
 		   .name = "max6639",
+		   .pm = &max6639_pm_ops,
 		   },
 	.probe = max6639_probe,
 	.remove = max6639_remove,
-	.suspend = max6639_suspend,
-	.resume = max6639_resume,
 	.id_table = max6639_id,
 	.detect = max6639_detect,
 	.address_list = normal_i2c,
Signature · 7 lines
1.7.9.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors