aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-07-11 15:23:31 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-07-12 06:04:38 -0400
commit85777ad264695b6287b958627196bd70f72ca8ae (patch)
treeef8bfc8785097333057d3995a924b81e51a3e23f /drivers/i2c
parentf277d27cc40f77719d45d9f5abf3ae4e9bdb172f (diff)
i2c-bfin-twi: Use struct dev_pm_ops for power management
Make the Blackfin On-Chip Two Wire Interface 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> Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index cdb59e5b23f7..515822429b19 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -611,9 +611,9 @@ static struct i2c_algorithm bfin_twi_algorithm = {
611 .functionality = bfin_twi_functionality, 611 .functionality = bfin_twi_functionality,
612}; 612};
613 613
614static int i2c_bfin_twi_suspend(struct platform_device *pdev, pm_message_t state) 614static int i2c_bfin_twi_suspend(struct device *dev)
615{ 615{
616 struct bfin_twi_iface *iface = platform_get_drvdata(pdev); 616 struct bfin_twi_iface *iface = dev_get_drvdata(dev);
617 617
618 iface->saved_clkdiv = read_CLKDIV(iface); 618 iface->saved_clkdiv = read_CLKDIV(iface);
619 iface->saved_control = read_CONTROL(iface); 619 iface->saved_control = read_CONTROL(iface);
@@ -626,14 +626,14 @@ static int i2c_bfin_twi_suspend(struct platform_device *pdev, pm_message_t state
626 return 0; 626 return 0;
627} 627}
628 628
629static int i2c_bfin_twi_resume(struct platform_device *pdev) 629static int i2c_bfin_twi_resume(struct device *dev)
630{ 630{
631 struct bfin_twi_iface *iface = platform_get_drvdata(pdev); 631 struct bfin_twi_iface *iface = dev_get_drvdata(dev);
632 632
633 int rc = request_irq(iface->irq, bfin_twi_interrupt_entry, 633 int rc = request_irq(iface->irq, bfin_twi_interrupt_entry,
634 0, pdev->name, iface); 634 0, to_platform_device(dev)->name, iface);
635 if (rc) { 635 if (rc) {
636 dev_err(&pdev->dev, "Can't get IRQ %d !\n", iface->irq); 636 dev_err(dev, "Can't get IRQ %d !\n", iface->irq);
637 return -ENODEV; 637 return -ENODEV;
638 } 638 }
639 639
@@ -646,6 +646,9 @@ static int i2c_bfin_twi_resume(struct platform_device *pdev)
646 return 0; 646 return 0;
647} 647}
648 648
649static SIMPLE_DEV_PM_OPS(i2c_bfin_twi_pm,
650 i2c_bfin_twi_suspend, i2c_bfin_twi_resume);
651
649static int i2c_bfin_twi_probe(struct platform_device *pdev) 652static int i2c_bfin_twi_probe(struct platform_device *pdev)
650{ 653{
651 struct bfin_twi_iface *iface; 654 struct bfin_twi_iface *iface;
@@ -770,11 +773,10 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev)
770static struct platform_driver i2c_bfin_twi_driver = { 773static struct platform_driver i2c_bfin_twi_driver = {
771 .probe = i2c_bfin_twi_probe, 774 .probe = i2c_bfin_twi_probe,
772 .remove = i2c_bfin_twi_remove, 775 .remove = i2c_bfin_twi_remove,
773 .suspend = i2c_bfin_twi_suspend,
774 .resume = i2c_bfin_twi_resume,
775 .driver = { 776 .driver = {
776 .name = "i2c-bfin-twi", 777 .name = "i2c-bfin-twi",
777 .owner = THIS_MODULE, 778 .owner = THIS_MODULE,
779 .pm = &i2c_bfin_twi_pm,
778 }, 780 },
779}; 781};
780 782