isci: preallocate remote devices
[deliverable/linux.git] / drivers / scsi / isci / host.c
index da0c0da4198fb9906caa78e888d60f5094613d37..ae5d4602207354cabb124e85409197f3bdf60871 100644 (file)
@@ -345,7 +345,7 @@ void isci_host_deinit(struct isci_host *ihost)
 
                list_for_each_entry_safe(idev, d, &port->remote_dev_list, node) {
                        isci_remote_device_change_state(idev, isci_stopping);
-                       isci_remote_device_stop(idev);
+                       isci_remote_device_stop(ihost, idev);
                }
        }
 
@@ -378,8 +378,7 @@ static void __iomem *smu_base(struct isci_host *isci_host)
 
 int isci_host_init(struct isci_host *isci_host)
 {
-       int err = 0;
-       int index = 0;
+       int err = 0, i;
        enum sci_status status;
        struct scic_sds_controller *controller;
        union scic_oem_parameters scic_oem_params;
@@ -509,13 +508,19 @@ int isci_host_init(struct isci_host *isci_host)
        if (!isci_host->dma_pool)
                return -ENOMEM;
 
-       for (index = 0; index < SCI_MAX_PORTS; index++)
-               isci_port_init(&isci_host->isci_ports[index],
-                              isci_host,
-                              index);
+       for (i = 0; i < SCI_MAX_PORTS; i++)
+               isci_port_init(&isci_host->isci_ports[i], isci_host, i);
 
-       for (index = 0; index < SCI_MAX_PHYS; index++)
-               isci_phy_init(&isci_host->phys[index], isci_host, index);
+       for (i = 0; i < SCI_MAX_PHYS; i++)
+               isci_phy_init(&isci_host->phys[i], isci_host, i);
+
+       for (i = 0; i < SCI_MAX_REMOTE_DEVICES; i++) {
+               struct isci_remote_device *idev = idev_by_id(isci_host, i);
+
+               INIT_LIST_HEAD(&idev->reqs_in_process);
+               INIT_LIST_HEAD(&idev->node);
+               spin_lock_init(&idev->state_lock);
+       }
 
        return 0;
 }
This page took 0.028149 seconds and 5 git commands to generate.