hwmon: ina230: convert suspend/resume to dev_pm_ops
Laxman Dewangan [Wed, 25 Sep 2013 10:59:33 +0000 (15:59 +0530)]
In place of implement the suspend/resume in legacy way,
converting it to dev_pm_ops.

This will fix the following warning:
i2c-core: driver [ina230] using legacy suspend method
i2c-core: driver [ina230] using legacy resume method

Change-Id: Ibdd0323fdb2eabb3e83054482ee89ab95795d192
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/278860
GVS: Gerrit_Virtual_Submit
(cherry picked from commit b873084131c6ec10de6abe3e203bf66a1189eb4e)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>

drivers/hwmon/ina230.c

index b478813..ee20ac4 100644 (file)
@@ -745,19 +745,27 @@ static int ina230_remove(struct i2c_client *client)
        return 0;
 }
 
-
-static int ina230_suspend(struct i2c_client *client, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int ina230_suspend(struct device *dev)
 {
+       struct i2c_client *client = to_i2c_client(dev);
+
        return power_down_ina230(client);
 }
 
 
-static int ina230_resume(struct i2c_client *client)
+static int ina230_resume(struct device *dev)
 {
+       struct i2c_client *client = to_i2c_client(dev);
+
        evaluate_state(client);
        return 0;
 }
+#endif
 
+static const struct dev_pm_ops ina230_pm_ops = {
+       SET_SYSTEM_SLEEP_PM_OPS(ina230_suspend, ina230_resume)
+};
 
 static const struct i2c_device_id ina230_id[] = {
        {"ina226", 0 },
@@ -773,11 +781,10 @@ static struct i2c_driver ina230_driver = {
        .class          = I2C_CLASS_HWMON,
        .driver = {
                .name   = DRIVER_NAME,
+               .pm     = &ina230_pm_ops,
        },
        .probe          = ina230_probe,
        .remove         = ina230_remove,
-       .suspend        = ina230_suspend,
-       .resume         = ina230_resume,
        .id_table       = ina230_id,
 };