aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-14 19:05:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-16 13:57:36 -0400
commitf2f37f58b1b933b06d6d84e80a31a1b500fb0db2 (patch)
tree0df34f53690241b69454f5077888bce4287e5dfc /include
parentb9b3259746d77f4fcb786e2a43c25bcc40773755 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sysfs.h9
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 {
94#define __ATTR_IGNORE_LOCKDEP __ATTR 94#define __ATTR_IGNORE_LOCKDEP __ATTR
95#endif 95#endif
96 96
97#define ATTRIBUTE_GROUPS(name) \
98static const struct attribute_group name##_group = { \
99 .attrs = name##_attrs, \
100}; \
101static const struct attribute_group *name##_groups[] = { \
102 &name##_group, \
103 NULL, \
104}
105
97#define attr_name(_attr) (_attr).attr.name 106#define attr_name(_attr) (_attr).attr.name
98 107
99struct file; 108struct file;