scsi: aacraid: Use hotplug handling function in place of scsi_scan_host
authorRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Wed, 27 Dec 2017 04:34:45 +0000 (20:34 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 4 Jan 2018 04:26:43 +0000 (23:26 -0500)
Driver uses scsi_scan_host to add new devices in the driver init path,
which adds all the fw exposed devices. The drivers resorts to queue
command checks to block out commands to _hidden_ devices.

Use the hotplug handler code to add new devices during driver init and
other areas, this is only for safw. For ARC scsi_scan_host will still
apply.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/commsup.c
drivers/scsi/aacraid/linit.c

index 4ad9d3f017af41353ab3981be0637881c68d6006..426c61a289260df6cfe7d9a540fb6221d8588d10 100644 (file)
@@ -2150,10 +2150,6 @@ int aac_get_adapter_info(struct aac_dev* dev)
                dev->maximum_num_channels = le32_to_cpu(bus_info->BusCount);
        }
 
-       if (!dev->sync_mode && dev->sa_firmware &&
-               dev->supplement_adapter_info.virt_device_bus != 0xffff)
-               rcode = aac_setup_safw_adapter(dev, AAC_INIT);
-
        if (!dev->in_reset) {
                char buffer[16];
                tmp = le32_to_cpu(dev->adapter_info.kernelrev);
index c70c998743ac4a308f97ebac36a75770c974dc80..ba84d9985ce732ed2a4f51e92ce9bbb526d6ed8b 100644 (file)
@@ -2719,6 +2719,7 @@ static inline int aac_supports_2T(struct aac_dev *dev)
        return (dev->adapter_info.options & AAC_OPT_NEW_COMM_64);
 }
 
+int aac_scan_host(struct aac_dev *dev, int rescan);
 char * get_container_type(unsigned type);
 extern int numacb;
 extern char aac_driver_version[];
index 491e6338c483b8a1830ee727d3af5fecf02fbfd4..4e2687ce2456311f17ca9257fce54331078a2f88 100644 (file)
@@ -1964,6 +1964,19 @@ out:
        return rcode;
 }
 
+int aac_scan_host(struct aac_dev *dev, int rescan)
+{
+       int rcode = 0;
+
+       mutex_lock(&dev->scan_mutex);
+       if (dev->sa_firmware)
+               rcode = aac_update_safw_host_devices(dev, rescan);
+       else
+               scsi_scan_host(dev->scsi_host_ptr);
+       mutex_unlock(&dev->scan_mutex);
+       return rcode;
+}
+
 /**
  *     aac_handle_sa_aif       Handle a message from the firmware
  *     @dev: Which adapter this fib is from
@@ -1997,9 +2010,8 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)
        case SA_AIF_LDEV_CHANGE:
        case SA_AIF_BPCFG_CHANGE:
 
-               mutex_lock(&dev->scan_mutex);
-               aac_update_safw_host_devices(dev, AAC_RESCAN);
-               mutex_unlock(&dev->scan_mutex);
+               aac_scan_host(dev, AAC_RESCAN);
+
                break;
 
        case SA_AIF_BPSTAT_CHANGE:
index 2c862cd26a21b53b188bea0b2e275c18c8e9948c..7ea7b2cc86bb4ea4c0a8f36548b1287a58e03025 100644 (file)
@@ -1787,7 +1787,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, AAC_INIT);
 
        pci_enable_pcie_error_reporting(pdev);
        pci_save_state(pdev);
@@ -2071,7 +2072,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, AAC_RESCAN);
        pci_save_state(pdev);
 
        dev_err(&pdev->dev, "aacraid: PCI error - resume\n");