From: Greg KH <greg@kroah.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-pci@atrey.karlin.mff.cuni.cz, parisc-linux@parisc-linux.org
Subject: [parisc-linux] Re: How to determine whether a device is PCI or not
Date: Fri, 29 Oct 2004 19:37:18 -0700 [thread overview]
Message-ID: <20041030023718.GA1099@kroah.com> (raw)
In-Reply-To: <20041027141522.GK3450@parcelfarce.linux.theplanet.co.uk>
On Wed, Oct 27, 2004 at 03:15:22PM +0100, Matthew Wilcox wrote:
> On Wed, Oct 27, 2004 at 03:32:16PM +0200, Joel Soete wrote:
> > while (dev != &root) {
> > +#ifdef CONFIG_PCI
> > if (dev->bus == &pci_bus_type) {
> > unsigned int devfn = to_pci_dev(dev)->devfn;
> > path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5);
> > } else if (dev->bus == &parisc_bus_type) {
> > +#else
> > + if (dev->bus == &parisc_bus_type) {
> > +#endif
> > path->bc[i--] = to_parisc_device(dev)->hw_path;
> > }
> > dev = dev->parent;
>
> The problem here is that pci_bus_type is declared inside an #ifdef
> CONFIG_PCI. What we *actually* want to know is "is this device a
> pci_dev?" and this isn't the best way to ask this question. How about
> we add exactly that question to <linux/pci.h>, something like:
Ick, no. Devices do not "show" their type, you have to explicitly know
what type they are in order to use them.
Why are you wanting to know this? What are you trying to do with a
generic struct device * where you don't know exactly what type it is?
thanks,
greg k-h
p.s. bonus points to the first person who finds in the kernel where I
myself have violated the second sentance in this response :)
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
next parent reply other threads:[~2004-10-30 2:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20041027121955.GH3450@parcelfarce.linux.theplanet.co.uk>
[not found] ` <416174800000772D@mail-4-bnl.tiscali.it>
[not found] ` <20041027141522.GK3450@parcelfarce.linux.theplanet.co.uk>
2004-10-30 2:37 ` Greg KH [this message]
2004-10-30 15:40 ` [parisc-linux] Re: How to determine whether a device is PCI or not Matthew Wilcox
[not found] ` <20041030154822.GA9036@kroah.com>
2004-10-30 16:46 ` Matt Domsch
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=20041030023718.GA1099@kroah.com \
--to=greg@kroah.com \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=matthew@wil.cx \
--cc=parisc-linux@parisc-linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.