Re: proper place for devfs_register_chrdev with pci_module_init

From: Richard B. Johnson
Date: Thu Feb 05 2004 - 07:41:55 EST


On Wed, 4 Feb 2004, Greg KH wrote:

> On Wed, Feb 04, 2004 at 05:29:31PM -0500, Richard B. Johnson wrote:
> >
> > I would call pci_find_class() and continue until a NULL is returned
> > or my vendor and device are returned in the structure.
>
> NOOOOO!!!!!
>
> Do NOT do this. Use pci_register_driver() instead. Using pci_find_*()
> is just broken and wrong for 99% of all pci drivers.
>
> If you do this you do not hook up into sysfs properly. You do not get
> modules automatically loaded for your driver. You do not get notified
> if the device is removed from the system. And, most importantly, you do
> not get exclusive access to the pci device.
>
> As for the original poster, look at one of the many existing char
> drivers for examples of what you need to do to register a char driver
> properly. It really has nothing to do with the pci interface at all
> (with the exception of when to register it...)
>
> thanks,
>
> greg k-h


WTF? How do you find out if your board in actually in the system?
You CANNOT load all possible modules, hoping that somebody will
hot-plug in one of the devices a year from now.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.


-
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/