mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] alpha - switch to pci_get API
Date: Mon, 16 Oct 2006 16:48:51 +0100	[thread overview]
Message-ID: <1161013732.24237.95.camel@localhost.localdomain> (raw)

Now that we have pci_get_bus_and_slot we can do the job correctly. Note
that some of these calls intentionally leak a device - this is because
the device in question is always needed from boot to reboot.

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

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.19-rc1-mm1/arch/alpha/kernel/pci.c linux-2.6.19-rc1-mm1/arch/alpha/kernel/pci.c
--- linux.vanilla-2.6.19-rc1-mm1/arch/alpha/kernel/pci.c	2006-10-13 15:06:13.000000000 +0100
+++ linux-2.6.19-rc1-mm1/arch/alpha/kernel/pci.c	2006-10-13 17:14:23.000000000 +0100
@@ -516,10 +516,11 @@
 		if (bus == 0 && dfn == 0) {
 			hose = pci_isa_hose;
 		} else {
-			dev = pci_find_slot(bus, dfn);
+			dev = pci_get_bus_and_slot(bus, dfn);
 			if (!dev)
 				return -ENODEV;
 			hose = dev->sysdata;
+			pci_dev_put(dev);
 		}
 	}
 
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.19-rc1-mm1/arch/alpha/kernel/sys_miata.c linux-2.6.19-rc1-mm1/arch/alpha/kernel/sys_miata.c
--- linux.vanilla-2.6.19-rc1-mm1/arch/alpha/kernel/sys_miata.c	2006-10-13 15:10:06.000000000 +0100
+++ linux-2.6.19-rc1-mm1/arch/alpha/kernel/sys_miata.c	2006-10-13 17:14:23.000000000 +0100
@@ -183,11 +183,15 @@
 
 	if((slot == 7) && (PCI_FUNC(dev->devfn) == 3)) {
 		u8 irq=0;
-
-		if(pci_read_config_byte(pci_find_slot(dev->bus->number, dev->devfn & ~(7)), 0x40,&irq)!=PCIBIOS_SUCCESSFUL)
+		struct pci_dev *pdev = pci_get_slot(dev->bus, dev->devfn & ~7);
+		if(pdev == NULL || pci_read_config_byte(pdev, 0x40,&irq) != PCIBIOS_SUCCESSFUL) {
+			pci_dev_put(pdev);
 			return -1;
-		else	
+		}
+		else	{
+			pci_dev_put(pdev);
 			return irq;
+		}
 	}
 
 	return COMMON_TABLE_LOOKUP;
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.19-rc1-mm1/arch/alpha/kernel/sys_nautilus.c linux-2.6.19-rc1-mm1/arch/alpha/kernel/sys_nautilus.c
--- linux.vanilla-2.6.19-rc1-mm1/arch/alpha/kernel/sys_nautilus.c	2006-10-13 15:10:06.000000000 +0100
+++ linux-2.6.19-rc1-mm1/arch/alpha/kernel/sys_nautilus.c	2006-10-13 17:14:23.000000000 +0100
@@ -200,7 +200,7 @@
 	bus = pci_scan_bus(0, alpha_mv.pci_ops, hose);
 	hose->bus = bus;
 
-	irongate = pci_find_slot(0, 0);
+	irongate = pci_get_bus_and_slot(0, 0);
 	bus->self = irongate;
 	bus->resource[1] = &irongate_mem;
 


                 reply	other threads:[~2006-10-16 15:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1161013732.24237.95.camel@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®