[PATCH 29/47] headers: Add DEVICE_ATTR_ADMIN_RW

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The DEVICE_ATTR_ADMIN_RW define was added with kernel 5.9 and is now
used by ssb.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/device.h | 10 ++++++++++
 backport/backport-include/linux/sysfs.h  |  9 +++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 backport/backport-include/linux/device.h

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 */
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux