summaryrefslogtreecommitdiff
path: root/include/linux/sysfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sysfs.h')
-rw-r--r--include/linux/sysfs.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 4cb54379e85a..f94c7ac77c48 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -24,6 +24,27 @@ struct attribute_group {
};
+
+/**
+ * Use these macros to make defining attributes easier. See include/linux/device.h
+ * for examples..
+ */
+
+#define __ATTR(_name,_mode,_show,_store) { \
+ .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \
+ .show = _show, \
+ .store = _store, \
+}
+
+#define __ATTR_RO(_name) { \
+ .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, \
+ .show = _name##_show, \
+}
+
+#define __ATTR_NULL { .attr = { .name = NULL } }
+
+#define attr_name(_attr) (_attr).attr.name
+
struct bin_attribute {
struct attribute attr;
size_t size;