From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: [PATCH] IOC3: Switch to pci refcounting safe APIs
Date: Mon, 23 Apr 2007 15:06:40 +0100 [thread overview]
Message-ID: <20070423150640.1faf693f@the-village.bc.nu> (raw)
Untested as I don't have any IOC3 hardware so if someone could give this
a check that would be great.
Signed-off-by: Alan Cox <alan@redhat.com>
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.21-rc6-mm1/drivers/net/ioc3-eth.c linux-2.6.21-rc6-mm1/drivers/net/ioc3-eth.c
--- linux.vanilla-2.6.21-rc6-mm1/drivers/net/ioc3-eth.c 2007-04-12 14:15:04.000000000 +0100
+++ linux-2.6.21-rc6-mm1/drivers/net/ioc3-eth.c 2007-04-23 11:49:32.708000752 +0100
@@ -1103,20 +1103,30 @@
* MiniDINs; all other subdevices are left swinging in the wind, leave
* them disabled.
*/
-static inline int ioc3_is_menet(struct pci_dev *pdev)
+
+static int ioc3_adjacent_is_ioc3(struct pci_dev *pdev, int dev)
+{
+ struct pci_dev *dev = pci_get_bus_and_slot(pdev->bus->number,
+ PCI_DEVFN(dev, 0));
+ int ret = 0;
+
+ if (dev) {
+ if (dev->vendor == PCI_VENDOR_ID_SGI &&
+ dev->device == PCI_DEVICE_ID_SGI_IOC3)
+ ret = 1;
+ pci_dev_put(dev);
+ }
+ return ret;
+}
+
+static int ioc3_is_menet(struct pci_dev *pdev)
{
struct pci_dev *dev;
- return pdev->bus->parent == NULL
- && (dev = pci_find_slot(pdev->bus->number, PCI_DEVFN(0, 0)))
- && dev->vendor == PCI_VENDOR_ID_SGI
- && dev->device == PCI_DEVICE_ID_SGI_IOC3
- && (dev = pci_find_slot(pdev->bus->number, PCI_DEVFN(1, 0)))
- && dev->vendor == PCI_VENDOR_ID_SGI
- && dev->device == PCI_DEVICE_ID_SGI_IOC3
- && (dev = pci_find_slot(pdev->bus->number, PCI_DEVFN(2, 0)))
- && dev->vendor == PCI_VENDOR_ID_SGI
- && dev->device == PCI_DEVICE_ID_SGI_IOC3;
+ return pdev->bus->parent == NULL &&
+ ioc3_adjacent_is_ioc3(pdev, 0) &&
+ ioc3_adjacent_is_ioc3(pdev, 1) &&
+ ioc3_adjacent_is_ioc3(pdev, 2));
}
#ifdef CONFIG_SERIAL_8250
next reply other threads:[~2007-04-23 14:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-23 14:06 Alan Cox [this message]
2007-04-23 14:09 ` [PATCH] IOC3: Switch to pci refcounting safe APIs Sergei Shtylyov
2007-04-23 14:19 ` Alan Cox
2007-04-23 14:21 ` Sergei Shtylyov
2007-04-23 14:35 ` Ralf Baechle
2007-04-23 15:18 ` Alan Cox
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=20070423150640.1faf693f@the-village.bc.nu \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.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