diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-01-07 07:12:22 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-01-07 14:19:43 -0500 |
commit | f6dc1e5e3d4b523e1616b43beddb04e4fb1d376a (patch) | |
tree | 9c6c27a06b7984e1c315d9d0ffa881f5b5f59701 | |
parent | d67e37d7933ba3b28a63ff38c957e433aaca5dc4 (diff) |
PCI PM: Put PM callbacks in the order of execution
Put PM callbacks in drivers/pci/pci-driver.c in the order in which
they are executed which makes it much easier to follow the code.
No functional changes should result from this.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r-- | drivers/pci/pci-driver.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index b7e67c2f40b9..c697f2680856 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -384,6 +384,19 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state) | |||
384 | return i; | 384 | return i; |
385 | } | 385 | } |
386 | 386 | ||
387 | static int pci_legacy_resume_early(struct device *dev) | ||
388 | { | ||
389 | int error = 0; | ||
390 | struct pci_dev * pci_dev = to_pci_dev(dev); | ||
391 | struct pci_driver * drv = pci_dev->driver; | ||
392 | |||
393 | pci_fixup_device(pci_fixup_resume_early, pci_dev); | ||
394 | |||
395 | if (drv && drv->resume_early) | ||
396 | error = drv->resume_early(pci_dev); | ||
397 | return error; | ||
398 | } | ||
399 | |||
387 | static int pci_legacy_resume(struct device *dev) | 400 | static int pci_legacy_resume(struct device *dev) |
388 | { | 401 | { |
389 | int error; | 402 | int error; |
@@ -402,19 +415,6 @@ static int pci_legacy_resume(struct device *dev) | |||
402 | return error; | 415 | return error; |
403 | } | 416 | } |
404 | 417 | ||
405 | static int pci_legacy_resume_early(struct device *dev) | ||
406 | { | ||
407 | int error = 0; | ||
408 | struct pci_dev * pci_dev = to_pci_dev(dev); | ||
409 | struct pci_driver * drv = pci_dev->driver; | ||
410 | |||
411 | pci_fixup_device(pci_fixup_resume_early, pci_dev); | ||
412 | |||
413 | if (drv && drv->resume_early) | ||
414 | error = drv->resume_early(pci_dev); | ||
415 | return error; | ||
416 | } | ||
417 | |||
418 | /* Auxiliary functions used by the new power management framework */ | 418 | /* Auxiliary functions used by the new power management framework */ |
419 | 419 | ||
420 | static int pci_restore_standard_config(struct pci_dev *pci_dev) | 420 | static int pci_restore_standard_config(struct pci_dev *pci_dev) |
@@ -569,36 +569,36 @@ static int pci_pm_suspend_noirq(struct device *dev) | |||
569 | return error; | 569 | return error; |
570 | } | 570 | } |
571 | 571 | ||
572 | static int pci_pm_resume(struct device *dev) | 572 | static int pci_pm_resume_noirq(struct device *dev) |
573 | { | 573 | { |
574 | struct pci_dev *pci_dev = to_pci_dev(dev); | 574 | struct pci_dev *pci_dev = to_pci_dev(dev); |
575 | struct device_driver *drv = dev->driver; | 575 | struct device_driver *drv = dev->driver; |
576 | int error = 0; | 576 | int error = 0; |
577 | 577 | ||
578 | if (pci_has_legacy_pm_support(pci_dev)) | 578 | if (pci_has_legacy_pm_support(pci_dev)) |
579 | return pci_legacy_resume(dev); | 579 | return pci_legacy_resume_early(dev); |
580 | 580 | ||
581 | error = pci_pm_default_resume(pci_dev); | 581 | pci_pm_default_resume_noirq(pci_dev); |
582 | 582 | ||
583 | if (!error && drv && drv->pm && drv->pm->resume) | 583 | if (drv && drv->pm && drv->pm->resume_noirq) |
584 | error = drv->pm->resume(dev); | 584 | error = drv->pm->resume_noirq(dev); |
585 | 585 | ||
586 | return error; | 586 | return error; |
587 | } | 587 | } |
588 | 588 | ||
589 | static int pci_pm_resume_noirq(struct device *dev) | 589 | static int pci_pm_resume(struct device *dev) |
590 | { | 590 | { |
591 | struct pci_dev *pci_dev = to_pci_dev(dev); | 591 | struct pci_dev *pci_dev = to_pci_dev(dev); |
592 | struct device_driver *drv = dev->driver; | 592 | struct device_driver *drv = dev->driver; |
593 | int error = 0; | 593 | int error = 0; |
594 | 594 | ||
595 | if (pci_has_legacy_pm_support(pci_dev)) | 595 | if (pci_has_legacy_pm_support(pci_dev)) |
596 | return pci_legacy_resume_early(dev); | 596 | return pci_legacy_resume(dev); |
597 | 597 | ||
598 | pci_pm_default_resume_noirq(pci_dev); | 598 | error = pci_pm_default_resume(pci_dev); |
599 | 599 | ||
600 | if (drv && drv->pm && drv->pm->resume_noirq) | 600 | if (!error && drv && drv->pm && drv->pm->resume) |
601 | error = drv->pm->resume_noirq(dev); | 601 | error = drv->pm->resume(dev); |
602 | 602 | ||
603 | return error; | 603 | return error; |
604 | } | 604 | } |
@@ -654,36 +654,36 @@ static int pci_pm_freeze_noirq(struct device *dev) | |||
654 | return error; | 654 | return error; |
655 | } | 655 | } |
656 | 656 | ||
657 | static int pci_pm_thaw(struct device *dev) | 657 | static int pci_pm_thaw_noirq(struct device *dev) |
658 | { | 658 | { |
659 | struct pci_dev *pci_dev = to_pci_dev(dev); | 659 | struct pci_dev *pci_dev = to_pci_dev(dev); |
660 | struct device_driver *drv = dev->driver; | 660 | struct device_driver *drv = dev->driver; |
661 | int error = 0; | 661 | int error = 0; |
662 | 662 | ||
663 | if (pci_has_legacy_pm_support(pci_dev)) | 663 | if (pci_has_legacy_pm_support(pci_dev)) |
664 | return pci_legacy_resume(dev); | 664 | return pci_legacy_resume_early(dev); |
665 | 665 | ||
666 | pci_pm_reenable_device(pci_dev); | 666 | pci_update_current_state(pci_dev, PCI_D0); |
667 | 667 | ||
668 | if (drv && drv->pm && drv->pm->thaw) | 668 | if (drv && drv->pm && drv->pm->thaw_noirq) |
669 | error = drv->pm->thaw(dev); | 669 | error = drv->pm->thaw_noirq(dev); |
670 | 670 | ||
671 | return error; | 671 | return error; |
672 | } | 672 | } |
673 | 673 | ||
674 | static int pci_pm_thaw_noirq(struct device *dev) | 674 | static int pci_pm_thaw(struct device *dev) |
675 | { | 675 | { |
676 | struct pci_dev *pci_dev = to_pci_dev(dev); | 676 | struct pci_dev *pci_dev = to_pci_dev(dev); |
677 | struct device_driver *drv = dev->driver; | 677 | struct device_driver *drv = dev->driver; |
678 | int error = 0; | 678 | int error = 0; |
679 | 679 | ||
680 | if (pci_has_legacy_pm_support(pci_dev)) | 680 | if (pci_has_legacy_pm_support(pci_dev)) |
681 | return pci_legacy_resume_early(dev); | 681 | return pci_legacy_resume(dev); |
682 | 682 | ||
683 | pci_update_current_state(pci_dev, PCI_D0); | 683 | pci_pm_reenable_device(pci_dev); |
684 | 684 | ||
685 | if (drv && drv->pm && drv->pm->thaw_noirq) | 685 | if (drv && drv->pm && drv->pm->thaw) |
686 | error = drv->pm->thaw_noirq(dev); | 686 | error = drv->pm->thaw(dev); |
687 | 687 | ||
688 | return error; | 688 | return error; |
689 | } | 689 | } |
@@ -724,36 +724,36 @@ static int pci_pm_poweroff_noirq(struct device *dev) | |||
724 | return error; | 724 | return error; |
725 | } | 725 | } |
726 | 726 | ||
727 | static int pci_pm_restore(struct device *dev) | 727 | static int pci_pm_restore_noirq(struct device *dev) |
728 | { | 728 | { |
729 | struct pci_dev *pci_dev = to_pci_dev(dev); | 729 | struct pci_dev *pci_dev = to_pci_dev(dev); |
730 | struct device_driver *drv = dev->driver; | 730 | struct device_driver *drv = dev->driver; |
731 | int error = 0; | 731 | int error = 0; |
732 | 732 | ||
733 | if (pci_has_legacy_pm_support(pci_dev)) | 733 | if (pci_has_legacy_pm_support(pci_dev)) |
734 | return pci_legacy_resume(dev); | 734 | return pci_legacy_resume_early(dev); |
735 | 735 | ||
736 | error = pci_pm_default_resume(pci_dev); | 736 | pci_pm_default_resume_noirq(pci_dev); |
737 | 737 | ||
738 | if (!error && drv && drv->pm && drv->pm->restore) | 738 | if (drv && drv->pm && drv->pm->restore_noirq) |
739 | error = drv->pm->restore(dev); | 739 | error = drv->pm->restore_noirq(dev); |
740 | 740 | ||
741 | return error; | 741 | return error; |
742 | } | 742 | } |
743 | 743 | ||
744 | static int pci_pm_restore_noirq(struct device *dev) | 744 | static int pci_pm_restore(struct device *dev) |
745 | { | 745 | { |
746 | struct pci_dev *pci_dev = to_pci_dev(dev); | 746 | struct pci_dev *pci_dev = to_pci_dev(dev); |
747 | struct device_driver *drv = dev->driver; | 747 | struct device_driver *drv = dev->driver; |
748 | int error = 0; | 748 | int error = 0; |
749 | 749 | ||
750 | if (pci_has_legacy_pm_support(pci_dev)) | 750 | if (pci_has_legacy_pm_support(pci_dev)) |
751 | return pci_legacy_resume_early(dev); | 751 | return pci_legacy_resume(dev); |
752 | 752 | ||
753 | pci_pm_default_resume_noirq(pci_dev); | 753 | error = pci_pm_default_resume(pci_dev); |
754 | 754 | ||
755 | if (drv && drv->pm && drv->pm->restore_noirq) | 755 | if (!error && drv && drv->pm && drv->pm->restore) |
756 | error = drv->pm->restore_noirq(dev); | 756 | error = drv->pm->restore(dev); |
757 | 757 | ||
758 | return error; | 758 | return error; |
759 | } | 759 | } |