diff options
author | Dmitry Shmidt | 2011-12-16 19:52:18 -0600 |
---|---|---|
committer | Praneeth Bajjuri | 2012-01-16 07:36:36 -0600 |
commit | f0dbf6daaa7cb0d202288a5fe3f0af25ccf30200 (patch) | |
tree | e55d138777edd15f2676cbb7a9f959e3a77a2293 | |
parent | ee598b32a2e75dc8397fd916cca59bbc6209c8fa (diff) | |
download | kernel-common-f0dbf6daaa7cb0d202288a5fe3f0af25ccf30200.tar.gz kernel-common-f0dbf6daaa7cb0d202288a5fe3f0af25ccf30200.tar.xz kernel-common-f0dbf6daaa7cb0d202288a5fe3f0af25ccf30200.zip |
mmc: Set suspend/resume bus operations if CONFIG_PM_RUNTIME is used
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r-- | drivers/mmc/core/bus.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 393d817ed04..e07d6c90cae 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -120,18 +120,19 @@ static int mmc_bus_remove(struct device *dev) | |||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | 122 | ||
123 | static int mmc_bus_suspend(struct device *dev, pm_message_t state) | 123 | static int mmc_bus_pm_suspend(struct device *dev) |
124 | { | 124 | { |
125 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 125 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
126 | struct mmc_card *card = mmc_dev_to_card(dev); | 126 | struct mmc_card *card = mmc_dev_to_card(dev); |
127 | int ret = 0; | 127 | int ret = 0; |
128 | pm_message_t state = { PM_EVENT_SUSPEND }; | ||
128 | 129 | ||
129 | if (dev->driver && drv->suspend) | 130 | if (dev->driver && drv->suspend) |
130 | ret = drv->suspend(card, state); | 131 | ret = drv->suspend(card, state); |
131 | return ret; | 132 | return ret; |
132 | } | 133 | } |
133 | 134 | ||
134 | static int mmc_bus_resume(struct device *dev) | 135 | static int mmc_bus_pm_resume(struct device *dev) |
135 | { | 136 | { |
136 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 137 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
137 | struct mmc_card *card = mmc_dev_to_card(dev); | 138 | struct mmc_card *card = mmc_dev_to_card(dev); |
@@ -143,7 +144,6 @@ static int mmc_bus_resume(struct device *dev) | |||
143 | } | 144 | } |
144 | 145 | ||
145 | #ifdef CONFIG_PM_RUNTIME | 146 | #ifdef CONFIG_PM_RUNTIME |
146 | |||
147 | static int mmc_runtime_suspend(struct device *dev) | 147 | static int mmc_runtime_suspend(struct device *dev) |
148 | { | 148 | { |
149 | struct mmc_card *card = mmc_dev_to_card(dev); | 149 | struct mmc_card *card = mmc_dev_to_card(dev); |
@@ -162,21 +162,13 @@ static int mmc_runtime_idle(struct device *dev) | |||
162 | { | 162 | { |
163 | return pm_runtime_suspend(dev); | 163 | return pm_runtime_suspend(dev); |
164 | } | 164 | } |
165 | #endif /* CONFIG_PM_RUNTIME */ | ||
165 | 166 | ||
166 | static const struct dev_pm_ops mmc_bus_pm_ops = { | 167 | static const struct dev_pm_ops mmc_bus_pm_ops = { |
167 | .runtime_suspend = mmc_runtime_suspend, | 168 | SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_pm_suspend, mmc_bus_pm_resume) |
168 | .runtime_resume = mmc_runtime_resume, | 169 | SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, mmc_runtime_idle) |
169 | .runtime_idle = mmc_runtime_idle, | ||
170 | }; | 170 | }; |
171 | 171 | ||
172 | #define MMC_PM_OPS_PTR (&mmc_bus_pm_ops) | ||
173 | |||
174 | #else /* !CONFIG_PM_RUNTIME */ | ||
175 | |||
176 | #define MMC_PM_OPS_PTR NULL | ||
177 | |||
178 | #endif /* !CONFIG_PM_RUNTIME */ | ||
179 | |||
180 | static struct bus_type mmc_bus_type = { | 172 | static struct bus_type mmc_bus_type = { |
181 | .name = "mmc", | 173 | .name = "mmc", |
182 | .dev_attrs = mmc_dev_attrs, | 174 | .dev_attrs = mmc_dev_attrs, |
@@ -184,9 +176,7 @@ static struct bus_type mmc_bus_type = { | |||
184 | .uevent = mmc_bus_uevent, | 176 | .uevent = mmc_bus_uevent, |
185 | .probe = mmc_bus_probe, | 177 | .probe = mmc_bus_probe, |
186 | .remove = mmc_bus_remove, | 178 | .remove = mmc_bus_remove, |
187 | .suspend = mmc_bus_suspend, | 179 | .pm = &mmc_bus_pm_ops, |
188 | .resume = mmc_bus_resume, | ||
189 | .pm = MMC_PM_OPS_PTR, | ||
190 | }; | 180 | }; |
191 | 181 | ||
192 | int mmc_register_bus(void) | 182 | int mmc_register_bus(void) |