From: Boyan Vladinov <nayobix@nayobix.org>
To: gregkh@linuxfoundation.org, lars@metafoo.de,
Michael.Hennerich@analog.com
Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org,
Boyan Vladinov <nayobix@nayobix.org>
Subject: [PATCH v3] Staging: iio: adc: fix sysfs files modes in ad7192.c
Date: Sat, 26 Nov 2016 14:39:24 -0800 [thread overview]
Message-ID: <1480199964-9554-1-git-send-email-nayobix@nayobix.org> (raw)
Fixes warnings found by checkpatch.pl:
- sysfs entries user/group modes to use their octal representation
- use the IIO_DEVICE_ATTR_[RO|RW] macroses
- coding style
Signed-off-by: Boyan Vladinov <nayobix@nayobix.org>
---
drivers/staging/iio/adc/ad7192.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 1fb68c01abd5..29b8a291fb6a 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -340,15 +340,21 @@ ad7192_show_scale_available(struct device *dev,
return len;
}
+static ssize_t
+in_voltage_scale_available_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return ad7192_show_scale_available(dev, attr, buf);
+}
+
static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available,
in_voltage-voltage_scale_available,
- S_IRUGO, ad7192_show_scale_available, NULL, 0);
+ 0444, ad7192_show_scale_available, NULL, 0);
-static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
- ad7192_show_scale_available, NULL, 0);
+static IIO_DEVICE_ATTR_RO(in_voltage_scale_available, 0);
-static ssize_t ad7192_show_ac_excitation(struct device *dev,
- struct device_attribute *attr,
+static ssize_t ac_excitation_en_show(struct device *dev,
+ struct device_attribute *attr,
char *buf)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
@@ -357,8 +363,8 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev,
return sprintf(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX));
}
-static ssize_t ad7192_show_bridge_switch(struct device *dev,
- struct device_attribute *attr,
+static ssize_t bridge_switch_en_show(struct device *dev,
+ struct device_attribute *attr,
char *buf)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
@@ -367,8 +373,8 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev,
return sprintf(buf, "%d\n", !!(st->gpocon & AD7192_GPOCON_BPDSW));
}
-static ssize_t ad7192_set(struct device *dev,
- struct device_attribute *attr,
+static ssize_t bridge_switch_en_store(struct device *dev,
+ struct device_attribute *attr,
const char *buf,
size_t len)
{
@@ -412,13 +418,16 @@ static ssize_t ad7192_set(struct device *dev,
return ret ? ret : len;
}
-static IIO_DEVICE_ATTR(bridge_switch_en, S_IRUGO | S_IWUSR,
- ad7192_show_bridge_switch, ad7192_set,
- AD7192_REG_GPOCON);
+static ssize_t ac_excitation_en_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t len)
+{
+ return bridge_switch_en_store(dev, attr, buf, len);
+}
+
+static IIO_DEVICE_ATTR_RW(bridge_switch_en, AD7192_REG_GPOCON);
-static IIO_DEVICE_ATTR(ac_excitation_en, S_IRUGO | S_IWUSR,
- ad7192_show_ac_excitation, ad7192_set,
- AD7192_REG_MODE);
+static IIO_DEVICE_ATTR_RW(ac_excitation_en, AD7192_REG_MODE);
static struct attribute *ad7192_attributes[] = {
&iio_dev_attr_in_v_m_v_scale_available.dev_attr.attr,
--
2.7.4
next reply other threads:[~2016-11-26 23:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-26 22:39 Boyan Vladinov [this message]
2016-11-27 10:09 ` 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=1480199964-9554-1-git-send-email-nayobix@nayobix.org \
--to=nayobix@nayobix.org \
--cc=Michael.Hennerich@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®