Commit fbb89935 authored by Mark Brown's avatar Mark Brown Committed by Dmitry Torokhov

Input: adxl34x-i2c - convert to dev_pm_ops

There is a general move to convert drivers to use dev_pm_ops rather than
bus specific ones in order to facilitate core development. Do this
conversion for adxl34x-i2c.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 76e2c68f
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pm.h>
#include "adxl34x.h" #include "adxl34x.h"
static int adxl34x_smbus_read(struct device *dev, unsigned char reg) static int adxl34x_smbus_read(struct device *dev, unsigned char reg)
...@@ -105,8 +106,9 @@ static int __devexit adxl34x_i2c_remove(struct i2c_client *client) ...@@ -105,8 +106,9 @@ static int __devexit adxl34x_i2c_remove(struct i2c_client *client)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int adxl34x_i2c_suspend(struct i2c_client *client, pm_message_t message) static int adxl34x_i2c_suspend(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev);
struct adxl34x *ac = i2c_get_clientdata(client); struct adxl34x *ac = i2c_get_clientdata(client);
adxl34x_suspend(ac); adxl34x_suspend(ac);
...@@ -114,19 +116,20 @@ static int adxl34x_i2c_suspend(struct i2c_client *client, pm_message_t message) ...@@ -114,19 +116,20 @@ static int adxl34x_i2c_suspend(struct i2c_client *client, pm_message_t message)
return 0; return 0;
} }
static int adxl34x_i2c_resume(struct i2c_client *client) static int adxl34x_i2c_resume(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev);
struct adxl34x *ac = i2c_get_clientdata(client); struct adxl34x *ac = i2c_get_clientdata(client);
adxl34x_resume(ac); adxl34x_resume(ac);
return 0; return 0;
} }
#else
# define adxl34x_i2c_suspend NULL
# define adxl34x_i2c_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend,
adxl34x_i2c_resume);
static const struct i2c_device_id adxl34x_id[] = { static const struct i2c_device_id adxl34x_id[] = {
{ "adxl34x", 0 }, { "adxl34x", 0 },
{ } { }
...@@ -138,11 +141,10 @@ static struct i2c_driver adxl34x_driver = { ...@@ -138,11 +141,10 @@ static struct i2c_driver adxl34x_driver = {
.driver = { .driver = {
.name = "adxl34x", .name = "adxl34x",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &adxl34x_i2c_pm,
}, },
.probe = adxl34x_i2c_probe, .probe = adxl34x_i2c_probe,
.remove = __devexit_p(adxl34x_i2c_remove), .remove = __devexit_p(adxl34x_i2c_remove),
.suspend = adxl34x_i2c_suspend,
.resume = adxl34x_i2c_resume,
.id_table = adxl34x_id, .id_table = adxl34x_id,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment