aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci-driver.c52
1 files changed, 19 insertions, 33 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 2e76945a1cd8..02bf4d4125e4 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -365,6 +365,9 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
365 */ 365 */
366 pci_pm_set_unknown_state(pci_dev); 366 pci_pm_set_unknown_state(pci_dev);
367 } 367 }
368
369 pci_fixup_device(pci_fixup_suspend, pci_dev);
370
368 return i; 371 return i;
369} 372}
370 373
@@ -387,6 +390,8 @@ static int pci_legacy_resume(struct device *dev)
387 struct pci_dev * pci_dev = to_pci_dev(dev); 390 struct pci_dev * pci_dev = to_pci_dev(dev);
388 struct pci_driver * drv = pci_dev->driver; 391 struct pci_driver * drv = pci_dev->driver;
389 392
393 pci_fixup_device(pci_fixup_resume, pci_dev);
394
390 if (drv && drv->resume) { 395 if (drv && drv->resume) {
391 error = drv->resume(pci_dev); 396 error = drv->resume(pci_dev);
392 } else { 397 } else {
@@ -403,6 +408,8 @@ static int pci_legacy_resume_early(struct device *dev)
403 struct pci_dev * pci_dev = to_pci_dev(dev); 408 struct pci_dev * pci_dev = to_pci_dev(dev);
404 struct pci_driver * drv = pci_dev->driver; 409 struct pci_driver * drv = pci_dev->driver;
405 410
411 pci_fixup_device(pci_fixup_resume_early, pci_dev);
412
406 if (drv && drv->resume_early) 413 if (drv && drv->resume_early)
407 error = drv->resume_early(pci_dev); 414 error = drv->resume_early(pci_dev);
408 return error; 415 return error;
@@ -526,10 +533,8 @@ static int pci_pm_suspend(struct device *dev)
526 struct device_driver *drv = dev->driver; 533 struct device_driver *drv = dev->driver;
527 int error = 0; 534 int error = 0;
528 535
529 if (pci_has_legacy_pm_support(pci_dev)) { 536 if (pci_has_legacy_pm_support(pci_dev))
530 error = pci_legacy_suspend(dev, PMSG_SUSPEND); 537 return pci_legacy_suspend(dev, PMSG_SUSPEND);
531 goto Exit;
532 }
533 538
534 if (drv && drv->pm) { 539 if (drv && drv->pm) {
535 if (drv->pm->suspend) { 540 if (drv->pm->suspend) {
@@ -540,7 +545,6 @@ static int pci_pm_suspend(struct device *dev)
540 pci_pm_default_suspend(pci_dev); 545 pci_pm_default_suspend(pci_dev);
541 } 546 }
542 547
543 Exit:
544 pci_fixup_device(pci_fixup_suspend, pci_dev); 548 pci_fixup_device(pci_fixup_suspend, pci_dev);
545 549
546 return error; 550 return error;
@@ -573,10 +577,8 @@ static int pci_pm_resume(struct device *dev)
573 struct device_driver *drv = dev->driver; 577 struct device_driver *drv = dev->driver;
574 int error = 0; 578 int error = 0;
575 579
576 if (pci_has_legacy_pm_support(pci_dev)) { 580 if (pci_has_legacy_pm_support(pci_dev))
577 pci_fixup_device(pci_fixup_resume, pci_dev);
578 return pci_legacy_resume(dev); 581 return pci_legacy_resume(dev);
579 }
580 582
581 if (drv && drv->pm) { 583 if (drv && drv->pm) {
582 pci_fixup_device(pci_fixup_resume, pci_dev); 584 pci_fixup_device(pci_fixup_resume, pci_dev);
@@ -596,10 +598,8 @@ static int pci_pm_resume_noirq(struct device *dev)
596 struct device_driver *drv = dev->driver; 598 struct device_driver *drv = dev->driver;
597 int error = 0; 599 int error = 0;
598 600
599 if (pci_has_legacy_pm_support(pci_dev)) { 601 if (pci_has_legacy_pm_support(pci_dev))
600 pci_fixup_device(pci_fixup_resume_early, pci_dev);
601 return pci_legacy_resume_early(dev); 602 return pci_legacy_resume_early(dev);
602 }
603 603
604 if (drv && drv->pm) { 604 if (drv && drv->pm) {
605 pci_fixup_device(pci_fixup_resume_early, pci_dev); 605 pci_fixup_device(pci_fixup_resume_early, pci_dev);
@@ -630,11 +630,8 @@ static int pci_pm_freeze(struct device *dev)
630 struct device_driver *drv = dev->driver; 630 struct device_driver *drv = dev->driver;
631 int error = 0; 631 int error = 0;
632 632
633 if (pci_has_legacy_pm_support(pci_dev)) { 633 if (pci_has_legacy_pm_support(pci_dev))
634 error = pci_legacy_suspend(dev, PMSG_FREEZE); 634 return pci_legacy_suspend(dev, PMSG_FREEZE);
635 pci_fixup_device(pci_fixup_suspend, pci_dev);
636 return error;
637 }
638 635
639 if (drv && drv->pm) { 636 if (drv && drv->pm) {
640 if (drv->pm->freeze) { 637 if (drv->pm->freeze) {
@@ -675,10 +672,8 @@ static int pci_pm_thaw(struct device *dev)
675 struct device_driver *drv = dev->driver; 672 struct device_driver *drv = dev->driver;
676 int error = 0; 673 int error = 0;
677 674
678 if (pci_has_legacy_pm_support(pci_dev)) { 675 if (pci_has_legacy_pm_support(pci_dev))
679 pci_fixup_device(pci_fixup_resume, pci_dev);
680 return pci_legacy_resume(dev); 676 return pci_legacy_resume(dev);
681 }
682 677
683 if (drv && drv->pm) { 678 if (drv && drv->pm) {
684 if (drv->pm->thaw) 679 if (drv->pm->thaw)
@@ -696,10 +691,8 @@ static int pci_pm_thaw_noirq(struct device *dev)
696 struct device_driver *drv = dev->driver; 691 struct device_driver *drv = dev->driver;
697 int error = 0; 692 int error = 0;
698 693
699 if (pci_has_legacy_pm_support(pci_dev)) { 694 if (pci_has_legacy_pm_support(pci_dev))
700 pci_fixup_device(pci_fixup_resume_early, to_pci_dev(dev));
701 return pci_legacy_resume_early(dev); 695 return pci_legacy_resume_early(dev);
702 }
703 696
704 if (drv && drv->pm) { 697 if (drv && drv->pm) {
705 if (drv->pm->thaw_noirq) 698 if (drv->pm->thaw_noirq)
@@ -717,10 +710,8 @@ static int pci_pm_poweroff(struct device *dev)
717 struct device_driver *drv = dev->driver; 710 struct device_driver *drv = dev->driver;
718 int error = 0; 711 int error = 0;
719 712
720 if (pci_has_legacy_pm_support(pci_dev)) { 713 if (pci_has_legacy_pm_support(pci_dev))
721 error = pci_legacy_suspend(dev, PMSG_HIBERNATE); 714 return pci_legacy_suspend(dev, PMSG_HIBERNATE);
722 goto Exit;
723 }
724 715
725 if (drv && drv->pm) { 716 if (drv && drv->pm) {
726 if (drv->pm->poweroff) { 717 if (drv->pm->poweroff) {
@@ -731,7 +722,6 @@ static int pci_pm_poweroff(struct device *dev)
731 pci_pm_default_suspend(pci_dev); 722 pci_pm_default_suspend(pci_dev);
732 } 723 }
733 724
734 Exit:
735 pci_fixup_device(pci_fixup_suspend, pci_dev); 725 pci_fixup_device(pci_fixup_suspend, pci_dev);
736 726
737 return error; 727 return error;
@@ -761,10 +751,8 @@ static int pci_pm_restore(struct device *dev)
761 struct device_driver *drv = dev->driver; 751 struct device_driver *drv = dev->driver;
762 int error = 0; 752 int error = 0;
763 753
764 if (pci_has_legacy_pm_support(pci_dev)) { 754 if (pci_has_legacy_pm_support(pci_dev))
765 pci_fixup_device(pci_fixup_resume, pci_dev);
766 return pci_legacy_resume(dev); 755 return pci_legacy_resume(dev);
767 }
768 756
769 if (drv && drv->pm) { 757 if (drv && drv->pm) {
770 pci_fixup_device(pci_fixup_resume, pci_dev); 758 pci_fixup_device(pci_fixup_resume, pci_dev);
@@ -784,10 +772,8 @@ static int pci_pm_restore_noirq(struct device *dev)
784 struct device_driver *drv = dev->driver; 772 struct device_driver *drv = dev->driver;
785 int error = 0; 773 int error = 0;
786 774
787 if (pci_has_legacy_pm_support(pci_dev)) { 775 if (pci_has_legacy_pm_support(pci_dev))
788 pci_fixup_device(pci_fixup_resume_early, pci_dev);
789 return pci_legacy_resume_early(dev); 776 return pci_legacy_resume_early(dev);
790 }
791 777
792 if (drv && drv->pm) { 778 if (drv && drv->pm) {
793 pci_fixup_device(pci_fixup_resume_early, pci_dev); 779 pci_fixup_device(pci_fixup_resume_early, pci_dev);