Re: [PATCH] [5/12] SYSFS: Add attribute array to sysdev classes

From: Greg KH
Date: Tue Jan 05 2010 - 18:22:23 EST


On Tue, Jan 05, 2010 at 05:24:51PM +0100, Andi Kleen wrote:
> On Tue, Jan 05, 2010 at 06:54:33AM -0800, Greg KH wrote:
> > On Tue, Jan 05, 2010 at 12:48:02PM +0100, Andi Kleen wrote:
> > >
> > > Add a attribute array that is automatically registered and unregistered
> > > to struct sysdev_class. This is similar to what struct class has.
> > >
> > > A lot of drivers add list of attributes, so it's better to do
> > > this easily in the common sysdev layer.
> > >
> > > This adds a new field to struct sysdev_class. I audited the
> > > whole tree and there are no dynamically allocated sysdev classes,
> > > so this is fully compatible.
> >
> > I agree, this should be done, but can you use an attribute group
> > instead, like the driver core does? That way you don't need the new
> > function that you created that duplicates that logic :)
>
> Actually the attributes use own loops for this too.
>
> In theory could add a group in the middle, but it would greatly complicate
> the driver interface for little gain.
>
> In theory the low loops could be shared between the group code
> and sysfs_create_files(), but I'm not sure it's really worth
> it because it's just a few lines of code (which are currently
> duplicated in multiple places anyways, so it's a net-win)
>
> You still want me to attempt that?

For now, nah, that's ok, I'll take this as-is. But if you want to make
this change in the future, feel free to.

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/