Re: [RFClue] pci_get_device, new driver model

From: Alan Cox
Date: Fri Oct 07 2005 - 12:03:36 EST


On Gwe, 2005-10-07 at 09:18 -0700, William D Waddington wrote:
> 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?

If you are saving the pci device point then yes you should. If you are
using pci_module_init() and the hotplug interface instead then it may
not be neccessary.

> If I just give in to the new driver model how/when do I associate
> instance/minor numbers with boards found? Is it ever possible for
> ordinary PCI boards to be (logically) removed and re-added w/out
> removing the driver? If so, how to maintain association between
> a particular board and minor number?

Its up to you how you implement this. One requirement I suspect would be
that the boards have unique serial numbers. Most drivers do not retain
state if someone unplugs a board, moves it and plugs it back in. Instead
they report the old device as "gone" and let user space sort it out

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/