All of lore.kernel.org
 help / color / mirror / Atom feed
From: Himanshi Jain <himshijain.hj@gmail.com>
To: outreachy-kernel@googlegroups.com, lars@metafoo.de,
	Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de,
	pmeerw@pmeerw.net, gregkh@linuxfoundation.org,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, nick.desaulniers@gmail.com,
	daniel.baluta@gmail.com
Subject: [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro
Date: Wed, 13 Sep 2017 14:14:07 +0530	[thread overview]
Message-ID: <2bc7a124ab925dd2c50aa8c778745d179777d50d.1505291907.git.himshijain.hj@gmail.com> (raw)
In-Reply-To: <cover.1505291907.git.himshijain.hj@gmail.com>

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



  reply	other threads:[~2017-09-13  8:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13  8:42 [PATCH v2 0/2] Rewrite the IIO_DEVICE_ATTR_NAMED API to pass name as string Himanshi Jain
2017-09-13  8:55 ` Himanshi Jain
2017-09-13  8:44 ` Himanshi Jain [this message]
2017-09-13  8:44   ` [PATCH v2 2/2] iio: Change to __ATTR_NAMED() Himanshi Jain
2017-09-13 17:03   ` [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Jonathan Cameron
2017-09-13 18:58     ` Greg KH
2017-09-13 19:23       ` Lars-Peter Clausen
2017-09-13 20:50         ` Jonathan Cameron
2017-09-13 20:50           ` Jonathan Cameron
2017-09-18 10:49           ` Himanshi Jain
2017-09-21 13:54             ` Jonathan Cameron
2017-09-21 14:07               ` [Outreachy kernel] " Julia Lawall
2017-09-21 14:07                 ` Julia Lawall
2017-09-13 21:29         ` Greg KH
2017-09-13 21:43           ` Dan Carpenter
2017-09-13 21:58             ` Joe Perches
2017-09-13 23:16               ` Jonathan Cameron
2017-09-13 23:16                 ` Jonathan Cameron
2017-09-13 23:16                 ` Jonathan Cameron
2017-09-14  5:10               ` [Outreachy kernel] " Julia Lawall
2017-09-19 12:13           ` Lars-Peter Clausen
2017-09-13  8:46 ` [Outreachy kernel] [PATCH v2 0/2] Rewrite the IIO_DEVICE_ATTR_NAMED API to pass name as string Julia Lawall
2017-09-13 17:04   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2bc7a124ab925dd2c50aa8c778745d179777d50d.1505291907.git.himshijain.hj@gmail.com \
    --to=himshijain.hj@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=daniel.baluta@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick.desaulniers@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.