diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-13 17:58:39 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-17 09:54:04 -0500 |
commit | 5d2031f2395728c765cf2bd7c1ebb6d51c4fe076 (patch) | |
tree | 2e6272a408f9054ade79d52a11693652d99e1a68 /drivers/bcma | |
parent | d32a102819eef99d4d87019266bea208447be0a0 (diff) |
bcma: convert suspend/resume to pm_ops
.. and avoid doing the unnecessary PCI operations - the PCI layer will
do them for us.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/host_pci.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index c1ca9e3ada5c..86dfeea77e1a 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
@@ -235,41 +235,32 @@ static void bcma_host_pci_remove(struct pci_dev *dev) | |||
235 | } | 235 | } |
236 | 236 | ||
237 | #ifdef CONFIG_PM | 237 | #ifdef CONFIG_PM |
238 | static int bcma_host_pci_suspend(struct pci_dev *dev, pm_message_t state) | 238 | static int bcma_host_pci_suspend(struct device *dev) |
239 | { | 239 | { |
240 | struct bcma_bus *bus = pci_get_drvdata(dev); | 240 | struct pci_dev *pdev = to_pci_dev(dev); |
241 | 241 | struct bcma_bus *bus = pci_get_drvdata(pdev); | |
242 | /* Host specific */ | ||
243 | pci_save_state(dev); | ||
244 | pci_disable_device(dev); | ||
245 | pci_set_power_state(dev, pci_choose_state(dev, state)); | ||
246 | 242 | ||
247 | bus->mapped_core = NULL; | 243 | bus->mapped_core = NULL; |
244 | |||
248 | return 0; | 245 | return 0; |
249 | } | 246 | } |
250 | 247 | ||
251 | static int bcma_host_pci_resume(struct pci_dev *dev) | 248 | static int bcma_host_pci_resume(struct device *dev) |
252 | { | 249 | { |
253 | struct bcma_bus *bus = pci_get_drvdata(dev); | 250 | struct pci_dev *pdev = to_pci_dev(dev); |
254 | int err; | 251 | struct bcma_bus *bus = pci_get_drvdata(pdev); |
255 | 252 | ||
256 | /* Host specific */ | 253 | return bcma_bus_resume(bus); |
257 | pci_set_power_state(dev, 0); | 254 | } |
258 | err = pci_enable_device(dev); | ||
259 | if (err) | ||
260 | return err; | ||
261 | pci_restore_state(dev); | ||
262 | 255 | ||
263 | /* Bus specific */ | 256 | static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend, |
264 | err = bcma_bus_resume(bus); | 257 | bcma_host_pci_resume); |
265 | if (err) | 258 | #define BCMA_PM_OPS (&bcma_pm_ops) |
266 | return err; | ||
267 | 259 | ||
268 | return 0; | ||
269 | } | ||
270 | #else /* CONFIG_PM */ | 260 | #else /* CONFIG_PM */ |
271 | # define bcma_host_pci_suspend NULL | 261 | |
272 | # define bcma_host_pci_resume NULL | 262 | #define BCMA_PM_OPS NULL |
263 | |||
273 | #endif /* CONFIG_PM */ | 264 | #endif /* CONFIG_PM */ |
274 | 265 | ||
275 | static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { | 266 | static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = { |
@@ -287,8 +278,7 @@ static struct pci_driver bcma_pci_bridge_driver = { | |||
287 | .id_table = bcma_pci_bridge_tbl, | 278 | .id_table = bcma_pci_bridge_tbl, |
288 | .probe = bcma_host_pci_probe, | 279 | .probe = bcma_host_pci_probe, |
289 | .remove = bcma_host_pci_remove, | 280 | .remove = bcma_host_pci_remove, |
290 | .suspend = bcma_host_pci_suspend, | 281 | .driver.pm = BCMA_PM_OPS, |
291 | .resume = bcma_host_pci_resume, | ||
292 | }; | 282 | }; |
293 | 283 | ||
294 | int __init bcma_host_pci_init(void) | 284 | int __init bcma_host_pci_init(void) |