Re: proper place for devfs_register_chrdev with pci_module_init

From: Greg KH
Date: Wed Feb 04 2004 - 18:49:18 EST


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