aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2014-03-14 16:52:48 -0400
committerTejun Heo <tj@kernel.org>2014-03-18 16:08:38 -0400
commitbc6e7c4b0d1a1f742d96556f63d68f17f4e232c3 (patch)
tree1253c9a09dc834bbb42ef02e58ee0a117ed17ff8 /drivers/scsi/libsas
parent6a96918a6aa7b434d15710fc9e06589c6c8bd3a6 (diff)
libata, libsas: kill pm_result and related cleanup
Tejun says: "At least for libata, worrying about suspend/resume failures don't make whole lot of sense. If suspend failed, just proceed with suspend. If the device can't be woken up afterwards, that's that. There isn't anything we could have done differently anyway. The same for resume, if spinup fails, the device is dud and the following commands will invoke EH actions and will eventually fail. Again, there really isn't any *choice* to make. Just making sure the errors are handled gracefully (ie. don't crash) and the following commands are handled correctly should be enough." The only libata user that actually cares about the result from a suspend operation is libsas. However, it only cares about whether queuing a new operation collides with an in-flight one. All libsas does with the error is retry, but we can just let libata wait for the previous operation before continuing. Other cleanups include: 1/ Unifying all ata port pm operations on an ata_port_pm_ prefix 2/ Marking all ata port pm helper routines as returning void, only ata_port_pm_ entry points need to fake a 0 return value. 3/ Killing ata_port_{suspend|resume}_common() in favor of calling ata_port_request_pm() directly 4/ Killing the wrappers that just do a to_ata_port() conversion 5/ Clearly marking the entry points that do async operations with an _async suffix. Reference: http://marc.info/?l=linux-scsi&m=138995409532286&w=2 Cc: Phillip Susi <psusi@ubuntu.com> Cc: Alan Stern <stern@rowland.harvard.edu> Suggested-by: Tejun Heo <tj@kernel.org> Signed-off-by: Todd Brandt <todd.e.brandt@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/scsi/libsas')
-rw-r--r--drivers/scsi/libsas/sas_ata.c35
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
703static bool sas_ata_flush_pm_eh(struct asd_sas_port *port, const char *func) 703static 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
738void sas_suspend_sata(struct asd_sas_port *port) 719void 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
763void sas_resume_sata(struct asd_sas_port *port) 741void 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/**