diff options
author | Dan Murphy <dmurphy@ti.com> | 2011-09-15 08:16:16 -0500 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 13:00:39 +0200 |
commit | 947a0fd02db60bb6cf73212b2320424a55ed6553 (patch) | |
tree | a949f3cdd006540a383c3fe54bce30aa47af2e23 /drivers/input | |
parent | 0dba7fb462c5a0505d4d210f8e4df6f4d859991c (diff) | |
download | kernel_samsung_tuna-947a0fd02db60bb6cf73212b2320424a55ed6553.zip kernel_samsung_tuna-947a0fd02db60bb6cf73212b2320424a55ed6553.tar.gz kernel_samsung_tuna-947a0fd02db60bb6cf73212b2320424a55ed6553.tar.bz2 |
mpu3050 gyro: Update suspend/resume to dev_pm_ops
Update the power management suspend/resume to use
the dev_pm_ops instead of legacy suspend/resume callbacks
Change-Id: Ifb32f4351cf33ce5087081e06b45191ef9ac621c
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/mpu3050.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c index 16f13cd..8d8f214 100644 --- a/drivers/input/misc/mpu3050.c +++ b/drivers/input/misc/mpu3050.c @@ -27,6 +27,8 @@ #include <linux/input.h> #include <linux/workqueue.h> #include <linux/i2c.h> +#include <linux/pm.h> +#include <linux/platform_device.h> #include <linux/i2c/mpu3050.h> #include <linux/gpio.h> @@ -676,10 +678,10 @@ static int __devexit mpu3050_driver_remove(struct i2c_client *client) } #ifdef CONFIG_PM -static int mpu3050_driver_suspend(struct i2c_client *client, - pm_message_t mesg) +static int mpu3050_driver_suspend(struct device *dev) { - struct mpu3050_gyro_data *data = i2c_get_clientdata(client); + struct platform_device *pdev = to_platform_device(dev); + struct mpu3050_gyro_data *data = platform_get_drvdata(pdev); mutex_lock(&data->mutex); if (!data->enable) { @@ -701,9 +703,10 @@ static int mpu3050_driver_suspend(struct i2c_client *client, return 0; } -static int mpu3050_driver_resume(struct i2c_client *client) +static int mpu3050_driver_resume(struct device *dev) { - struct mpu3050_gyro_data *data = i2c_get_clientdata(client); + struct platform_device *pdev = to_platform_device(dev); + struct mpu3050_gyro_data *data = platform_get_drvdata(pdev); mutex_lock(&data->mutex); if (data->enable) { @@ -729,6 +732,11 @@ static int mpu3050_driver_resume(struct i2c_client *client) return 0; } + +static const struct dev_pm_ops mpu3050_pm_ops = { + .suspend = mpu3050_driver_suspend, + .resume = mpu3050_driver_resume, +}; #endif static const struct i2c_device_id mpu3050_idtable[] = { @@ -742,12 +750,11 @@ static struct i2c_driver mpu3050_driver = { .probe = mpu3050_driver_probe, .remove = mpu3050_driver_remove, .id_table = mpu3050_idtable, + .driver = { + .name = DRIVER_NAME, #ifdef CONFIG_PM - .suspend = mpu3050_driver_suspend, - .resume = mpu3050_driver_resume, + .pm = &mpu3050_pm_ops, #endif - .driver = { - .name = DRIVER_NAME }, }; |