public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [0/12] SYSFS: Sysfs attribute improvements
@ 2010-01-05 11:47 Andi Kleen
  2010-01-05 11:47 ` [PATCH] [1/12] SYSFS: Pass attribute in sysdev_class attributes show/store Andi Kleen
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Andi Kleen @ 2010-01-05 11:47 UTC (permalink / raw)
  To: linux-kernel, greg


sysdev_class attributes and class attributes do not pass
their own attribute to the low level store/show functions. This means
that itiss not possible to use shared functions for common data,
but each data item had to have its own function. Typically this
lead to ugly and big custom macro cascades in drivers, generating
the store/show functions for each attribute. This leads to 
large code and is ugly.

When the attributes are passed to the callbacks -- like they are for plain
attributes and sysdev attributes -- it's possible to "derive"
own attribute objects that carry some data, use that data and then call into 
shared store/show code.

This patchkit fixes up these callback interfaces to allow to do this. This
involves two tree sweeps for sysdev_class_attributes and class_attributes,
changing them all to accept the new attribute argument.

I tried to convert all users, but was only able to compile test on x86.

All users were converted in a single patch to avoid unbisectable
sections. I didn't put all the individual driver maintainers in cc,
they probably wouldn't need to care.

Also I added some utility functions to easier deal with arrays
of attributes. A lot of users define multiple attributes and had
to open code array handling for this. Add new sysfs interfaces
to handle the arrays directly. sysdev classes now can just
directly carry their own attributes, similar to normal classes.

Then the CPU and the NODE driver in drivers/base serve as a poster
child for the new facilities and shrink their code dramatically
by using the new facilities.

In addition I added a new string attribute type derived 
from class attributes. This allows various drivers who use
class attributes to export static version strings to just
use a single macro, no custom callbacks.

I didn't convert all drivers over to the new facilities, this
can be done gradually.

-Andi

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2010-01-05 23:22 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-05 11:47 [PATCH] [0/12] SYSFS: Sysfs attribute improvements Andi Kleen
2010-01-05 11:47 ` [PATCH] [1/12] SYSFS: Pass attribute in sysdev_class attributes show/store Andi Kleen
2010-01-05 14:53   ` Greg KH
2010-01-05 11:47 ` [PATCH] [2/12] SYSFS: Convert node driver class attributes to be data driven Andi Kleen
2010-01-05 11:48 ` [PATCH] [3/12] SYSDEV: Convert cpu driver sysdev class attributes Andi Kleen
2010-01-05 11:48 ` [PATCH] [4/12] SYSFS: Add sysfs_add/remove_files utility functions Andi Kleen
2010-01-05 14:53   ` Greg KH
2010-01-05 16:21     ` Andi Kleen
2010-01-05 23:20       ` Greg KH
2010-01-05 11:48 ` [PATCH] [5/12] SYSFS: Add attribute array to sysdev classes Andi Kleen
2010-01-05 14:54   ` Greg KH
2010-01-05 16:24     ` Andi Kleen
2010-01-05 23:20       ` Greg KH
2010-01-05 11:48 ` [PATCH] [6/12] SYSDEV: Convert node driver Andi Kleen
2010-01-05 11:48 ` [PATCH] [7/12] SYSDEV: Use sysdev_class attribute arrays in " Andi Kleen
2010-01-05 11:48 ` [PATCH] [8/12] SYSFS: Add sysdev_create/remove_files Andi Kleen
2010-01-05 11:48 ` [PATCH] [9/12] SYSFS: Fix type of sysdev class attribute in memory driver Andi Kleen
2010-01-05 11:48 ` [PATCH] [10/12] SYSDEV: Add attribute argument to class_attribute show/store Andi Kleen
2010-01-05 11:48 ` [PATCH] [11/12] SYSFS: Add class_attr_string for simple read-only string Andi Kleen
2010-01-05 11:48 ` [PATCH] [12/12] SYSFS: Convert some drivers to CLASS_ATTR_STRING Andi Kleen
2010-01-05 14:55 ` [PATCH] [0/12] SYSFS: Sysfs attribute improvements Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox