]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/scsi/libsas/sas_scsi_host.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
[karo-tx-linux.git] / drivers / scsi / libsas / sas_scsi_host.c
index e58ca50517d5fe31f4db990704cb92a8ba451e49..f0b9b7bf1882b1c45e78cf3bc35b3aa820a3c402 100644 (file)
@@ -521,8 +521,7 @@ try_bus_reset:
        return FAILED;
 }
 
-static int sas_eh_handle_sas_errors(struct Scsi_Host *shost,
-                                   struct list_head *work_q)
+static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *work_q)
 {
        struct scsi_cmnd *cmd, *n;
        enum task_disposition res = TASK_IS_DONE;
@@ -608,7 +607,8 @@ static int sas_eh_handle_sas_errors(struct Scsi_Host *shost,
                        SAS_DPRINTK("task 0x%p is not at LU: I_T recover\n",
                                    task);
                        tmf_resp = sas_recover_I_T(task->dev);
-                       if (tmf_resp == TMF_RESP_FUNC_COMPLETE) {
+                       if (tmf_resp == TMF_RESP_FUNC_COMPLETE ||
+                           tmf_resp == -ENODEV) {
                                struct domain_device *dev = task->dev;
                                SAS_DPRINTK("I_T %016llx recovered\n",
                                            SAS_ADDR(task->dev->sas_addr));
@@ -658,7 +658,7 @@ static int sas_eh_handle_sas_errors(struct Scsi_Host *shost,
  out:
        list_splice_tail(&done, work_q);
        list_splice_tail_init(&ha->eh_ata_q, work_q);
-       return list_empty(work_q);
+       return;
 
  clear_q:
        SAS_DPRINTK("--- Exit %s -- clear_q\n", __func__);
@@ -682,10 +682,13 @@ void sas_scsi_recover_host(struct Scsi_Host *shost)
                    __func__, shost->host_busy, shost->host_failed);
        /*
         * Deal with commands that still have SAS tasks (i.e. they didn't
-        * complete via the normal sas_task completion mechanism)
+        * complete via the normal sas_task completion mechanism),
+        * SAS_HA_FROZEN gives eh dominion over all sas_task completion.
         */
        set_bit(SAS_HA_FROZEN, &ha->state);
-       if (sas_eh_handle_sas_errors(shost, &eh_work_q))
+       sas_eh_handle_sas_errors(shost, &eh_work_q);
+       clear_bit(SAS_HA_FROZEN, &ha->state);
+       if (list_empty(&eh_work_q))
                goto out;
 
        /*
@@ -699,7 +702,6 @@ void sas_scsi_recover_host(struct Scsi_Host *shost)
                scsi_eh_ready_devs(shost, &eh_work_q, &ha->eh_done_q);
 
 out:
-       clear_bit(SAS_HA_FROZEN, &ha->state);
        if (ha->lldd_max_execute_num > 1)
                wake_up_process(ha->core.queue_thread);
 
@@ -762,17 +764,10 @@ int sas_target_alloc(struct scsi_target *starget)
 {
        struct sas_rphy *rphy = dev_to_rphy(starget->dev.parent);
        struct domain_device *found_dev = sas_find_dev_by_rphy(rphy);
-       int res;
 
        if (!found_dev)
                return -ENODEV;
 
-       if (dev_is_sata(found_dev)) {
-               res = sas_ata_init_host_and_port(found_dev, starget);
-               if (res)
-                       return res;
-       }
-
        kref_get(&found_dev->kref);
        starget->hostdata = found_dev;
        return 0;
@@ -1012,16 +1007,6 @@ void sas_task_abort(struct sas_task *task)
        }
 }
 
-int sas_slave_alloc(struct scsi_device *scsi_dev)
-{
-       struct domain_device *dev = sdev_to_domain_dev(scsi_dev);
-
-       if (dev_is_sata(dev))
-               return ata_sas_port_init(dev->sata_dev.ap);
-
-       return 0;
-}
-
 void sas_target_destroy(struct scsi_target *starget)
 {
        struct domain_device *found_dev = starget->hostdata;
@@ -1082,6 +1067,5 @@ EXPORT_SYMBOL_GPL(sas_task_abort);
 EXPORT_SYMBOL_GPL(sas_phy_reset);
 EXPORT_SYMBOL_GPL(sas_eh_device_reset_handler);
 EXPORT_SYMBOL_GPL(sas_eh_bus_reset_handler);
-EXPORT_SYMBOL_GPL(sas_slave_alloc);
 EXPORT_SYMBOL_GPL(sas_target_destroy);
 EXPORT_SYMBOL_GPL(sas_ioctl);