Skip to content

Commit 76e2c68

Browse files
brooniedtor
authored andcommitted
Input: max7359 - convert to dev_pm_ops
There is a general move to convert drivers to use dev_pm_ops rather than bus specific ops to facilitate core work. Do this conversion for max7359. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent 65b0c03 commit 76e2c68

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

‎drivers/input/keyboard/max7359_keypad.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/i2c.h>
1818
#include <linux/slab.h>
1919
#include <linux/interrupt.h>
20+
#include <linux/pm.h>
2021
#include <linux/input.h>
2122
#include <linux/input/matrix_keypad.h>
2223

@@ -271,8 +272,10 @@ static int __devexit max7359_remove(struct i2c_client *client)
271272
}
272273

273274
#ifdef CONFIG_PM
274-
static int max7359_suspend(struct i2c_client *client, pm_message_t mesg)
275+
static int max7359_suspend(struct device *dev)
275276
{
277+
struct i2c_client *client = to_i2c_client(dev);
278+
276279
max7359_fall_deepsleep(client);
277280

278281
if (device_may_wakeup(&client->dev))
@@ -281,8 +284,10 @@ static int max7359_suspend(struct i2c_client *client, pm_message_t mesg)
281284
return 0;
282285
}
283286

284-
static int max7359_resume(struct i2c_client *client)
287+
static int max7359_resume(struct device *dev)
285288
{
289+
struct i2c_client *client = to_i2c_client(dev);
290+
286291
if (device_may_wakeup(&client->dev))
287292
disable_irq_wake(client->irq);
288293

@@ -291,11 +296,10 @@ static int max7359_resume(struct i2c_client *client)
291296

292297
return 0;
293298
}
294-
#else
295-
#define max7359_suspend NULL
296-
#define max7359_resume NULL
297299
#endif
298300

301+
static SIMPLE_DEV_PM_OPS(max7359_pm, max7359_suspend, max7359_resume);
302+
299303
static const struct i2c_device_id max7359_ids[] = {
300304
{ "max7359", 0 },
301305
{ }
@@ -305,11 +309,10 @@ MODULE_DEVICE_TABLE(i2c, max7359_ids);
305309
static struct i2c_driver max7359_i2c_driver = {
306310
.driver = {
307311
.name = "max7359",
312+
.pm = &max7359_pm,
308313
},
309314
.probe = max7359_probe,
310315
.remove = __devexit_p(max7359_remove),
311-
.suspend = max7359_suspend,
312-
.resume = max7359_resume,
313316
.id_table = max7359_ids,
314317
};
315318

0 commit comments

Comments
 (0)