[openib-general] Re: device classes

Greg KH greg at kroah.com
Wed Aug 4 15:55:26 PDT 2004


On Tue, Aug 03, 2004 at 10:53:08PM -0700, Roland Dreier wrote:
> Today we decided that upper-layer protocols like IPoIB should be
> classes (in the <linux/device.h> sense of the word ;).  However, as I
> start to try and figure things out, I don't see how a class gets
> hotplug-type notifications when devices appear or disappear.

A class?  Look at the struct class_interface code, specifically
class_interface_register() and class_interface_unregister() functions.
If you call them, then the function pointers you pass in for the add and
remove functions in the struct class_interface will get called for every
struct class_device that is added or removed for that struct class.

> Am I missing something, or does the IB core have to implement
> something where classes like IPoIB register with the core, and then
> the core creates class_device instances for every registered class
> when devices are added?

No, that sounds about right.  IPoIB would be a struct class.  Hm, but
then you want that class code to be called whenever a struct device
(really a ib_device) is added to the system.  That's not built in
anywhere, you'll have to either add some custom code, or I need to get
off my butt and create a struct bus_interface chunk of code that will
work like struct class_interface.  Would that help out here?

thanks,

greg k-h



More information about the general mailing list