aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/isci/init.c')
-rw-r--r--drivers/scsi/isci/init.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index d01c44f5be99..f1b8a51dd49f 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -285,16 +285,6 @@ static int __devinit isci_pci_init(struct pci_dev *pdev)
285 return 0; 285 return 0;
286} 286}
287 287
288static struct isci_host *isci_host_by_id(struct pci_dev *pdev, int id)
289{
290 struct isci_host *h;
291
292 for_each_isci_host(h, pdev)
293 if (h->id == id)
294 return h;
295 return NULL;
296}
297
298static int num_controllers(struct pci_dev *pdev) 288static int num_controllers(struct pci_dev *pdev)
299{ 289{
300 /* bar size alone can tell us if we are running with a dual controller 290 /* bar size alone can tell us if we are running with a dual controller
@@ -332,7 +322,7 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
332 for (i = 0; i < num_msix; i++) { 322 for (i = 0; i < num_msix; i++) {
333 int id = i / SCI_NUM_MSI_X_INT; 323 int id = i / SCI_NUM_MSI_X_INT;
334 struct msix_entry *msix = &pci_info->msix_entries[i]; 324 struct msix_entry *msix = &pci_info->msix_entries[i];
335 struct isci_host *isci_host = isci_host_by_id(pdev, id); 325 struct isci_host *isci_host = pci_info->hosts[id];
336 irq_handler_t isr; 326 irq_handler_t isr;
337 327
338 /* odd numbered vectors are error interrupts */ 328 /* odd numbered vectors are error interrupts */
@@ -351,7 +341,7 @@ static int isci_setup_interrupts(struct pci_dev *pdev)
351 dev_info(&pdev->dev, "msix setup failed falling back to intx\n"); 341 dev_info(&pdev->dev, "msix setup failed falling back to intx\n");
352 while (i--) { 342 while (i--) {
353 id = i / SCI_NUM_MSI_X_INT; 343 id = i / SCI_NUM_MSI_X_INT;
354 isci_host = isci_host_by_id(pdev, id); 344 isci_host = pci_info->hosts[id];
355 msix = &pci_info->msix_entries[i]; 345 msix = &pci_info->msix_entries[i];
356 devm_free_irq(&pdev->dev, msix->vector, isci_host); 346 devm_free_irq(&pdev->dev, msix->vector, isci_host);
357 } 347 }
@@ -634,22 +624,20 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic
634 err = -ENOMEM; 624 err = -ENOMEM;
635 goto err_host_alloc; 625 goto err_host_alloc;
636 } 626 }
637 627 pci_info->hosts[i] = h;
638 h->next = pci_info->hosts;
639 pci_info->hosts = h;
640 } 628 }
641 629
642 err = isci_setup_interrupts(pdev); 630 err = isci_setup_interrupts(pdev);
643 if (err) 631 if (err)
644 goto err_host_alloc; 632 goto err_host_alloc;
645 633
646 for_each_isci_host(isci_host, pdev) 634 for_each_isci_host(i, isci_host, pdev)
647 scsi_scan_host(isci_host->shost); 635 scsi_scan_host(isci_host->shost);
648 636
649 return 0; 637 return 0;
650 638
651 err_host_alloc: 639 err_host_alloc:
652 for_each_isci_host(isci_host, pdev) 640 for_each_isci_host(i, isci_host, pdev)
653 isci_unregister_sas_ha(isci_host); 641 isci_unregister_sas_ha(isci_host);
654 return err; 642 return err;
655} 643}
@@ -657,8 +645,9 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic
657static void __devexit isci_pci_remove(struct pci_dev *pdev) 645static void __devexit isci_pci_remove(struct pci_dev *pdev)
658{ 646{
659 struct isci_host *isci_host; 647 struct isci_host *isci_host;
648 int i;
660 649
661 for_each_isci_host(isci_host, pdev) { 650 for_each_isci_host(i, isci_host, pdev) {
662 isci_unregister_sas_ha(isci_host); 651 isci_unregister_sas_ha(isci_host);
663 isci_host_deinit(isci_host); 652 isci_host_deinit(isci_host);
664 scic_controller_disable_interrupts(isci_host->core_controller); 653 scic_controller_disable_interrupts(isci_host->core_controller);