* [parisc-linux] Re: How to determine whether a device is PCI or not [not found] ` <20041027141522.GK3450@parcelfarce.linux.theplanet.co.uk> @ 2004-10-30 2:37 ` Greg KH 2004-10-30 15:40 ` Matthew Wilcox 0 siblings, 1 reply; 3+ messages in thread From: Greg KH @ 2004-10-30 2:37 UTC (permalink / raw) To: Matthew Wilcox; +Cc: linux-pci, parisc-linux 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [parisc-linux] Re: How to determine whether a device is PCI or not 2004-10-30 2:37 ` [parisc-linux] Re: How to determine whether a device is PCI or not Greg KH @ 2004-10-30 15:40 ` Matthew Wilcox [not found] ` <20041030154822.GA9036@kroah.com> 0 siblings, 1 reply; 3+ messages in thread From: Matthew Wilcox @ 2004-10-30 15:40 UTC (permalink / raw) To: Greg KH; +Cc: linux-pci, parisc-linux, Matthew Wilcox On Fri, Oct 29, 2004 at 07:37:18PM -0700, Greg KH wrote: > 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? In order to communicate with PA-RISC firmware, you have to know the path to a device. It's typically represented as something like [10/8/4/5/0]. This device can be PCI, GSC or EISA. There's some moderately arcane rules for turning a device into a path that you really don't care about, but we need the devfn for PCI devices and the hw_path for GSC devices. So what we want to do is, given a struct device, determine its path; and given a path, turn it into a struct device. The device model lets us do this quite nicely -- much better than having duplicated routines for starting with a pci_dev or a parisc_device. If you prefer to keep this out of linux/pci.h, that's fine, we can keep it private to arch/parisc. I thought this might be something other architectures might want to use (maybe for openfirmware?) -- "Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain _______________________________________________ parisc-linux mailing list parisc-linux@lists.parisc-linux.org http://lists.parisc-linux.org/mailman/listinfo/parisc-linux ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20041030154822.GA9036@kroah.com>]
* [parisc-linux] Re: How to determine whether a device is PCI or not [not found] ` <20041030154822.GA9036@kroah.com> @ 2004-10-30 16:46 ` Matt Domsch 0 siblings, 0 replies; 3+ messages in thread From: Matt Domsch @ 2004-10-30 16:46 UTC (permalink / raw) To: Greg KH; +Cc: linux-pci, parisc-linux, Matthew Wilcox On Sat, Oct 30, 2004 at 08:48:22AM -0700, Greg KH wrote: > On Sat, Oct 30, 2004 at 04:40:07PM +0100, Matthew Wilcox wrote: > > > > If you prefer to keep this out of linux/pci.h, that's fine, we can keep > > it private to arch/parisc. I thought this might be something other > > architectures might want to use (maybe for openfirmware?) > > Let's keep it private for now. If openfirmware ever moves to the device > tree properly, we can deal with it then :) The EDD sysfs symlinks would like something like this, not only for PCI (it does this today by calling pci_find_slot() with the values BIOS tells it), but doesn't have the infrastructure for making symlinks to the underlying ATA, SCSI, SAS (coming), ... devices. I removed the horrible hacks I put in to try to guess what a device is, and don't create the symlink from the EDD device to the actual disk device. But it would be nice to have a generic method to do it so I can add that back in. Thanks, Matt -- Matt Domsch Sr. Software Engineer, Lead Engineer Dell Linux Solutions linux.dell.com & www.dell.com/linux Linux on Dell mailing lists @ http://lists.us.dell.com _______________________________________________ parisc-linux mailing list parisc-linux@lists.parisc-linux.org http://lists.parisc-linux.org/mailman/listinfo/parisc-linux ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-10-30 16:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` [parisc-linux] Re: How to determine whether a device is PCI or not Greg KH
2004-10-30 15:40 ` Matthew Wilcox
[not found] ` <20041030154822.GA9036@kroah.com>
2004-10-30 16:46 ` Matt Domsch
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.