sysfs: create __ATTR_WO()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Aug 2013 22:02:01 +0000 (15:02 -0700)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Mon, 22 Dec 2014 17:50:40 +0000 (10:50 -0700)
This creates the macro __ATTR_WO() for write-only attributes, instead of
having to "open define" them.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a65fcce75a75c0d41b938f86d09d42b6f1733309)
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
include/linux/sysfs.h

index b1dc7aa872fd6e22454b20809a8cd95b041c0808..7dd65cbfcdb375ad4895a684f4a600bb73f5c0de 100644 (file)
@@ -80,6 +80,11 @@ struct attribute_group {
        .show   = _name##_show,                                         \
 }
 
+#define __ATTR_WO(_name) {                                             \
+       .attr   = { .name = __stringify(_name), .mode = S_IWUSR },      \
+       .store  = _name##_store,                                        \
+}
+
 #define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO),            \
                         _name##_show, _name##_store)