Skip to content

Commit 87b2c7d

Browse files
brooniedtor
authored andcommitted
Input: synaptics_i2c - convert to dev_pm_ops
There is a general move to convert drivers to dev_pm_ops rather than bus specific PM ops in order to facilitate core development. Do this converison for synaptics-i2c. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent 3dcab3b commit 87b2c7d

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎drivers/input/mouse/synaptics_i2c.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/delay.h>
1919
#include <linux/workqueue.h>
2020
#include <linux/slab.h>
21+
#include <linux/pm.h>
2122

2223
#define DRIVER_NAME "synaptics_i2c"
2324
/* maximum product id is 15 characters */
@@ -619,8 +620,9 @@ static int __devexit synaptics_i2c_remove(struct i2c_client *client)
619620
}
620621

621622
#ifdef CONFIG_PM
622-
static int synaptics_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
623+
static int synaptics_i2c_suspend(struct device *dev)
623624
{
625+
struct i2c_client *client = to_i2c_client(dev);
624626
struct synaptics_i2c *touch = i2c_get_clientdata(client);
625627

626628
cancel_delayed_work_sync(&touch->dwork);
@@ -631,9 +633,10 @@ static int synaptics_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
631633
return 0;
632634
}
633635

634-
static int synaptics_i2c_resume(struct i2c_client *client)
636+
static int synaptics_i2c_resume(struct device *dev)
635637
{
636638
int ret;
639+
struct i2c_client *client = to_i2c_client(dev);
637640
struct synaptics_i2c *touch = i2c_get_clientdata(client);
638641

639642
ret = synaptics_i2c_reset_config(client);
@@ -645,11 +648,11 @@ static int synaptics_i2c_resume(struct i2c_client *client)
645648

646649
return 0;
647650
}
648-
#else
649-
#define synaptics_i2c_suspend NULL
650-
#define synaptics_i2c_resume NULL
651651
#endif
652652

653+
static SIMPLE_DEV_PM_OPS(synaptics_i2c_pm, synaptics_i2c_suspend,
654+
synaptics_i2c_resume);
655+
653656
static const struct i2c_device_id synaptics_i2c_id_table[] = {
654657
{ "synaptics_i2c", 0 },
655658
{ },
@@ -660,13 +663,12 @@ static struct i2c_driver synaptics_i2c_driver = {
660663
.driver = {
661664
.name = DRIVER_NAME,
662665
.owner = THIS_MODULE,
666+
.pm = &synaptics_i2c_pm,
663667
},
664668

665669
.probe = synaptics_i2c_probe,
666670
.remove = __devexit_p(synaptics_i2c_remove),
667671

668-
.suspend = synaptics_i2c_suspend,
669-
.resume = synaptics_i2c_resume,
670672
.id_table = synaptics_i2c_id_table,
671673
};
672674

0 commit comments

Comments
 (0)