Re: [-mm PATCH] remove use of pci_find_device in watchdog driver for Intel 6300ESB chipset
David Härdeman napsal(a): On Mon, Aug 15, 2005 at 02:30:15PM -0700, Naveen Gupta wrote: [...} -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++; +} I'm certainly not sure about this, but the proposed while loop looks a bit unconventional, wouldn't something like: for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } } be better? I did it here http://lkml.org/lkml/2005/8/9/305, but it wasn't acked yet. I should repost. -- Jiri Slaby www.fi.muni.cz/~xslaby ~\-/~ [EMAIL PROTECTED] ~\-/~ 241B347EC88228DE51EE A49C4A73A25004CB2A10 - 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/
Re: [-mm PATCH] remove use of pci_find_device in watchdog driver for Intel 6300ESB chipset
On Mon, Aug 15, 2005 at 02:30:15PM -0700, Naveen Gupta wrote: [...} -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++; + } I'm certainly not sure about this, but the proposed while loop looks a bit unconventional, wouldn't something like: for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } } be better? //David - 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/
[-mm PATCH] remove use of pci_find_device in watchdog driver for Intel 6300ESB chipset
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.0 -0700 +++ linux-2.6.12/drivers/char/watchdog/i6300esb.c 2005-08-15 11:36:54.0 -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/
[-mm PATCH] remove use of pci_find_device in watchdog driver for Intel 6300ESB chipset
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.0 -0700 +++ linux-2.6.12/drivers/char/watchdog/i6300esb.c 2005-08-15 11:36:54.0 -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/
Re: [-mm PATCH] remove use of pci_find_device in watchdog driver for Intel 6300ESB chipset
On Mon, Aug 15, 2005 at 02:30:15PM -0700, Naveen Gupta wrote: [...} -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++; + } I'm certainly not sure about this, but the proposed while loop looks a bit unconventional, wouldn't something like: for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } } be better? //David - 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/
Re: [-mm PATCH] remove use of pci_find_device in watchdog driver for Intel 6300ESB chipset
David Härdeman napsal(a): On Mon, Aug 15, 2005 at 02:30:15PM -0700, Naveen Gupta wrote: [...} -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++; +} I'm certainly not sure about this, but the proposed while loop looks a bit unconventional, wouldn't something like: for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } } be better? I did it here http://lkml.org/lkml/2005/8/9/305, but it wasn't acked yet. I should repost. -- Jiri Slaby www.fi.muni.cz/~xslaby ~\-/~ [EMAIL PROTECTED] ~\-/~ 241B347EC88228DE51EE A49C4A73A25004CB2A10 - 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/