diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-11 15:25:17 -0400 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-07-12 06:04:49 -0400 |
commit | 783414ba9a65fa15e44716dc478e9536d202e0ff (patch) | |
tree | 7419fbb15ca37b2f3e7932abb1555f56e10b00cd | |
parent | 84603c7c2e94bd1394f29fbfbd289432565ee2e8 (diff) |
i2c-pnx: Use struct dev_pm_ops for power management
Make the PNX 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-pnx.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 99389d2eae51..5d54416770b0 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
@@ -587,25 +587,27 @@ static struct i2c_algorithm pnx_algorithm = { | |||
587 | }; | 587 | }; |
588 | 588 | ||
589 | #ifdef CONFIG_PM | 589 | #ifdef CONFIG_PM |
590 | static int i2c_pnx_controller_suspend(struct platform_device *pdev, | 590 | static int i2c_pnx_controller_suspend(struct device *dev) |
591 | pm_message_t state) | ||
592 | { | 591 | { |
593 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); | 592 | struct i2c_pnx_algo_data *alg_data = dev_get_drvdata(dev); |
594 | 593 | ||
595 | clk_disable(alg_data->clk); | 594 | clk_disable(alg_data->clk); |
596 | 595 | ||
597 | return 0; | 596 | return 0; |
598 | } | 597 | } |
599 | 598 | ||
600 | static int i2c_pnx_controller_resume(struct platform_device *pdev) | 599 | static int i2c_pnx_controller_resume(struct device *dev) |
601 | { | 600 | { |
602 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); | 601 | struct i2c_pnx_algo_data *alg_data = dev_get_drvdata(dev); |
603 | 602 | ||
604 | return clk_enable(alg_data->clk); | 603 | return clk_enable(alg_data->clk); |
605 | } | 604 | } |
605 | |||
606 | static SIMPLE_DEV_PM_OPS(i2c_pnx_pm, | ||
607 | i2c_pnx_controller_suspend, i2c_pnx_controller_resume); | ||
608 | #define PNX_I2C_PM (&i2c_pnx_pm) | ||
606 | #else | 609 | #else |
607 | #define i2c_pnx_controller_suspend NULL | 610 | #define PNX_I2C_PM NULL |
608 | #define i2c_pnx_controller_resume NULL | ||
609 | #endif | 611 | #endif |
610 | 612 | ||
611 | static int __devinit i2c_pnx_probe(struct platform_device *pdev) | 613 | static int __devinit i2c_pnx_probe(struct platform_device *pdev) |
@@ -783,11 +785,10 @@ static struct platform_driver i2c_pnx_driver = { | |||
783 | .name = "pnx-i2c", | 785 | .name = "pnx-i2c", |
784 | .owner = THIS_MODULE, | 786 | .owner = THIS_MODULE, |
785 | .of_match_table = of_match_ptr(i2c_pnx_of_match), | 787 | .of_match_table = of_match_ptr(i2c_pnx_of_match), |
788 | .pm = PNX_I2C_PM, | ||
786 | }, | 789 | }, |
787 | .probe = i2c_pnx_probe, | 790 | .probe = i2c_pnx_probe, |
788 | .remove = __devexit_p(i2c_pnx_remove), | 791 | .remove = __devexit_p(i2c_pnx_remove), |
789 | .suspend = i2c_pnx_controller_suspend, | ||
790 | .resume = i2c_pnx_controller_resume, | ||
791 | }; | 792 | }; |
792 | 793 | ||
793 | static int __init i2c_adap_pnx_init(void) | 794 | static int __init i2c_adap_pnx_init(void) |