Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1731435 > unrolled thread

[PATCH 1/2] include: linux: sysfs: Add __ATTR_NAMED macro

Started byHimanshi Jain <himshijain.hj@gmail.com>
First post2017-09-13 10:00 +0200
Last post2017-09-13 10:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Himanshi Jain <himshijain.hj@gmail.com> - 2017-09-13 10:00 +0200

#1731435 — [PATCH 1/2] include: linux: sysfs: Add __ATTR_NAMED macro

FromHimanshi Jain <himshijain.hj@gmail.com>
Date2017-09-13 10:00 +0200
Subject[PATCH 1/2] include: linux: sysfs: Add __ATTR_NAMED macro
Message-ID<upaKt-4rT-7@gated-at.bofh.it>
Add __ATTR_NAMED macro similar to __ATTR but taking name as a
string instead of implicit conversion of argument to string using
the macro _stringify(_name).

Signed-off-by: Himanshi Jain <himshijain.hj@gmail.com>
---
 include/linux/sysfs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index aa02c32..20321cf 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -104,6 +104,13 @@ struct attribute_group {
 	.store	= _store,						\
 }
 
+#define __ATTR_NAMED(_name, _mode, _show, _store) {			\
+	.attr = {.name = _name,						\
+		 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) },		\
+	.show = _show,							\
+	.store = _store,						\
+}
+
 #define __ATTR_PREALLOC(_name, _mode, _show, _store) {			\
 	.attr = {.name = __stringify(_name),				\
 		 .mode = SYSFS_PREALLOC | VERIFY_OCTAL_PERMISSIONS(_mode) },\
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web