aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-10-10 17:29:26 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-10-18 23:59:40 +0200
commit02f1f842534cab47d160f43456367ba39e53726a (patch)
tree562861a63835e2ed9af68edbad2fda8b6fba8f19
parent671fd655057701fac11b4101e1d4c54d37cd2b61 (diff)
downloadbackports-02f1f842534cab47d160f43456367ba39e53726a.tar.gz
headers: Add DEVICE_ATTR_ADMIN_RW
The DEVICE_ATTR_ADMIN_RW define was added with kernel 5.9 and is now used by ssb. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/device.h10
-rw-r--r--backport/backport-include/linux/sysfs.h9
2 files changed, 19 insertions, 0 deletions
diff --git a/backport/backport-include/linux/device.h b/backport/backport-include/linux/device.h
new file mode 100644
index 00000000..46f2190b
--- /dev/null
+++ b/backport/backport-include/linux/device.h
@@ -0,0 +1,10 @@
+#ifndef __BACKPORT_DEVICE_H_
+#define __BACKPORT_DEVICE_H_
+#include_next <linux/device.h>
+
+#ifndef DEVICE_ATTR_ADMIN_RW
+#define DEVICE_ATTR_ADMIN_RW(_name) \
+ struct device_attribute dev_attr_##_name = __ATTR_RW_MODE(_name, 0600)
+#endif
+
+#endif /* __BACKPORT_DEVICE_H_ */
diff --git a/backport/backport-include/linux/sysfs.h b/backport/backport-include/linux/sysfs.h
index ad8a8229..7126fb03 100644
--- a/backport/backport-include/linux/sysfs.h
+++ b/backport/backport-include/linux/sysfs.h
@@ -22,4 +22,13 @@ static inline int sysfs_emit(char *buf, const char *fmt, ...)
#endif /* CONFIG_SYSFS */
#endif /* < 5.10 */
+#ifndef __ATTR_RW_MODE
+#define __ATTR_RW_MODE(_name, _mode) { \
+ .attr = { .name = __stringify(_name), \
+ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
+ .show = _name##_show, \
+ .store = _name##_store, \
+}
+#endif
+
#endif /* __BACKPORT_LINUX_SYSFS_H */