Re: [PATCH] cdev 2/2: hide cdev->kobj

From: Greg KH
Date: Fri Mar 12 2004 - 18:33:09 EST


On Fri, Mar 12, 2004 at 11:33:29AM -0700, Jonathan Corbet wrote:
> The existing cdev interface requires users to deal with the embedded
> kobject in two places:
>
> - The kobject name field must be set before adding the cdev, and
> - Should cdev_add() fail, a call to kobject_put() is required.
>
> IMO, this exposure of the embedded kobject makes the interface more brittle
> and harder to understand. It's also unnecessary. With the removal of
> /sys/cdev, a call to cdev_del() will nicely replace kobject_put(), and the
> name setting is easily wrapped.
>
> This is against 2.6.4, but depends on the /sys/cdev removal patch.

I've also applied this and it works for me.

But do we really even need this anymore? The only reason the name was
even semi-important was that we were actually putting the kobject into
sysfs. Now that we are not doing that, it isn't needed. In fact I am
now running with a simple:
#define cdev_set_name(cdev, args...)
in cdev.h to verify this.

Anyone object to me just deleting cdev_set_name() and everywhere it is
now used entirely?

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/