Re: [PATCH] exporting capability code/name pairs (try #5.1)

Greg KH
2008-02-19T16:23:29Z

On Mon, Feb 18, 2008 at 05:45:46PM +0900, Kohei KaiGai wrote:
> Greg KH wrote:
> >>> Also, this code can be cleaned up a lot by just using the basic kobject
> >>> attributes, and not rolling your own types here.
> >> I replaced my own defined capability_attribute by kobj_attribute.
> >>
> >> It made the patch cleaned up, however, it also impossible to share a single
> >> _show() method instance, because kobj_attribute does not have any private member.
> >> Is there any reason why kobj_attribute does not have "void *private;"?
> >
> > Because no one has asked for it? :)
> >
> > Or you can just do as the example in samples/kobject/ does it, no need
> > for the void pointer as that code shows.
>
> It shows us a good example in samples/kobject.
>
> However, it is unsuitable to export the list of capabilities.
> The shared _show() method (b_show) calls strcmp() once with the name of kobject
> attribute to switch its returning string.
> If we have 34 of candidates to be returned, like the capability case, we have
> to call strcmp() 33 times in maximum.
>
> If we can have a private member in kobj_attribute, we can found the content
> to be returned in a single step.

Ok, again, just send me a patch that adds this functionality and we will
be very glad to consider it.

thnaks,

greg k-h