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


Groups > linux.kernel > #1731462

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

From Himanshi Jain <himshijain.hj@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro
Date 2017-09-13 10:50 +0200
Message-ID <upbwR-50A-9@gated-at.bofh.it> (permalink)
References <upbwR-50A-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Himanshi Jain <himshijain.hj@gmail.com> - 2017-09-13 10:50 +0200
  Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Jonathan Cameron <jic23@kernel.org> - 2017-09-13 19:10 +0200
    Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Greg KH <gregkh@linuxfoundation.org> - 2017-09-13 21:00 +0200
      Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Lars-Peter Clausen <lars@metafoo.de> - 2017-09-13 21:30 +0200
        Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Greg KH <gregkh@linuxfoundation.org> - 2017-09-13 23:40 +0200
          Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-13 23:50 +0200
            Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Joe Perches <joe@perches.com> - 2017-09-14 00:00 +0200
              Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Jonathan Cameron <jic23@jic23.retrosnub.co.uk> - 2017-09-14 01:20 +0200
              Re: [Outreachy kernel] Re: [PATCH v2 1/2] include: linux: sysfs:  Add __ATTR_NAMED macro Julia Lawall <julia.lawall@lip6.fr> - 2017-09-14 07:20 +0200
          Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Lars-Peter Clausen <lars@metafoo.de> - 2017-09-19 14:20 +0200
        Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Jonathan Cameron <jic23@jic23.retrosnub.co.uk> - 2017-09-14 01:20 +0200
          Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Himanshi Jain <himshijain.hj@gmail.com> - 2017-09-18 12:50 +0200
            Re: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Jonathan Cameron <Jonathan.Cameron@huawei.com> - 2017-09-21 16:00 +0200
              Re: [Outreachy kernel] Re: [PATCH v2 1/2] include: linux: sysfs:  Add __ATTR_NAMED macro Julia Lawall <julia.lawall@lip6.fr> - 2017-09-21 16:10 +0200

csiph-web