[lkml]   [2010]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Can we remove pci_find_device() yet?
On Tue, 2010-01-12 at 21:34 +0100, Krzysztof Halasa wrote:
> Greg KH <> writes:
> > Close, but if you do this, please name the function
> > hisax_find_pci_device() or something, and change the drivers to use it
> > instead. Also put a big fat warning in the function that calling this
> > is unsafe for any PCI hotplug type machine.
> BTW, I have a driver in the works which uses these functions, and I
> wonder how to do it correctly. The problem is that the hardware is a
> dual-function PCI card (two DEC Tulip Ethernet controllers) but part of
> the first device (EEPROM interface or something like that) is used by
> both (there is an FPGA connected there, serving both channels).
> This means drivers for dev#0 and dev#1 (both "normal" PCI controllers)
> need to register and access part of dev#0 BARs.

I hope you realise that this is a design error! Linux is fairly
forgiving and allows PCI drivers to do unusual things, but other OSes
make it hard or impossible for PCI drivers to coordinate multiple

> How do I do that properly, in terms of PCI API?

One of our older controllers had a similar design error in that the two
functions would sometimes have to be reset together. The way we look
for the second function is:

dev = pci_dev_get(dev1);
while ((dev = pci_get_device(vendor_id, device_id, dev))) {
if (dev->bus == dev1->bus &&
dev->devfn == dev1->devfn + 1) {
dev2 = dev;

I assume this is 'properly' since no-one has told me otherwise.


Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

 \ /
  Last update: 2010-01-12 21:55    [W:0.148 / U:0.724 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site