diff options
Diffstat (limited to 'drivers/input/keyboard/max7359_keypad.c')
| -rw-r--r-- | drivers/input/keyboard/max7359_keypad.c | 40 | 
1 files changed, 17 insertions, 23 deletions
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c index 9091ff5ea80..430b5453972 100644 --- a/drivers/input/keyboard/max7359_keypad.c +++ b/drivers/input/keyboard/max7359_keypad.c @@ -17,6 +17,7 @@  #include <linux/i2c.h>  #include <linux/slab.h>  #include <linux/interrupt.h> +#include <linux/pm.h>  #include <linux/input.h>  #include <linux/input/matrix_keypad.h> @@ -178,10 +179,11 @@ static void max7359_initialize(struct i2c_client *client)  	max7359_fall_deepsleep(client);  } -static int __devinit max7359_probe(struct i2c_client *client, +static int max7359_probe(struct i2c_client *client,  					const struct i2c_device_id *id)  { -	const struct matrix_keymap_data *keymap_data = client->dev.platform_data; +	const struct matrix_keymap_data *keymap_data = +			dev_get_platdata(&client->dev);  	struct max7359_keypad *keypad;  	struct input_dev *input_dev;  	int ret; @@ -259,7 +261,7 @@ failed_free_mem:  	return error;  } -static int __devexit max7359_remove(struct i2c_client *client) +static int max7359_remove(struct i2c_client *client)  {  	struct max7359_keypad *keypad = i2c_get_clientdata(client); @@ -270,9 +272,11 @@ static int __devexit max7359_remove(struct i2c_client *client)  	return 0;  } -#ifdef CONFIG_PM -static int max7359_suspend(struct i2c_client *client, pm_message_t mesg) +#ifdef CONFIG_PM_SLEEP +static int max7359_suspend(struct device *dev)  { +	struct i2c_client *client = to_i2c_client(dev); +  	max7359_fall_deepsleep(client);  	if (device_may_wakeup(&client->dev)) @@ -281,8 +285,10 @@ static int max7359_suspend(struct i2c_client *client, pm_message_t mesg)  	return 0;  } -static int max7359_resume(struct i2c_client *client) +static int max7359_resume(struct device *dev)  { +	struct i2c_client *client = to_i2c_client(dev); +  	if (device_may_wakeup(&client->dev))  		disable_irq_wake(client->irq); @@ -291,11 +297,10 @@ static int max7359_resume(struct i2c_client *client)  	return 0;  } -#else -#define max7359_suspend	NULL -#define max7359_resume	NULL  #endif +static SIMPLE_DEV_PM_OPS(max7359_pm, max7359_suspend, max7359_resume); +  static const struct i2c_device_id max7359_ids[] = {  	{ "max7359", 0 },  	{ } @@ -305,25 +310,14 @@ MODULE_DEVICE_TABLE(i2c, max7359_ids);  static struct i2c_driver max7359_i2c_driver = {  	.driver = {  		.name = "max7359", +		.pm   = &max7359_pm,  	},  	.probe		= max7359_probe, -	.remove		= __devexit_p(max7359_remove), -	.suspend	= max7359_suspend, -	.resume		= max7359_resume, +	.remove		= max7359_remove,  	.id_table	= max7359_ids,  }; -static int __init max7359_init(void) -{ -	return i2c_add_driver(&max7359_i2c_driver); -} -module_init(max7359_init); - -static void __exit max7359_exit(void) -{ -	i2c_del_driver(&max7359_i2c_driver); -} -module_exit(max7359_exit); +module_i2c_driver(max7359_i2c_driver);  MODULE_AUTHOR("Kim Kyuwon <q1.kim@samsung.com>");  MODULE_DESCRIPTION("MAX7359 Key Switch Controller Driver");  | 
