summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-07-18 18:51:55 +0530
committerSimone Willett <swillett@nvidia.com>2012-07-23 10:39:58 -0700
commit483d3d78b86237c86afc915615130021e5468162 (patch)
tree6d75dc3d1a2c33407a5cb5cd5acc383f59152eb8
parentcc3732d057f6bcb46b6fc2a68c91ca90b451b137 (diff)
mfd: tps80031: Use struct dev_pm_ops for power management
Make the tps80031 driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct i2c_driver Change-Id: I3963426c26eb7609794c6fe761d69f31ee630cb2 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/117330 Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/mfd/tps80031.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c
index b4c51e3b11ac..047c3801ea85 100644
--- a/drivers/mfd/tps80031.c
+++ b/drivers/mfd/tps80031.c
@@ -1316,8 +1316,9 @@ fail:
}
#ifdef CONFIG_PM
-static int tps80031_i2c_suspend(struct i2c_client *client, pm_message_t state)
+static int tps80031_i2c_suspend(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct tps80031 *tps80031 = i2c_get_clientdata(client);
if (client->irq)
disable_irq(client->irq);
@@ -1325,14 +1326,22 @@ static int tps80031_i2c_suspend(struct i2c_client *client, pm_message_t state)
return 0;
}
-static int tps80031_i2c_resume(struct i2c_client *client)
+static int tps80031_i2c_resume(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct tps80031 *tps80031 = i2c_get_clientdata(client);
tps80031_backup_battery_charger_control(tps80031, 1);
if (client->irq)
enable_irq(client->irq);
return 0;
}
+static const struct dev_pm_ops tps80031_dev_pm_ops = {
+ .suspend = tps80031_i2c_suspend,
+ .resume = tps80031_i2c_resume,
+};
+#define TPS80031_DEV_PM (&tps80031_dev_pm_ops)
+#else
+#define TPS80031_DEV_PM NULL
#endif
@@ -1346,13 +1355,10 @@ static struct i2c_driver tps80031_driver = {
.driver = {
.name = "tps80031",
.owner = THIS_MODULE,
+ .pm = TPS80031_DEV_PM,
},
.probe = tps80031_i2c_probe,
.remove = __devexit_p(tps80031_i2c_remove),
-#ifdef CONFIG_PM
- .suspend = tps80031_i2c_suspend,
- .resume = tps80031_i2c_resume,
-#endif
.id_table = tps80031_id_table,
};