diff options
Diffstat (limited to 'drivers/scsi/libsas/sas_ata.c')
-rw-r--r-- | drivers/scsi/libsas/sas_ata.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index d2895836f9fa..766098af4eb7 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -700,46 +700,26 @@ void sas_probe_sata(struct asd_sas_port *port) | |||
700 | 700 | ||
701 | } | 701 | } |
702 | 702 | ||
703 | static bool sas_ata_flush_pm_eh(struct asd_sas_port *port, const char *func) | 703 | static void sas_ata_flush_pm_eh(struct asd_sas_port *port, const char *func) |
704 | { | 704 | { |
705 | struct domain_device *dev, *n; | 705 | struct domain_device *dev, *n; |
706 | bool retry = false; | ||
707 | 706 | ||
708 | list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) { | 707 | list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) { |
709 | int rc; | ||
710 | |||
711 | if (!dev_is_sata(dev)) | 708 | if (!dev_is_sata(dev)) |
712 | continue; | 709 | continue; |
713 | 710 | ||
714 | sas_ata_wait_eh(dev); | 711 | sas_ata_wait_eh(dev); |
715 | rc = dev->sata_dev.pm_result; | ||
716 | if (rc == -EAGAIN) | ||
717 | retry = true; | ||
718 | else if (rc) { | ||
719 | /* since we don't have a | ||
720 | * ->port_{suspend|resume} routine in our | ||
721 | * ata_port ops, and no entanglements with | ||
722 | * acpi, suspend should just be mechanical trip | ||
723 | * through eh, catch cases where these | ||
724 | * assumptions are invalidated | ||
725 | */ | ||
726 | WARN_ONCE(1, "failed %s %s error: %d\n", func, | ||
727 | dev_name(&dev->rphy->dev), rc); | ||
728 | } | ||
729 | 712 | ||
730 | /* if libata failed to power manage the device, tear it down */ | 713 | /* if libata failed to power manage the device, tear it down */ |
731 | if (ata_dev_disabled(sas_to_ata_dev(dev))) | 714 | if (ata_dev_disabled(sas_to_ata_dev(dev))) |
732 | sas_fail_probe(dev, func, -ENODEV); | 715 | sas_fail_probe(dev, func, -ENODEV); |
733 | } | 716 | } |
734 | |||
735 | return retry; | ||
736 | } | 717 | } |
737 | 718 | ||
738 | void sas_suspend_sata(struct asd_sas_port *port) | 719 | void sas_suspend_sata(struct asd_sas_port *port) |
739 | { | 720 | { |
740 | struct domain_device *dev; | 721 | struct domain_device *dev; |
741 | 722 | ||
742 | retry: | ||
743 | mutex_lock(&port->ha->disco_mutex); | 723 | mutex_lock(&port->ha->disco_mutex); |
744 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { | 724 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { |
745 | struct sata_device *sata; | 725 | struct sata_device *sata; |
@@ -751,20 +731,17 @@ void sas_suspend_sata(struct asd_sas_port *port) | |||
751 | if (sata->ap->pm_mesg.event == PM_EVENT_SUSPEND) | 731 | if (sata->ap->pm_mesg.event == PM_EVENT_SUSPEND) |
752 | continue; | 732 | continue; |
753 | 733 | ||
754 | sata->pm_result = -EIO; | 734 | ata_sas_port_suspend(sata->ap); |
755 | ata_sas_port_async_suspend(sata->ap, &sata->pm_result); | ||
756 | } | 735 | } |
757 | mutex_unlock(&port->ha->disco_mutex); | 736 | mutex_unlock(&port->ha->disco_mutex); |
758 | 737 | ||
759 | if (sas_ata_flush_pm_eh(port, __func__)) | 738 | sas_ata_flush_pm_eh(port, __func__); |
760 | goto retry; | ||
761 | } | 739 | } |
762 | 740 | ||
763 | void sas_resume_sata(struct asd_sas_port *port) | 741 | void sas_resume_sata(struct asd_sas_port *port) |
764 | { | 742 | { |
765 | struct domain_device *dev; | 743 | struct domain_device *dev; |
766 | 744 | ||
767 | retry: | ||
768 | mutex_lock(&port->ha->disco_mutex); | 745 | mutex_lock(&port->ha->disco_mutex); |
769 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { | 746 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { |
770 | struct sata_device *sata; | 747 | struct sata_device *sata; |
@@ -776,13 +753,11 @@ void sas_resume_sata(struct asd_sas_port *port) | |||
776 | if (sata->ap->pm_mesg.event == PM_EVENT_ON) | 753 | if (sata->ap->pm_mesg.event == PM_EVENT_ON) |
777 | continue; | 754 | continue; |
778 | 755 | ||
779 | sata->pm_result = -EIO; | 756 | ata_sas_port_resume(sata->ap); |
780 | ata_sas_port_async_resume(sata->ap, &sata->pm_result); | ||
781 | } | 757 | } |
782 | mutex_unlock(&port->ha->disco_mutex); | 758 | mutex_unlock(&port->ha->disco_mutex); |
783 | 759 | ||
784 | if (sas_ata_flush_pm_eh(port, __func__)) | 760 | sas_ata_flush_pm_eh(port, __func__); |
785 | goto retry; | ||
786 | } | 761 | } |
787 | 762 | ||
788 | /** | 763 | /** |