Re: [RFClue] pci_get_device, new driver model

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 07, 2005 at 09:18:00AM -0700, William D Waddington wrote:
> CRAP, I think this one got sent when half written - sorry about that.
> 
> I'm missing something fundamental, and beg your indulgence.  Read LDD 3,
> googled, and looked around in the code (but not in the right places...)
> 
> My current 2.6 drivers support multiple identical PCI boards per host.
> The init code spins on pci_find_device and assigns instance/minor
> numbers as boards are found.  Load script insmods the driver,
> gets the major # from /proc/devices, and creates the /dev/ entries
> on the fly.

Ick, don't do that.

> If I convert to pci_get_device, it looks like subsequent calls in the
> loop "put" the previously "gotten" device.  I need the pci_dev struct
> to persist for later use (DMA, etc).  Do I take an additional bump to
> the ref count for each board found before looping, and "put" each when
> the driver is unloaded?

When you save the pointer off, you need to increment the count.

> If I just give in to the new driver model how/when do I associate
> instance/minor numbers with boards found?

It doesn't matter.  Use udev to handle your device naming for you, it
can associate any type of name with any type of device you have, and you
can do it by topology, location, serial number, or the phase of the
moon.

> Is it ever possible for ordinary PCI boards to be (logically) removed
> and re-added w/out removing the driver?

Yes, on hotplug pci systems.  You can fake this out by testing with the
fakephp driver if you don't have this kind of hardware.

> If so, how to maintain association between a particular board and
> minor number?

Again, use udev, that's what it is there for.

Hope this helps,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux