* [PATCH -mm] i6300esb.c uses pci_find_device
@ 2005-08-08 10:34 Jiri Slaby
2005-08-08 23:55 ` [PATCH -mm] removes pci_find_device from i6300esb.c Jiri Slaby
0 siblings, 1 reply; 14+ messages in thread
From: Jiri Slaby @ 2005-08-08 10:34 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: david, Andrew Morton
This patch changes pci_find_device to pci_get_device (encapsulated in for_each_pci_dev)
with appropriate adding pci_dev_put.
Generated in 2.6.13-rc5-mm1
Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz>
diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/char/watchdog/i6300esb.c
--- a/drivers/char/watchdog/i6300esb.c
+++ b/drivers/char/watchdog/i6300esb.c
@@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic
* Find the PCI device
*/
- while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+ for_each_pci_dev(dev)
if (pci_match_id(esb_pci_tbl, dev)) {
esb_pci = dev;
break;
}
- }
if (esb_pci) {
if (pci_enable_device(esb_pci)) {
@@ -430,6 +429,7 @@ err_release:
pci_release_region(esb_pci, 0);
err_disable:
pci_disable_device(esb_pci);
+ pci_dev_put(esb_pci);
}
out:
return 0;
@@ -481,6 +481,7 @@ err_unmap:
pci_release_region(esb_pci, 0);
/* err_disable: */
pci_disable_device(esb_pci);
+ pci_dev_put(esb_pci);
/* out: */
return ret;
}
@@ -497,6 +498,7 @@ static void __exit watchdog_cleanup (voi
iounmap(BASEADDR);
pci_release_region(esb_pci, 0);
pci_disable_device(esb_pci);
+ pci_dev_put(esb_pci);
}
module_init(watchdog_init);
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-08 10:34 [PATCH -mm] i6300esb.c uses pci_find_device Jiri Slaby @ 2005-08-08 23:55 ` Jiri Slaby 2005-08-09 5:59 ` Greg KH 2005-08-09 6:34 ` [PATCH -mm] removes pci_find_device from i6300esb.c Andrew Morton 0 siblings, 2 replies; 14+ messages in thread From: Jiri Slaby @ 2005-08-08 23:55 UTC (permalink / raw) To: Andrew Morton; +Cc: Linux Kernel Mailing List This patch changes pci_find_device to pci_get_device (encapsulated in for_each_pci_dev) in i6300esb watchdog card with appropriate adding pci_dev_put. Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/char/watchdog/i6300esb.c --- a/drivers/char/watchdog/i6300esb.c +++ b/drivers/char/watchdog/i6300esb.c @@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic * Find the PCI device */ - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } - } if (esb_pci) { if (pci_enable_device(esb_pci)) { @@ -430,6 +429,7 @@ err_release: pci_release_region(esb_pci, 0); err_disable: pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } out: return 0; @@ -481,6 +481,7 @@ err_unmap: pci_release_region(esb_pci, 0); /* err_disable: */ pci_disable_device(esb_pci); + pci_dev_put(esb_pci); /* out: */ return ret; } @@ -497,6 +498,7 @@ static void __exit watchdog_cleanup (voi iounmap(BASEADDR); pci_release_region(esb_pci, 0); pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } module_init(watchdog_init); ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-08 23:55 ` [PATCH -mm] removes pci_find_device from i6300esb.c Jiri Slaby @ 2005-08-09 5:59 ` Greg KH 2005-08-09 16:06 ` Jiri Slaby 2005-08-09 6:34 ` [PATCH -mm] removes pci_find_device from i6300esb.c Andrew Morton 1 sibling, 1 reply; 14+ messages in thread From: Greg KH @ 2005-08-09 5:59 UTC (permalink / raw) To: Jiri Slaby; +Cc: Andrew Morton, Linux Kernel Mailing List On Tue, Aug 09, 2005 at 01:55:16AM +0200, Jiri Slaby wrote: > This patch changes pci_find_device to pci_get_device (encapsulated in > for_each_pci_dev) in i6300esb watchdog card with appropriate adding pci_dev_put. Can you please route all of these changes through me? It's some tricky code to get right, and lots of people have failed in the past, I don't want this to be applied without lots of review. So, care to resend all of your pci changes, including the documentation ones, to me? thanks, greg k-h ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-09 5:59 ` Greg KH @ 2005-08-09 16:06 ` Jiri Slaby 2005-08-09 23:37 ` Greg KH 0 siblings, 1 reply; 14+ messages in thread From: Jiri Slaby @ 2005-08-09 16:06 UTC (permalink / raw) To: Greg KH; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-pci On 8/9/05, Greg KH <greg@kroah.com> wrote: > So, care to resend all of your pci changes, including the documentation > ones, to me? Sure: This removes very old functions from pci docs, which aren't no longer in the kernel. Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> diff --git a/Documentation/pci.txt b/Documentation/pci.txt --- a/Documentation/pci.txt +++ b/Documentation/pci.txt @@ -266,20 +266,6 @@ port an old driver to the new PCI interf in the kernel as they aren't compatible with hotplug or PCI domains or having sane locking. -pcibios_present() and Since ages, you don't need to test presence -pci_present() of PCI subsystem when trying to talk to it. - If it's not there, the list of PCI devices - is empty and all functions for searching for - devices just return NULL. -pcibios_(read|write)_* Superseded by their pci_(read|write)_* - counterparts. -pcibios_find_* Superseded by their pci_get_* counterparts. -pci_for_each_dev() Superseded by pci_get_device() -pci_for_each_dev_reverse() Superseded by pci_find_device_reverse() -pci_for_each_bus() Superseded by pci_find_next_bus() pci_find_device() Superseded by pci_get_device() pci_find_subsys() Superseded by pci_get_subsys() pci_find_slot() Superseded by pci_get_slot() -pcibios_find_class() Superseded by pci_get_class() -pci_find_class() Superseded by pci_get_class() -pci_(read|write)_*_nodev() Superseded by pci_bus_(read|write)_*() ------------------ This patch changes pci_find_device to pci_get_device (encapsulated in for_each_pci_dev) in i6300esb watchdog card with appropriate adding pci_dev_put. Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/char/watchdog/i6300esb.c --- a/drivers/char/watchdog/i6300esb.c +++ b/drivers/char/watchdog/i6300esb.c @@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic * Find the PCI device */ - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } - } if (esb_pci) { if (pci_enable_device(esb_pci)) { @@ -430,6 +429,7 @@ err_release: pci_release_region(esb_pci, 0); err_disable: pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } out: return 0; @@ -481,6 +481,7 @@ err_unmap: pci_release_region(esb_pci, 0); /* err_disable: */ pci_disable_device(esb_pci); + pci_dev_put(esb_pci); /* out: */ return ret; } @@ -497,6 +498,7 @@ static void __exit watchdog_cleanup (voi iounmap(BASEADDR); pci_release_region(esb_pci, 0); pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } module_init(watchdog_init); ------------------ This patch changes pci_find_device to pci_get_device (encapsulated in for_each_pci_dev). Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -3007,7 +3007,7 @@ static int __init parport_pc_init_superi struct pci_dev *pdev = NULL; int ret = 0; - while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { + for_each_pci_dev(pdev) { id = pci_match_id(parport_pc_pci_tbl, pdev); if (id == NULL || id->driver_data >= last_sio) continue; ------------------ [this was refused by you:] This marks these functions as deprecated not to use in latest drivers (it doesn't use reference counts and the device returned by it can disappear in any time). Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> diff --git a/include/linux/pci.h b/include/linux/pci.h --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -328,9 +328,11 @@ void pci_setup_cardbus(struct pci_bus *b /* Generic PCI functions exported to card drivers */ -struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); +struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, + const struct pci_dev *from) __deprecated; struct pci_dev *pci_find_device_reverse (unsigned int vendor, unsigned int device, const struct pci_dev *from); -struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); +struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn) + __deprecated; int pci_find_capability (struct pci_dev *dev, int cap); int pci_find_ext_capability (struct pci_dev *dev, int cap); struct pci_bus * pci_find_next_bus(const struct pci_bus *from); ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-09 16:06 ` Jiri Slaby @ 2005-08-09 23:37 ` Greg KH 2005-08-10 0:09 ` [PATCH 0/2] pci_find_device patches Jiri Slaby ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Greg KH @ 2005-08-09 23:37 UTC (permalink / raw) To: Jiri Slaby; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-pci On Tue, Aug 09, 2005 at 06:06:19PM +0200, Jiri Slaby wrote: > On 8/9/05, Greg KH <greg@kroah.com> wrote: > > So, care to resend all of your pci changes, including the documentation > > ones, to me? > Sure: Um, one patch per email please. Doesn't anyone read Documentation/SubmittingPatches anymore... thanks, greg k-h ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 0/2] pci_find_device patches 2005-08-09 23:37 ` Greg KH @ 2005-08-10 0:09 ` Jiri Slaby 2005-08-10 0:09 ` [PATCH -mm 1/2] removes pci_find_device from i6300esb.c Jiri Slaby 2005-08-10 0:09 ` [PATCH 2/2] removes pci_find_device from parport_pc.c Jiri Slaby 2 siblings, 0 replies; 14+ messages in thread From: Jiri Slaby @ 2005-08-10 0:09 UTC (permalink / raw) To: Greg KH; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-pci >Um, one patch per email please. > >Doesn't anyone read Documentation/SubmittingPatches anymore... I did. But I only thought... Let it be. Sorry. Here are they. The two, which you haven't accepted (one, which marks deprecation isn't included because of refusing it and docpci has been added to your tree). regards, jiri ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH -mm 1/2] removes pci_find_device from i6300esb.c 2005-08-09 23:37 ` Greg KH 2005-08-10 0:09 ` [PATCH 0/2] pci_find_device patches Jiri Slaby @ 2005-08-10 0:09 ` Jiri Slaby 2005-08-16 0:24 ` [PATCH] " Jiri Slaby 2005-08-10 0:09 ` [PATCH 2/2] removes pci_find_device from parport_pc.c Jiri Slaby 2 siblings, 1 reply; 14+ messages in thread From: Jiri Slaby @ 2005-08-10 0:09 UTC (permalink / raw) To: Greg KH; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-pci This patch changes pci_find_device to pci_get_device (encapsulated in for_each_pci_dev) in i6300esb watchdog card with appropriate adding pci_dev_put. Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/char/watchdog/i6300esb.c --- a/drivers/char/watchdog/i6300esb.c +++ b/drivers/char/watchdog/i6300esb.c @@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic * Find the PCI device */ - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } - } if (esb_pci) { if (pci_enable_device(esb_pci)) { @@ -430,6 +429,7 @@ err_release: pci_release_region(esb_pci, 0); err_disable: pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } out: return 0; @@ -481,6 +481,7 @@ err_unmap: pci_release_region(esb_pci, 0); /* err_disable: */ pci_disable_device(esb_pci); + pci_dev_put(esb_pci); /* out: */ return ret; } @@ -497,6 +498,7 @@ static void __exit watchdog_cleanup (voi iounmap(BASEADDR); pci_release_region(esb_pci, 0); pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } module_init(watchdog_init); ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] removes pci_find_device from i6300esb.c 2005-08-10 0:09 ` [PATCH -mm 1/2] removes pci_find_device from i6300esb.c Jiri Slaby @ 2005-08-16 0:24 ` Jiri Slaby 2005-08-16 0:28 ` Greg KH 0 siblings, 1 reply; 14+ messages in thread From: Jiri Slaby @ 2005-08-16 0:24 UTC (permalink / raw) To: Greg KH; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-pci This patch changes pci_find_device to pci_get_device (encapsulated in for_each_pci_dev) in i6300esb watchdog card with appropriate adding pci_dev_put. Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> This is repost, the patch was posted yet: 8 Aug 2005 diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/char/watchdog/i6300esb.c --- a/drivers/char/watchdog/i6300esb.c +++ b/drivers/char/watchdog/i6300esb.c @@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic * Find the PCI device */ - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + for_each_pci_dev(dev) if (pci_match_id(esb_pci_tbl, dev)) { esb_pci = dev; break; } - } if (esb_pci) { if (pci_enable_device(esb_pci)) { @@ -430,6 +429,7 @@ err_release: pci_release_region(esb_pci, 0); err_disable: pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } out: return 0; @@ -481,6 +481,7 @@ err_unmap: pci_release_region(esb_pci, 0); /* err_disable: */ pci_disable_device(esb_pci); + pci_dev_put(esb_pci); /* out: */ return ret; } @@ -497,6 +498,7 @@ static void __exit watchdog_cleanup (voi iounmap(BASEADDR); pci_release_region(esb_pci, 0); pci_disable_device(esb_pci); + pci_dev_put(esb_pci); } module_init(watchdog_init); ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] removes pci_find_device from i6300esb.c 2005-08-16 0:24 ` [PATCH] " Jiri Slaby @ 2005-08-16 0:28 ` Greg KH 0 siblings, 0 replies; 14+ messages in thread From: Greg KH @ 2005-08-16 0:28 UTC (permalink / raw) To: Jiri Slaby; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-pci On Tue, Aug 16, 2005 at 02:24:57AM +0200, Jiri Slaby wrote: > This patch changes pci_find_device to pci_get_device (encapsulated in > for_each_pci_dev) in i6300esb watchdog card with appropriate adding pci_dev_put. > > Generated in 2.6.13-rc5-mm1 kernel version. > > Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> > > This is repost, the patch was posted yet: > 8 Aug 2005 I can't take this as the driver is only in the -mm tree, not mainline. Andrew will have to pick it up (if it's even correct, haven't verified it or not...) thanks, greg k-h ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] removes pci_find_device from parport_pc.c 2005-08-09 23:37 ` Greg KH 2005-08-10 0:09 ` [PATCH 0/2] pci_find_device patches Jiri Slaby 2005-08-10 0:09 ` [PATCH -mm 1/2] removes pci_find_device from i6300esb.c Jiri Slaby @ 2005-08-10 0:09 ` Jiri Slaby 2 siblings, 0 replies; 14+ messages in thread From: Jiri Slaby @ 2005-08-10 0:09 UTC (permalink / raw) To: Greg KH; +Cc: Andrew Morton, Linux Kernel Mailing List, linux-pci [Andrew has added this into his tree yet.] This patch changes pci_find_device to pci_get_device (encapsulated in for_each_pci_dev). Generated in 2.6.13-rc5-mm1 kernel version. Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -3007,7 +3007,7 @@ static int __init parport_pc_init_superi struct pci_dev *pdev = NULL; int ret = 0; - while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { + for_each_pci_dev(pdev) { id = pci_match_id(parport_pc_pci_tbl, pdev); if (id == NULL || id->driver_data >= last_sio) continue; ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-08 23:55 ` [PATCH -mm] removes pci_find_device from i6300esb.c Jiri Slaby 2005-08-09 5:59 ` Greg KH @ 2005-08-09 6:34 ` Andrew Morton 2005-08-09 9:28 ` Jiri Slaby 2005-08-09 9:53 ` Jiri Slaby 1 sibling, 2 replies; 14+ messages in thread From: Andrew Morton @ 2005-08-09 6:34 UTC (permalink / raw) To: Jiri Slaby; +Cc: linux-kernel Jiri Slaby <jirislaby@gmail.com> wrote: > > --- a/drivers/char/watchdog/i6300esb.c > +++ b/drivers/char/watchdog/i6300esb.c > @@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic > * Find the PCI device > */ > > - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { > + for_each_pci_dev(dev) > if (pci_match_id(esb_pci_tbl, dev)) { > esb_pci = dev; > break; > } > - } > > if (esb_pci) { > if (pci_enable_device(esb_pci)) { > @@ -430,6 +429,7 @@ err_release: > pci_release_region(esb_pci, 0); > err_disable: > pci_disable_device(esb_pci); > + pci_dev_put(esb_pci); That doesn't look right. Each iteration of for_each_pci_dev() needs a pci_dev_put(), not just the final one. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-09 6:34 ` [PATCH -mm] removes pci_find_device from i6300esb.c Andrew Morton @ 2005-08-09 9:28 ` Jiri Slaby 2005-08-09 21:56 ` Greg KH 2005-08-09 9:53 ` Jiri Slaby 1 sibling, 1 reply; 14+ messages in thread From: Jiri Slaby @ 2005-08-09 9:28 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-kernel, greg Andrew Morton napsal(a): >Jiri Slaby <jirislaby@gmail.com> wrote: > > >>--- a/drivers/char/watchdog/i6300esb.c >> +++ b/drivers/char/watchdog/i6300esb.c >> @@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic >> * Find the PCI device >> */ >> >> - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { >> + for_each_pci_dev(dev) >> if (pci_match_id(esb_pci_tbl, dev)) { >> esb_pci = dev; >> break; >> } >> - } >> >> if (esb_pci) { >> if (pci_enable_device(esb_pci)) { >> @@ -430,6 +429,7 @@ err_release: >> pci_release_region(esb_pci, 0); >> err_disable: >> pci_disable_device(esb_pci); >> + pci_dev_put(esb_pci); >> >> > >That doesn't look right. Each iteration of for_each_pci_dev() needs a >pci_dev_put(), not just the final one. > > But pci_get_device do it for us on pci_get_subsys, line 249, doesn't it? -- Jiri Slaby www.fi.muni.cz/~xslaby ~\-/~ jirislaby@gmail.com ~\-/~ 241B347EC88228DE51EE A49C4A73A25004CB2A10 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-09 9:28 ` Jiri Slaby @ 2005-08-09 21:56 ` Greg KH 0 siblings, 0 replies; 14+ messages in thread From: Greg KH @ 2005-08-09 21:56 UTC (permalink / raw) To: Jiri Slaby; +Cc: Andrew Morton, linux-kernel On Tue, Aug 09, 2005 at 11:28:16AM +0200, Jiri Slaby wrote: > Andrew Morton napsal(a): > > >Jiri Slaby <jirislaby@gmail.com> wrote: > > > > > >>--- a/drivers/char/watchdog/i6300esb.c > >>+++ b/drivers/char/watchdog/i6300esb.c > >>@@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic > >> * Find the PCI device > >> */ > >> > >>- while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != > >>NULL) { > >>+ for_each_pci_dev(dev) > >> if (pci_match_id(esb_pci_tbl, dev)) { > >> esb_pci = dev; > >> break; > >> } > >>- } > >> > >> if (esb_pci) { > >> if (pci_enable_device(esb_pci)) { > >>@@ -430,6 +429,7 @@ err_release: > >> pci_release_region(esb_pci, 0); > >> err_disable: > >> pci_disable_device(esb_pci); > >>+ pci_dev_put(esb_pci); > >> > >> > > > >That doesn't look right. Each iteration of for_each_pci_dev() needs a > >pci_dev_put(), not just the final one. Not true, see the documentation for pci_get_device(), it's only required if you break out of the loop. thanks, greg k-h ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH -mm] removes pci_find_device from i6300esb.c 2005-08-09 6:34 ` [PATCH -mm] removes pci_find_device from i6300esb.c Andrew Morton 2005-08-09 9:28 ` Jiri Slaby @ 2005-08-09 9:53 ` Jiri Slaby 1 sibling, 0 replies; 14+ messages in thread From: Jiri Slaby @ 2005-08-09 9:53 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-kernel, greg [lkml sorry for reposting, but my nat was on cbl blacklist again, grrr.] On 8/9/05, Andrew Morton <akpm@osdl.org> wrote: > Jiri Slaby <jirislaby@gmail.com> wrote: > > > > --- a/drivers/char/watchdog/i6300esb.c > > +++ b/drivers/char/watchdog/i6300esb.c > > @@ -368,12 +368,11 @@ static unsigned char __init esb_getdevic > > * Find the PCI device > > */ > > > > - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { > > + for_each_pci_dev(dev) > > if (pci_match_id(esb_pci_tbl, dev)) { > > esb_pci = dev; > > break; > > } > > - } > > > > if (esb_pci) { > > if (pci_enable_device(esb_pci)) { > > @@ -430,6 +429,7 @@ err_release: > > pci_release_region(esb_pci, 0); > > err_disable: > > pci_disable_device(esb_pci); > > + pci_dev_put(esb_pci); > > That doesn't look right. Each iteration of for_each_pci_dev() needs a > pci_dev_put(), not just the final one. > But pci_get_device do it for us in pci_get_subsys, line 249 in pci/search.c, doesn't it? ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2005-08-16 4:56 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-08-08 10:34 [PATCH -mm] i6300esb.c uses pci_find_device Jiri Slaby 2005-08-08 23:55 ` [PATCH -mm] removes pci_find_device from i6300esb.c Jiri Slaby 2005-08-09 5:59 ` Greg KH 2005-08-09 16:06 ` Jiri Slaby 2005-08-09 23:37 ` Greg KH 2005-08-10 0:09 ` [PATCH 0/2] pci_find_device patches Jiri Slaby 2005-08-10 0:09 ` [PATCH -mm 1/2] removes pci_find_device from i6300esb.c Jiri Slaby 2005-08-16 0:24 ` [PATCH] " Jiri Slaby 2005-08-16 0:28 ` Greg KH 2005-08-10 0:09 ` [PATCH 2/2] removes pci_find_device from parport_pc.c Jiri Slaby 2005-08-09 6:34 ` [PATCH -mm] removes pci_find_device from i6300esb.c Andrew Morton 2005-08-09 9:28 ` Jiri Slaby 2005-08-09 21:56 ` Greg KH 2005-08-09 9:53 ` Jiri Slaby
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox