driver-core: Add attribute argument to class_attribute show/store

Passing the attribute to the low level IO functions allows all kinds
of cleanups, by sharing low level IO code without requiring
an own function for every piece of data.

Also drivers can extend the attributes with own data fields
and use that in the low level function.

This makes the class attributes the same as sysdev_class attributes
and plain attributes.

This will allow further cleanups in drivers.

Full tree sweep converting all users.

Signed-off-by: Andi Kleen <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Andi Kleen 2010-01-05 12:48:07 +01:00 • committed by Greg Kroah-Hartman
commit 28812fe11a
21 changed files with 87 additions and 32 deletions

View file

@ -623,7 +623,9 @@ static const struct attribute_group gpiochip_attr_group = {
* /sys/class/gpio/unexport ... write-only
* integer N ... number of GPIO to unexport
*/
static ssize_t export_store(struct class *class, const char *buf, size_t len)
static ssize_t export_store(struct class *class,
struct class_attribute *attr,
const char *buf, size_t len)
{
long gpio;
int status;
@ -653,7 +655,9 @@ done:
return status ? : len;
}
static ssize_t unexport_store(struct class *class, const char *buf, size_t len)
static ssize_t unexport_store(struct class *class,
struct class_attribute *attr,
const char *buf, size_t len)
{
long gpio;
int status;