Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[sfrench/cifs-2.6.git] / drivers / scsi / aacraid / linit.c
index d55332de08f91ad8e54e1296867569a8fa109a34..b3b931ab77ebdfc2190b113489bb1bcf81edd623 100644 (file)
@@ -683,6 +683,9 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
        u32 bus, cid;
        int ret = FAILED;
 
+       if (aac_adapter_check_health(aac))
+               return ret;
+
        bus = aac_logical_to_phys(scmd_channel(cmd));
        cid = scmd_id(cmd);
        if (aac->hba_map[bus][cid].devtype == AAC_DEVTYPE_NATIVE_RAW) {
@@ -690,7 +693,6 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
                struct aac_hba_tm_req *tmf;
                int status;
                u64 address;
-               __le32 managed_request_id;
 
                pr_err("%s: Host adapter abort request (%d,%d,%d,%d)\n",
                 AAC_DRIVERNAME,
@@ -703,8 +705,6 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
                                (fib->flags & FIB_CONTEXT_FLAG_NATIVE_HBA) &&
                                (fib->callback_data == cmd)) {
                                found = 1;
-                               managed_request_id = ((struct aac_hba_cmd_req *)
-                                       fib->hw_fib_va)->request_id;
                                break;
                        }
                }
@@ -1375,18 +1375,15 @@ static ssize_t aac_store_reset_adapter(struct device *device,
                                       const char *buf, size_t count)
 {
        int retval = -EACCES;
-       int bled = 0;
-       struct aac_dev *aac;
-
 
        if (!capable(CAP_SYS_ADMIN))
                return retval;
 
-       aac = (struct aac_dev *)class_to_shost(device)->hostdata;
-       bled = buf[0] == '!' ? 1:0;
-       retval = aac_reset_adapter(aac, bled, IOP_HWSOFT_RESET);
+       retval = aac_reset_adapter(shost_priv(class_to_shost(device)),
+                                       buf[0] == '!', IOP_HWSOFT_RESET);
        if (retval >= 0)
                retval = count;
+
        return retval;
 }
 
@@ -1689,6 +1686,9 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        spin_lock_init(&aac->fib_lock);
 
        mutex_init(&aac->ioctl_mutex);
+       mutex_init(&aac->scan_mutex);
+
+       INIT_DELAYED_WORK(&aac->safw_rescan_work, aac_safw_rescan_worker);
        /*
         *      Map in the registers from the adapter.
         */
@@ -1792,7 +1792,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        error = scsi_add_host(shost, &pdev->dev);
        if (error)
                goto out_deinit;
-       scsi_scan_host(shost);
+
+       aac_scan_host(aac);
 
        pci_enable_pcie_error_reporting(pdev);
        pci_save_state(pdev);
@@ -1877,6 +1878,7 @@ static int aac_suspend(struct pci_dev *pdev, pm_message_t state)
        struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
 
        scsi_block_requests(shost);
+       aac_cancel_safw_rescan_worker(aac);
        aac_send_shutdown(aac);
 
        aac_release_resources(aac);
@@ -1935,6 +1937,7 @@ static void aac_remove_one(struct pci_dev *pdev)
        struct Scsi_Host *shost = pci_get_drvdata(pdev);
        struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
 
+       aac_cancel_safw_rescan_worker(aac);
        scsi_remove_host(shost);
 
        __aac_shutdown(aac);
@@ -1992,6 +1995,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
                aac->handle_pci_error = 1;
 
                scsi_block_requests(aac->scsi_host_ptr);
+               aac_cancel_safw_rescan_worker(aac);
                aac_flush_ios(aac);
                aac_release_resources(aac);
 
@@ -2076,7 +2080,7 @@ static void aac_pci_resume(struct pci_dev *pdev)
                if (sdev->sdev_state == SDEV_OFFLINE)
                        sdev->sdev_state = SDEV_RUNNING;
        scsi_unblock_requests(aac->scsi_host_ptr);
-       scsi_scan_host(aac->scsi_host_ptr);
+       aac_scan_host(aac);
        pci_save_state(pdev);
 
        dev_err(&pdev->dev, "aacraid: PCI error - resume\n");