]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
sysfs.h: add ATTRIBUTE_GROUPS() macro
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 14 Jul 2013 23:05:52 +0000 (16:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Jul 2013 17:57:36 +0000 (10:57 -0700)
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>
include/linux/sysfs.h

index 9cd20c8404e5396c9b118c557b21e786b58dbc39..f62ff01e5f5994ab3cd2cb48b7097253e30e1808 100644 (file)
@@ -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;