Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0505b55fb51fa289027f33ae793995c191277536
Commit:     0505b55fb51fa289027f33ae793995c191277536
Parent:     dc4b6fd620aec395048b2877daca87ba7bfcd5e0
Author:     Sergei Shtylyov <[EMAIL PROTECTED]>
AuthorDate: Tue Sep 11 22:28:34 2007 +0200
Committer:  Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
CommitDate: Tue Sep 11 22:28:34 2007 +0200

    ide: fix PCI refcounting
    
    The IDE core never marked the PCI IDE devices as being in use after 
succesfull
    driver probe call (the devices were marked in use only while being probed), 
and
    so was susceptible to issues caused by unsolicited PCI hotplug device 
removal.
    So, add pci_dev_get() call to ide_scan_pcidev() and convert this function to
    the kernel style, also dropping a bunch of useless curly braces from its 
caller,
    ide_scan_pcibus() and somewhat beautifying printk() call there, while at 
it...
    
    Signed-off-by: Sergei Shtylyov <[EMAIL PROTECTED]>
    Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/setup-pci.c |   41 ++++++++++++++++-------------------------
 1 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 30e596c..1129f8c 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)
        struct list_head *l;
        struct pci_driver *d;
        
-       list_for_each(l, &ide_pci_drivers)
-       {
+       list_for_each(l, &ide_pci_drivers) {
                d = list_entry(l, struct pci_driver, node);
-               if(d->id_table)
-               {
-                       const struct pci_device_id *id = 
pci_match_id(d->id_table, dev);
-                       if(id != NULL)
-                       {
-                               if(d->probe(dev, id) >= 0)
-                               {
-                                       dev->driver = d;
-                                       return 1;
-                               }
+               if (d->id_table) {
+                       const struct pci_device_id *id = 
pci_match_id(d->id_table,
+                                                                     dev);
+                       if (id != NULL && d->probe(dev, id) >= 0) {
+                               dev->driver = d;
+                               pci_dev_get(dev);
+                               return 1;
                        }
                }
        }
@@ -851,15 +847,13 @@ void __init ide_scan_pcibus (int scan_direction)
        struct list_head *l, *n;
 
        pre_init = 0;
-       if (!scan_direction) {
-               while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != 
NULL) {
+       if (!scan_direction)
+               while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != 
NULL)
                        ide_scan_pcidev(dev);
-               }
-       } else {
-               while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, 
dev)) != NULL) {
+       else
+               while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, 
dev))
+                      != NULL)
                        ide_scan_pcidev(dev);
-               }
-       }
        
        /*
         *      Hand the drivers over to the PCI layer now we
@@ -869,12 +863,9 @@ void __init ide_scan_pcibus (int scan_direction)
        list_for_each_safe(l, n, &ide_pci_drivers) {
                list_del(l);
                d = list_entry(l, struct pci_driver, node);
-               if (__pci_register_driver(d, d->driver.owner,
-                                       d->driver.mod_name)) {
-                       printk(KERN_ERR "%s: failed to register driver "
-                                       "for %s\n", __FUNCTION__,
-                                        d->driver.mod_name);
-               }
+               if (__pci_register_driver(d, d->driver.owner, 
d->driver.mod_name))
+                       printk(KERN_ERR "%s: failed to register driver for 
%s\n",
+                              __FUNCTION__, d->driver.mod_name);
        }
 }
 #endif
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to