Re: [linux-usb-devel] Re: [RFC] Changes to the driver model class code.

From: Dmitry Torokhov
Date: Tue Mar 15 2005 - 15:12:41 EST

On Tue, 15 Mar 2005 11:34:15 -0800, Greg KH <greg@xxxxxxxxx> wrote:
> On Tue, Mar 15, 2005 at 12:47:38PM -0500, Dmitry Torokhov wrote:
> > Hi Greg,
> >
> > On Tue, 15 Mar 2005 09:08:34 -0800, Greg KH <greg@xxxxxxxxx> wrote:
> >
> > > So I'll be slowly converting the kernel over to using this new
> > > interface, and when finished, I can get rid of the old class apis (or
> > > actually, just make them static) so that no one can implement them
> > > improperly again...
> >
> > I disagree with this last step. What I liked about the driver model is
> > that once you convert (properly) subsystem to using it you
> > automatically get your proper refcounting and memory gets released at
> > proper time. The change as it proposed disconnects class device
> > instance from the meat so separate refcounting implementation
> > isneeded. This increases maintenance costs.
> I agree. The big point is that "properly" statement. _Everyone_ gets
> this wrong the first time they do it. And the second. Hopefully, if
> they are persistant enough, the third time they get closer, and so on...
> We need to make the driver model interface easier to use. The class
> code is used by more individual drivers than the struct device, so
> that's the first place to make these kinds of changes, as it is the most
> necessary.
> > I always viewed class_simple as a stop-gap measure to get hotplug
> > events in place until proper implementation is done. Please leave the
> > original interface in place so it can still be used if one wshes to do
> > so.
> No, no one has so far done the "proper implementation" and I don't blame
> them. It's not simple, and it gives them a very low payback for their
> time. The old interface is good and powerful and hard to use.

It takes only one proper implementation and the rest will follow. If
buses and devices can be implemented properly so can be calss_devices.
There is nothing magic about them.

Besides, if you divorce class device and the "meat" like that most of
the time you just ignoring the same problems that exist with the
"meat". Class is not useful by itself, it is additional attributes and
such that gets used. And with additional attributes you again have
your lifetime rules, refounting and such. In effect the change does
not buy you anything unless class interface is extremely limited.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at