aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-03-08 09:56:38 -0400
committerMark Brown <broonie@kernel.org>2015-03-08 15:57:55 -0400
commitea022bbb0090975a21c581d8405fbe90043a6eda (patch)
tree18e5ced3efac5a588dced573e12ec4a46e587486 /drivers/spi
parent47875e81476bda8a9bd4875eb281b46e33027d42 (diff)
spi: Remove support for legacy PM
All SPI drivers have been converted from legacy suspend/resume callbacks to dev_pm_ops. So we can finally remove support for legacy PM from the SPI core. Since there aren't any special bus specific things to do during suspend/resume and since the PM core will automatically fallback directly to using the device's PM ops if no bus PM ops are specified there is no need to have any special SPI bus PM ops. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c64a3e59fce3..7a2b7a7cb650 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -129,125 +129,11 @@ static int spi_uevent(struct device *dev, struct kobj_uevent_env *env)
129 return 0; 129 return 0;
130} 130}
131 131
132#ifdef CONFIG_PM_SLEEP
133static int spi_legacy_suspend(struct device *dev, pm_message_t message)
134{
135 int value = 0;
136 struct spi_driver *drv = to_spi_driver(dev->driver);
137
138 /* suspend will stop irqs and dma; no more i/o */
139 if (drv) {
140 if (drv->suspend)
141 value = drv->suspend(to_spi_device(dev), message);
142 else
143 dev_dbg(dev, "... can't suspend\n");
144 }
145 return value;
146}
147
148static int spi_legacy_resume(struct device *dev)
149{
150 int value = 0;
151 struct spi_driver *drv = to_spi_driver(dev->driver);
152
153 /* resume may restart the i/o queue */
154 if (drv) {
155 if (drv->resume)
156 value = drv->resume(to_spi_device(dev));
157 else
158 dev_dbg(dev, "... can't resume\n");
159 }
160 return value;
161}
162
163static int spi_pm_suspend(struct device *dev)
164{
165 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
166
167 if (pm)
168 return pm_generic_suspend(dev);
169 else
170 return spi_legacy_suspend(dev, PMSG_SUSPEND);
171}
172
173static int spi_pm_resume(struct device *dev)
174{
175 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
176
177 if (pm)
178 return pm_generic_resume(dev);
179 else
180 return spi_legacy_resume(dev);
181}
182
183static int spi_pm_freeze(struct device *dev)
184{
185 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
186
187 if (pm)
188 return pm_generic_freeze(dev);
189 else
190 return spi_legacy_suspend(dev, PMSG_FREEZE);
191}
192
193static int spi_pm_thaw(struct device *dev)
194{
195 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
196
197 if (pm)
198 return pm_generic_thaw(dev);
199 else
200 return spi_legacy_resume(dev);
201}
202
203static int spi_pm_poweroff(struct device *dev)
204{
205 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
206
207 if (pm)
208 return pm_generic_poweroff(dev);
209 else
210 return spi_legacy_suspend(dev, PMSG_HIBERNATE);
211}
212
213static int spi_pm_restore(struct device *dev)
214{
215 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
216
217 if (pm)
218 return pm_generic_restore(dev);
219 else
220 return spi_legacy_resume(dev);
221}
222#else
223#define spi_pm_suspend NULL
224#define spi_pm_resume NULL
225#define spi_pm_freeze NULL
226#define spi_pm_thaw NULL
227#define spi_pm_poweroff NULL
228#define spi_pm_restore NULL
229#endif
230
231static const struct dev_pm_ops spi_pm = {
232 .suspend = spi_pm_suspend,
233 .resume = spi_pm_resume,
234 .freeze = spi_pm_freeze,
235 .thaw = spi_pm_thaw,
236 .poweroff = spi_pm_poweroff,
237 .restore = spi_pm_restore,
238 SET_RUNTIME_PM_OPS(
239 pm_generic_runtime_suspend,
240 pm_generic_runtime_resume,
241 NULL
242 )
243};
244
245struct bus_type spi_bus_type = { 132struct bus_type spi_bus_type = {
246 .name = "spi", 133 .name = "spi",
247 .dev_groups = spi_dev_groups, 134 .dev_groups = spi_dev_groups,
248 .match = spi_match_device, 135 .match = spi_match_device,
249 .uevent = spi_uevent, 136 .uevent = spi_uevent,
250 .pm = &spi_pm,
251}; 137};
252EXPORT_SYMBOL_GPL(spi_bus_type); 138EXPORT_SYMBOL_GPL(spi_bus_type);
253 139