[MODERATED] Re: [PATCH 4/4] walnut 4

Peter Zijlstra <[email protected]>
Newsgroups org.kernel.lore.historical-speck
Message-ID <[email protected]>
On Thu, Mar 07, 2019 at 02:56:31PM +0100, speck for Greg KH wrote:
> sysfs files have the ability to be "shown" or not, on their own.  There
> is a "is_visable()" callback for every sysfs group.
> 
> This allows you to set a whole bunch of groups to a device, and then,
> when the device is created, the kobject core will call back to you and
> ask "should I show this file?"  At that point in time, you can do your
> check for "boot_cpu_has(...)" and the like to see if you really should
> be showing the file or not.
> 
> This saves you all the horrid mess of the merge_attr() function, trying
> to overload NULL pointers here in this attribute list, and other such
> hacks.
> 
> I guess no one stopped to think why _only_ the perf cpu code has a
> function like merge_attr(), and how the rest of the kernel could get
> away without needing a hack like that :(
> 
> Anyway, rant over.  I'll see if I can squeze this into the 4.9.y tree as
> it was before the major revamp of the perf cpu sysfs files.
> 
> In the future, someone should just switch all of this to attribute
> groups, like the rest of the kernel uses, so no such crazyness is
> needed.

Right; that would be a really nice cleanup. I suppose nobody who touched
all that (very much including me) knew about that is_visible() thing.

I'll try and not forget and make someone clean that up.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.