mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] via* : switch to pci_get_device refcounted PCI API
@ 2006-09-15 14:29 Alan Cox
  2006-09-16  1:05 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Cox @ 2006-09-15 14:29 UTC (permalink / raw)
  To: akpm, linux-kernel, benh

If we can clean up these remainders we can finally delete pci_find_*

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc6-mm1/drivers/macintosh/via-pmu68k.c linux-2.6.18-rc6-mm1/drivers/macintosh/via-pmu68k.c
--- linux.vanilla-2.6.18-rc6-mm1/drivers/macintosh/via-pmu68k.c	2006-09-11 11:00:40.000000000 +0100
+++ linux-2.6.18-rc6-mm1/drivers/macintosh/via-pmu68k.c	2006-09-14 16:41:16.000000000 +0100
@@ -843,7 +843,7 @@
 	struct pci_save *ps;
 
 	npci = 0;
-	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL)
+	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL)
 		++npci;
 	n_pbook_pci_saves = npci;
 	if (npci == 0)
@@ -854,7 +854,7 @@
 		return;
 
 	pd = NULL;
-	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
+	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
 		pci_read_config_word(pd, PCI_COMMAND, &ps->command);
 		pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
 		pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
@@ -871,7 +871,7 @@
 	struct pci_dev *pd = NULL;
 	int j;
 
-	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
+	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
 		if (ps->command == 0)
 			continue;
 		pci_read_config_word(pd, PCI_COMMAND, &cmd);
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc6-mm1/drivers/macintosh/via-pmu.c linux-2.6.18-rc6-mm1/drivers/macintosh/via-pmu.c
--- linux.vanilla-2.6.18-rc6-mm1/drivers/macintosh/via-pmu.c	2006-09-11 17:00:10.000000000 +0100
+++ linux-2.6.18-rc6-mm1/drivers/macintosh/via-pmu.c	2006-09-14 16:43:07.000000000 +0100
@@ -1827,7 +1827,7 @@
 	struct pci_dev *pd = NULL;
 
 	npci = 0;
-	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
+	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
 		++npci;
 	}
 	if (npci == 0)
@@ -1857,9 +1857,11 @@
 	if (ps == NULL)
 		return;
 
-	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
-		if (npci-- == 0)
+	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
+		if (npci-- == 0) {
+			pci_dev_put(pd);
 			return;
+		}
 #ifndef HACKED_PCI_SAVE
 		pci_read_config_word(pd, PCI_COMMAND, &ps->command);
 		pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
@@ -1887,11 +1889,13 @@
 	int npci = pbook_npci_saves;
 	int j;
 
-	while ((pd = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
+	while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
 #ifdef HACKED_PCI_SAVE
 		int i;
-		if (npci-- == 0)
+		if (npci-- == 0) {
+			pci_dev_put(pd);
 			return;
+		}
 		ps++;
 		for (i=2;i<16;i++)
 			pci_write_config_dword(pd, i<<4, ps->config[i]);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] via* : switch to pci_get_device refcounted PCI API
  2006-09-15 14:29 [PATCH] via* : switch to pci_get_device refcounted PCI API Alan Cox
@ 2006-09-16  1:05 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2006-09-16  1:05 UTC (permalink / raw)
  To: Alan Cox; +Cc: akpm, linux-kernel

On Fri, 2006-09-15 at 15:29 +0100, Alan Cox wrote:
> If we can clean up these remainders we can finally delete pci_find_*
> 
> Signed-off-by: Alan Cox <alan@redhat.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Note that I should probably revisit the via-pmu bits one of these days,
I don't think I need that save/restore of the config space of all PCI
devices anymore.

Cheers,
Ben.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-16  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-15 14:29 [PATCH] via* : switch to pci_get_device refcounted PCI API Alan Cox
2006-09-16  1:05 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome