aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-07-02 01:58:45 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-07-06 13:27:26 -0400
commit770daa43379690667e6552d68d343111b357341d (patch)
treea52c28d533e2ed985a980c25bd15aac75cf520d4 /drivers/mtd/devices
parent70f7cb78ec534301d13af1786b86f13fd96147eb (diff)
mtd: spear_smi: Move suspend/resume to follow dev_pm_ops
Use dev_pm_ops to support PM specific callbacks. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r--drivers/mtd/devices/spear_smi.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index 67960362681..cffd36a916d 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -26,6 +26,7 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/param.h> 27#include <linux/param.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/pm.h>
29#include <linux/mtd/mtd.h> 30#include <linux/mtd/mtd.h>
30#include <linux/mtd/partitions.h> 31#include <linux/mtd/partitions.h>
31#include <linux/mtd/spear_smi.h> 32#include <linux/mtd/spear_smi.h>
@@ -1086,29 +1087,33 @@ static int __devexit spear_smi_remove(struct platform_device *pdev)
1086 return 0; 1087 return 0;
1087} 1088}
1088 1089
1089int spear_smi_suspend(struct platform_device *pdev, pm_message_t state) 1090#ifdef CONFIG_PM
1091static int spear_smi_suspend(struct device *dev)
1090{ 1092{
1091 struct spear_smi *dev = platform_get_drvdata(pdev); 1093 struct spear_smi *sdev = dev_get_drvdata(dev);
1092 1094
1093 if (dev && dev->clk) 1095 if (sdev && sdev->clk)
1094 clk_disable_unprepare(dev->clk); 1096 clk_disable_unprepare(sdev->clk);
1095 1097
1096 return 0; 1098 return 0;
1097} 1099}
1098 1100
1099int spear_smi_resume(struct platform_device *pdev) 1101static int spear_smi_resume(struct device *dev)
1100{ 1102{
1101 struct spear_smi *dev = platform_get_drvdata(pdev); 1103 struct spear_smi *sdev = dev_get_drvdata(dev);
1102 int ret = -EPERM; 1104 int ret = -EPERM;
1103 1105
1104 if (dev && dev->clk) 1106 if (sdev && sdev->clk)
1105 ret = clk_prepare_enable(dev->clk); 1107 ret = clk_prepare_enable(sdev->clk);
1106 1108
1107 if (!ret) 1109 if (!ret)
1108 spear_smi_hw_init(dev); 1110 spear_smi_hw_init(sdev);
1109 return ret; 1111 return ret;
1110} 1112}
1111 1113
1114static SIMPLE_DEV_PM_OPS(spear_smi_pm_ops, spear_smi_suspend, spear_smi_resume);
1115#endif
1116
1112#ifdef CONFIG_OF 1117#ifdef CONFIG_OF
1113static const struct of_device_id spear_smi_id_table[] = { 1118static const struct of_device_id spear_smi_id_table[] = {
1114 { .compatible = "st,spear600-smi" }, 1119 { .compatible = "st,spear600-smi" },
@@ -1123,11 +1128,12 @@ static struct platform_driver spear_smi_driver = {
1123 .bus = &platform_bus_type, 1128 .bus = &platform_bus_type,
1124 .owner = THIS_MODULE, 1129 .owner = THIS_MODULE,
1125 .of_match_table = of_match_ptr(spear_smi_id_table), 1130 .of_match_table = of_match_ptr(spear_smi_id_table),
1131#ifdef CONFIG_PM
1132 .pm = &spear_smi_pm_ops,
1133#endif
1126 }, 1134 },
1127 .probe = spear_smi_probe, 1135 .probe = spear_smi_probe,
1128 .remove = __devexit_p(spear_smi_remove), 1136 .remove = __devexit_p(spear_smi_remove),
1129 .suspend = spear_smi_suspend,
1130 .resume = spear_smi_resume,
1131}; 1137};
1132 1138
1133static int spear_smi_init(void) 1139static int spear_smi_init(void)