aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-07-11 15:24:15 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-07-12 06:04:39 -0400
commit84603c7c2e94bd1394f29fbfbd289432565ee2e8 (patch)
treec27c3d6dd75488985ef2813dc2efbbf293e6aa8c
parent85777ad264695b6287b958627196bd70f72ca8ae (diff)
i2c-ocores: Use struct dev_pm_ops for power management
Make the OpenCores I2C controller driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct platform_driver. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r--drivers/i2c/busses/i2c-ocores.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 75194c579b6d..d7d21d532557 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -367,9 +367,9 @@ static int __devexit ocores_i2c_remove(struct platform_device* pdev)
367} 367}
368 368
369#ifdef CONFIG_PM 369#ifdef CONFIG_PM
370static int ocores_i2c_suspend(struct platform_device *pdev, pm_message_t state) 370static int ocores_i2c_suspend(struct device *dev)
371{ 371{
372 struct ocores_i2c *i2c = platform_get_drvdata(pdev); 372 struct ocores_i2c *i2c = dev_get_drvdata(dev);
373 u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL); 373 u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL);
374 374
375 /* make sure the device is disabled */ 375 /* make sure the device is disabled */
@@ -378,17 +378,19 @@ static int ocores_i2c_suspend(struct platform_device *pdev, pm_message_t state)
378 return 0; 378 return 0;
379} 379}
380 380
381static int ocores_i2c_resume(struct platform_device *pdev) 381static int ocores_i2c_resume(struct device *dev)
382{ 382{
383 struct ocores_i2c *i2c = platform_get_drvdata(pdev); 383 struct ocores_i2c *i2c = dev_get_drvdata(dev);
384 384
385 ocores_init(i2c); 385 ocores_init(i2c);
386 386
387 return 0; 387 return 0;
388} 388}
389
390static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);
391#define OCORES_I2C_PM (&ocores_i2c_pm)
389#else 392#else
390#define ocores_i2c_suspend NULL 393#define OCORES_I2C_PM NULL
391#define ocores_i2c_resume NULL
392#endif 394#endif
393 395
394static struct of_device_id ocores_i2c_match[] = { 396static struct of_device_id ocores_i2c_match[] = {
@@ -400,12 +402,11 @@ MODULE_DEVICE_TABLE(of, ocores_i2c_match);
400static struct platform_driver ocores_i2c_driver = { 402static struct platform_driver ocores_i2c_driver = {
401 .probe = ocores_i2c_probe, 403 .probe = ocores_i2c_probe,
402 .remove = __devexit_p(ocores_i2c_remove), 404 .remove = __devexit_p(ocores_i2c_remove),
403 .suspend = ocores_i2c_suspend,
404 .resume = ocores_i2c_resume,
405 .driver = { 405 .driver = {
406 .owner = THIS_MODULE, 406 .owner = THIS_MODULE,
407 .name = "ocores-i2c", 407 .name = "ocores-i2c",
408 .of_match_table = ocores_i2c_match, 408 .of_match_table = ocores_i2c_match,
409 .pm = OCORES_I2C_PM,
409 }, 410 },
410}; 411};
411 412