diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/pci-driver.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 474e9cd0e9e4..9e7d6ceb3805 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -264,6 +264,19 @@ static int pci_device_remove(struct device * dev) | |||
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | 266 | ||
267 | static int pci_device_suspend_prepare(struct device * dev, pm_message_t state) | ||
268 | { | ||
269 | struct pci_dev * pci_dev = to_pci_dev(dev); | ||
270 | struct pci_driver * drv = pci_dev->driver; | ||
271 | int i = 0; | ||
272 | |||
273 | if (drv && drv->suspend_prepare) { | ||
274 | i = drv->suspend_prepare(pci_dev, state); | ||
275 | suspend_report_result(drv->suspend_prepare, i); | ||
276 | } | ||
277 | return i; | ||
278 | } | ||
279 | |||
267 | static int pci_device_suspend(struct device * dev, pm_message_t state) | 280 | static int pci_device_suspend(struct device * dev, pm_message_t state) |
268 | { | 281 | { |
269 | struct pci_dev * pci_dev = to_pci_dev(dev); | 282 | struct pci_dev * pci_dev = to_pci_dev(dev); |
@@ -279,6 +292,18 @@ static int pci_device_suspend(struct device * dev, pm_message_t state) | |||
279 | return i; | 292 | return i; |
280 | } | 293 | } |
281 | 294 | ||
295 | static int pci_device_suspend_late(struct device * dev, pm_message_t state) | ||
296 | { | ||
297 | struct pci_dev * pci_dev = to_pci_dev(dev); | ||
298 | struct pci_driver * drv = pci_dev->driver; | ||
299 | int i = 0; | ||
300 | |||
301 | if (drv && drv->suspend_late) { | ||
302 | i = drv->suspend_late(pci_dev, state); | ||
303 | suspend_report_result(drv->suspend_late, i); | ||
304 | } | ||
305 | return i; | ||
306 | } | ||
282 | 307 | ||
283 | /* | 308 | /* |
284 | * Default resume method for devices that have no driver provided resume, | 309 | * Default resume method for devices that have no driver provided resume, |
@@ -313,6 +338,17 @@ static int pci_device_resume(struct device * dev) | |||
313 | return error; | 338 | return error; |
314 | } | 339 | } |
315 | 340 | ||
341 | static int pci_device_resume_early(struct device * dev) | ||
342 | { | ||
343 | int error = 0; | ||
344 | struct pci_dev * pci_dev = to_pci_dev(dev); | ||
345 | struct pci_driver * drv = pci_dev->driver; | ||
346 | |||
347 | if (drv && drv->resume_early) | ||
348 | error = drv->resume_early(pci_dev); | ||
349 | return error; | ||
350 | } | ||
351 | |||
316 | static void pci_device_shutdown(struct device *dev) | 352 | static void pci_device_shutdown(struct device *dev) |
317 | { | 353 | { |
318 | struct pci_dev *pci_dev = to_pci_dev(dev); | 354 | struct pci_dev *pci_dev = to_pci_dev(dev); |
@@ -508,9 +544,12 @@ struct bus_type pci_bus_type = { | |||
508 | .uevent = pci_uevent, | 544 | .uevent = pci_uevent, |
509 | .probe = pci_device_probe, | 545 | .probe = pci_device_probe, |
510 | .remove = pci_device_remove, | 546 | .remove = pci_device_remove, |
547 | .suspend_prepare= pci_device_suspend_prepare, | ||
511 | .suspend = pci_device_suspend, | 548 | .suspend = pci_device_suspend, |
512 | .shutdown = pci_device_shutdown, | 549 | .suspend_late = pci_device_suspend_late, |
550 | .resume_early = pci_device_resume_early, | ||
513 | .resume = pci_device_resume, | 551 | .resume = pci_device_resume, |
552 | .shutdown = pci_device_shutdown, | ||
514 | .dev_attrs = pci_dev_attrs, | 553 | .dev_attrs = pci_dev_attrs, |
515 | }; | 554 | }; |
516 | 555 | ||