sysfs.h: add ATTRIBUTE_GROUPS() macro
[pandora-kernel.git] / include / linux / sysfs.h
index e2cee22..f62ff01 100644 (file)
@@ -79,6 +79,8 @@ struct attribute_group {
        .show   = _name##_show,                                 \
 }
 
+#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
+
 #define __ATTR_NULL { .attr = { .name = NULL } }
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -92,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;