backports: add DEVICE_ATTR_RW
authorHauke Mehrtens <hauke@hauke-m.de>
Wed, 18 Sep 2013 21:16:20 +0000 (23:16 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 21 Oct 2013 21:58:37 +0000 (23:58 +0200)
This is used by drivers/media/v4l2-core/v4l2-dev.c.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
backport/backport-include/linux/device.h
backport/backport-include/linux/sysfs.h

index 8f080cc9f86733940f7b41eb1bc84fcdb97ef326..2244c6263c38d6410d0bf756bd1e468ecf27854d 100644 (file)
@@ -192,6 +192,8 @@ backport_device_release_driver(struct device *dev)
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
 #define DEVICE_ATTR_RO(_name) \
 struct device_attribute dev_attr_ ## _name = __ATTR_RO(_name);
+#define DEVICE_ATTR_RW(_name) \
+struct device_attribute dev_attr_ ## _name = __ATTR_RW(_name)
 
 #define ATTRIBUTE_GROUPS(_name) \
 static struct BP_ATTR_GRP_STRUCT _name##_dev_attrs[ARRAY_SIZE(_name##_attrs)];\
index a2ef73f1b836a68cb8a95b6c451495ca8ab46bc0..13bab43a63e997dee3a6a7bedccf55a94d322394 100644 (file)
@@ -31,4 +31,9 @@ do {                                                  \
 #endif
 #endif
 
+#ifndef __ATTR_RW
+#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO),            \
+                        _name##_show, _name##_store)
+#endif
+
 #endif /* __BACKPORT_LINUX_SYSFS_H */