aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/setup-pci.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 30e596c0f120..1129f8c30840 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -816,19 +816,15 @@ static int __init ide_scan_pcidev(struct pci_dev *dev)
816 struct list_head *l; 816 struct list_head *l;
817 struct pci_driver *d; 817 struct pci_driver *d;
818 818
819 list_for_each(l, &ide_pci_drivers) 819 list_for_each(l, &ide_pci_drivers) {
820 {
821 d = list_entry(l, struct pci_driver, node); 820 d = list_entry(l, struct pci_driver, node);
822 if(d->id_table) 821 if (d->id_table) {
823 { 822 const struct pci_device_id *id = pci_match_id(d->id_table,
824 const struct pci_device_id *id = pci_match_id(d->id_table, dev); 823 dev);
825 if(id != NULL) 824 if (id != NULL && d->probe(dev, id) >= 0) {
826 { 825 dev->driver = d;
827 if(d->probe(dev, id) >= 0) 826 pci_dev_get(dev);
828 { 827 return 1;
829 dev->driver = d;
830 return 1;
831 }
832 } 828 }
833 } 829 }
834 } 830 }
@@ -851,15 +847,13 @@ void __init ide_scan_pcibus (int scan_direction)
851 struct list_head *l, *n; 847 struct list_head *l, *n;
852 848
853 pre_init = 0; 849 pre_init = 0;
854 if (!scan_direction) { 850 if (!scan_direction)
855 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 851 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
856 ide_scan_pcidev(dev); 852 ide_scan_pcidev(dev);
857 } 853 else
858 } else { 854 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev))
859 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 855 != NULL)
860 ide_scan_pcidev(dev); 856 ide_scan_pcidev(dev);
861 }
862 }
863 857
864 /* 858 /*
865 * Hand the drivers over to the PCI layer now we 859 * Hand the drivers over to the PCI layer now we
@@ -869,12 +863,9 @@ void __init ide_scan_pcibus (int scan_direction)
869 list_for_each_safe(l, n, &ide_pci_drivers) { 863 list_for_each_safe(l, n, &ide_pci_drivers) {
870 list_del(l); 864 list_del(l);
871 d = list_entry(l, struct pci_driver, node); 865 d = list_entry(l, struct pci_driver, node);
872 if (__pci_register_driver(d, d->driver.owner, 866 if (__pci_register_driver(d, d->driver.owner, d->driver.mod_name))
873 d->driver.mod_name)) { 867 printk(KERN_ERR "%s: failed to register driver for %s\n",
874 printk(KERN_ERR "%s: failed to register driver " 868 __FUNCTION__, d->driver.mod_name);
875 "for %s\n", __FUNCTION__,
876 d->driver.mod_name);
877 }
878 } 869 }
879} 870}
880#endif 871#endif