diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-11 15:26:36 -0400 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-07-12 06:04:54 -0400 |
commit | 4aacc4b1b13cecef90d9ccbf9cf3fb4cc99807a0 (patch) | |
tree | b0c2287891792477b6d4b20059400efca7b79a50 | |
parent | b9f1b45bacb6485838e0504c312ecabc90c1e273 (diff) |
i2c-stu300: Use struct dev_pm_ops for power management
Make the ST-Ericsson U300 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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r-- | drivers/i2c/busses/i2c-stu300.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index 79b785150c15..80dd1c074a08 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c | |||
@@ -979,31 +979,33 @@ stu300_probe(struct platform_device *pdev) | |||
979 | } | 979 | } |
980 | 980 | ||
981 | #ifdef CONFIG_PM | 981 | #ifdef CONFIG_PM |
982 | static int stu300_suspend(struct platform_device *pdev, pm_message_t state) | 982 | static int stu300_suspend(struct device *device) |
983 | { | 983 | { |
984 | struct stu300_dev *dev = platform_get_drvdata(pdev); | 984 | struct stu300_dev *dev = dev_get_drvdata(device); |
985 | 985 | ||
986 | /* Turn off everything */ | 986 | /* Turn off everything */ |
987 | stu300_wr8(0x00, dev->virtbase + I2C_CR); | 987 | stu300_wr8(0x00, dev->virtbase + I2C_CR); |
988 | return 0; | 988 | return 0; |
989 | } | 989 | } |
990 | 990 | ||
991 | static int stu300_resume(struct platform_device *pdev) | 991 | static int stu300_resume(struct device *device) |
992 | { | 992 | { |
993 | int ret = 0; | 993 | int ret = 0; |
994 | struct stu300_dev *dev = platform_get_drvdata(pdev); | 994 | struct stu300_dev *dev = dev_get_drvdata(device); |
995 | 995 | ||
996 | clk_enable(dev->clk); | 996 | clk_enable(dev->clk); |
997 | ret = stu300_init_hw(dev); | 997 | ret = stu300_init_hw(dev); |
998 | clk_disable(dev->clk); | 998 | clk_disable(dev->clk); |
999 | 999 | ||
1000 | if (ret != 0) | 1000 | if (ret != 0) |
1001 | dev_err(&pdev->dev, "error re-initializing hardware.\n"); | 1001 | dev_err(device, "error re-initializing hardware.\n"); |
1002 | return ret; | 1002 | return ret; |
1003 | } | 1003 | } |
1004 | |||
1005 | static SIMPLE_DEV_PM_OPS(stu300_pm, stu300_suspend, stu300_resume); | ||
1006 | #define STU300_I2C_PM (&stu300_pm) | ||
1004 | #else | 1007 | #else |
1005 | #define stu300_suspend NULL | 1008 | #define STU300_I2C_PM NULL |
1006 | #define stu300_resume NULL | ||
1007 | #endif | 1009 | #endif |
1008 | 1010 | ||
1009 | static int __exit | 1011 | static int __exit |
@@ -1028,10 +1030,9 @@ static struct platform_driver stu300_i2c_driver = { | |||
1028 | .driver = { | 1030 | .driver = { |
1029 | .name = NAME, | 1031 | .name = NAME, |
1030 | .owner = THIS_MODULE, | 1032 | .owner = THIS_MODULE, |
1033 | .pm = STU300_I2C_PM, | ||
1031 | }, | 1034 | }, |
1032 | .remove = __exit_p(stu300_remove), | 1035 | .remove = __exit_p(stu300_remove), |
1033 | .suspend = stu300_suspend, | ||
1034 | .resume = stu300_resume, | ||
1035 | 1036 | ||
1036 | }; | 1037 | }; |
1037 | 1038 | ||