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 2/2] iio: Change to __ATTR_NAMED()
Date: Wed, 13 Sep 2017 14:14:23 +0530	[thread overview]
Message-ID: <30fdd58ce18399c77152ef13180ef2966cf36be0.1505291907.git.himshijain.hj@gmail.com> (raw)
In-Reply-To: <2bc7a124ab925dd2c50aa8c778745d179777d50d.1505291907.git.himshijain.hj@gmail.com>

Add IIO_ATTR_NAMED macro to use __ATTR_NAMED to allow passing
name as string to IIO_DEVICE_ATTR_NAMED. Change current usage
of IIO_DEVICE_ATTR_NAMED to pass name as string.

Signed-off-by: Himanshi Jain <himshijain.hj@gmail.com>
---
 drivers/iio/adc/ad7793.c          | 2 +-
 drivers/staging/iio/adc/ad7192.c  | 2 +-
 drivers/staging/iio/adc/ad7280a.c | 4 ++--
 include/linux/iio/sysfs.h         | 6 +++++-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index e6706a0..d74e324 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -420,7 +420,7 @@ static ssize_t ad7793_show_scale_available(struct device *dev,
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_m_in_scale_available,
-		in_voltage-voltage_scale_available, S_IRUGO,
+		"in_voltage-voltage_scale_available", S_IRUGO,
 		ad7793_show_scale_available, NULL, 0);
 
 static struct attribute *ad7793_attributes[] = {
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index d11c6de..daff38c 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -341,7 +341,7 @@ static int ad7192_setup(struct ad7192_state *st,
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available,
-			     in_voltage-voltage_scale_available,
+			     "in_voltage-voltage_scale_available",
 			     0444, ad7192_show_scale_available, NULL, 0);
 
 static IIO_DEVICE_ATTR(in_voltage_scale_available, 0444,
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index f85dde9..fd32e9a 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -750,14 +750,14 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
 }
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_low_value,
-		in_voltage-voltage_thresh_low_value,
+		"in_voltage-voltage_thresh_low_value",
 		0644,
 		ad7280_read_channel_config,
 		ad7280_write_channel_config,
 		AD7280A_CELL_UNDERVOLTAGE);
 
 static IIO_DEVICE_ATTR_NAMED(in_thresh_high_value,
-		in_voltage-voltage_thresh_high_value,
+		"in_voltage-voltage_thresh_high_value",
 		0644,
 		ad7280_read_channel_config,
 		ad7280_write_channel_config,
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index ce9426c..49c81a4 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -55,6 +55,10 @@ struct iio_const_attr {
 	{ .dev_attr = __ATTR(_name, _mode, _show, _store),	\
 	  .address = _addr }
 
+#define IIO_ATTR_NAMED(_name, _mode, _show, _store, _addr)		\
+	{ .dev_attr = __ATTR_NAMED(_name, _mode, _show, _store),	\
+	  .address = _addr }
+
 #define IIO_ATTR_RO(_name, _addr)       \
 	{ .dev_attr = __ATTR_RO(_name), \
 	  .address = _addr }
@@ -85,7 +89,7 @@ struct iio_const_attr {
 
 #define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \
 	struct iio_dev_attr iio_dev_attr_##_vname			\
-	= IIO_ATTR(_name, _mode, _show, _store, _addr)
+	= IIO_ATTR_NAMED(_name, _mode, _show, _store, _addr)
 
 #define IIO_CONST_ATTR(_name, _string)					\
 	struct iio_const_attr iio_const_attr_##_name			\
-- 
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 ` [PATCH v2 1/2] include: linux: sysfs: Add __ATTR_NAMED macro Himanshi Jain
2017-09-13  8:44   ` Himanshi Jain [this message]
2017-09-13 17:03   ` 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=30fdd58ce18399c77152ef13180ef2966cf36be0.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.