diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-14 16:05:52 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-16 10:57:36 -0700 |
commit | f2f37f58b1b933b06d6d84e80a31a1b500fb0db2 (patch) | |
tree | 0df34f53690241b69454f5077888bce4287e5dfc | |
parent | b9b3259746d77f4fcb786e2a43c25bcc40773755 (diff) | |
download | linux-f2f37f58b1b933b06d6d84e80a31a1b500fb0db2.tar.bz2 |
sysfs.h: add ATTRIBUTE_GROUPS() macro
To make it easier for driver subsystems to work with attribute groups,
create the ATTRIBUTE_GROUPS macro to remove some of the repetitive
typing for the most common use for attribute groups.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | include/linux/sysfs.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9cd20c8404e5..f62ff01e5f59 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -94,6 +94,15 @@ struct attribute_group { #define __ATTR_IGNORE_LOCKDEP __ATTR #endif +#define ATTRIBUTE_GROUPS(name) \ +static const struct attribute_group name##_group = { \ + .attrs = name##_attrs, \ +}; \ +static const struct attribute_group *name##_groups[] = { \ + &name##_group, \ + NULL, \ +} + #define attr_name(_attr) (_attr).attr.name struct file; |