[-mm PATCH] remove use of pci_find_device in watchdog driver for Intel 6300ESB chipset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch replaces obsolete 'pci_find_device' with 'pci_get_device' to
prevent the device from being stolen under us in Watchdog timer driver
for intel 6300ESB chipset.

Signed-off-by: Naveen Gupta <[email protected]>

Index: linux-2.6.12/drivers/char/watchdog/i6300esb.c
===================================================================
--- linux-2.6.12.orig/drivers/char/watchdog/i6300esb.c	2005-08-15 11:28:07.000000000 -0700
+++ linux-2.6.12/drivers/char/watchdog/i6300esb.c	2005-08-15 11:36:54.000000000 -0700
@@ -362,23 +362,24 @@
 {
 	u8 val1;
 	unsigned short val2;
-
+	struct pci_device_id *ids = esb_pci_tbl;
         struct pci_dev *dev = NULL;
         /*
          *      Find the PCI device
          */
 
-        while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
-                if (pci_match_id(esb_pci_tbl, dev)) {
-                        esb_pci = dev;
-                        break;
-                }
-        }
+	while (ids->vendor && ids->device) {
+		if ((dev = pci_get_device(ids->vendor, ids->device, dev)) != NULL) {
+			esb_pci = dev;
+			break;
+		}
+		ids++;
+	}
 
         if (esb_pci) {
         	if (pci_enable_device(esb_pci)) {
 			printk (KERN_ERR PFX "failed to enable device\n");
-			goto out;
+			goto err_devput;
 		}
 
 		if (pci_request_region(esb_pci, 0, ESB_MODULE_NAME)) {
@@ -430,8 +431,9 @@
 		pci_release_region(esb_pci, 0);
 err_disable:
 		pci_disable_device(esb_pci);
+err_devput:
+		pci_dev_put(esb_pci);
 	}
-out:
 	return 0;
 }
 
@@ -481,7 +483,8 @@
 	pci_release_region(esb_pci, 0);
 /* err_disable: */
 	pci_disable_device(esb_pci);
-/* out: */
+/* err_devput: */
+	pci_dev_put(esb_pci);
         return ret;
 }
 
@@ -497,6 +500,7 @@
 	iounmap(BASEADDR);
 	pci_release_region(esb_pci, 0);
 	pci_disable_device(esb_pci);
+	pci_dev_put(esb_pci);
 }
 
 module_init(watchdog_init);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux