diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-11 15:27:30 -0400 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-07-12 06:04:55 -0400 |
commit | 6a7b3c3c465cef29d92dfc3fbbff0d958aa8be04 (patch) | |
tree | d6e3bc2d826775d4d5d886068ce9f326cc78d2aa | |
parent | 4aacc4b1b13cecef90d9ccbf9cf3fb4cc99807a0 (diff) |
i2c-tegra: Use struct dev_pm_ops for power management
Make the Tegra 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>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
[wsa] adapt to of_match_ptr change
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r-- | drivers/i2c/busses/i2c-tegra.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index f00649c78b05..f85dee549e21 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -713,9 +713,9 @@ static int __devexit tegra_i2c_remove(struct platform_device *pdev) | |||
713 | } | 713 | } |
714 | 714 | ||
715 | #ifdef CONFIG_PM | 715 | #ifdef CONFIG_PM |
716 | static int tegra_i2c_suspend(struct platform_device *pdev, pm_message_t state) | 716 | static int tegra_i2c_suspend(struct device *dev) |
717 | { | 717 | { |
718 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); | 718 | struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); |
719 | 719 | ||
720 | i2c_lock_adapter(&i2c_dev->adapter); | 720 | i2c_lock_adapter(&i2c_dev->adapter); |
721 | i2c_dev->is_suspended = true; | 721 | i2c_dev->is_suspended = true; |
@@ -724,9 +724,9 @@ static int tegra_i2c_suspend(struct platform_device *pdev, pm_message_t state) | |||
724 | return 0; | 724 | return 0; |
725 | } | 725 | } |
726 | 726 | ||
727 | static int tegra_i2c_resume(struct platform_device *pdev) | 727 | static int tegra_i2c_resume(struct device *dev) |
728 | { | 728 | { |
729 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); | 729 | struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); |
730 | int ret; | 730 | int ret; |
731 | 731 | ||
732 | i2c_lock_adapter(&i2c_dev->adapter); | 732 | i2c_lock_adapter(&i2c_dev->adapter); |
@@ -744,6 +744,11 @@ static int tegra_i2c_resume(struct platform_device *pdev) | |||
744 | 744 | ||
745 | return 0; | 745 | return 0; |
746 | } | 746 | } |
747 | |||
748 | static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume); | ||
749 | #define TEGRA_I2C_PM (&tegra_i2c_pm) | ||
750 | #else | ||
751 | #define TEGRA_I2C_PM NULL | ||
747 | #endif | 752 | #endif |
748 | 753 | ||
749 | #if defined(CONFIG_OF) | 754 | #if defined(CONFIG_OF) |
@@ -759,14 +764,11 @@ MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); | |||
759 | static struct platform_driver tegra_i2c_driver = { | 764 | static struct platform_driver tegra_i2c_driver = { |
760 | .probe = tegra_i2c_probe, | 765 | .probe = tegra_i2c_probe, |
761 | .remove = __devexit_p(tegra_i2c_remove), | 766 | .remove = __devexit_p(tegra_i2c_remove), |
762 | #ifdef CONFIG_PM | ||
763 | .suspend = tegra_i2c_suspend, | ||
764 | .resume = tegra_i2c_resume, | ||
765 | #endif | ||
766 | .driver = { | 767 | .driver = { |
767 | .name = "tegra-i2c", | 768 | .name = "tegra-i2c", |
768 | .owner = THIS_MODULE, | 769 | .owner = THIS_MODULE, |
769 | .of_match_table = of_match_ptr(tegra_i2c_of_match), | 770 | .of_match_table = of_match_ptr(tegra_i2c_of_match), |
771 | .pm = TEGRA_I2C_PM, | ||
770 | }, | 772 | }, |
771 | }; | 773 | }; |
772 | 774 | ||