From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: device-drivers-devel@blackfin.uclinux.org,
michael.hennerich@analog.com, Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 10/10] staging:iio: Make read / write attributes for channel values optional.
Date: Tue, 10 Apr 2012 21:27:43 +0100 [thread overview]
Message-ID: <1334089663-22900-11-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <1334089663-22900-1-git-send-email-jic23@kernel.org>
Until now all channels have had read/write attributes. This patch
allows for channels where we can't actually read the value (or for
output devices, write it!)
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
drivers/staging/iio/industrialio-core.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index a4ac061..2b51178 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -581,20 +581,21 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
if (chan->channel < 0)
return 0;
-
- ret = __iio_add_chan_devattr(iio_data_type_name[chan->processed_val],
- chan,
- &iio_read_channel_info,
- (chan->output ?
- &iio_write_channel_info : NULL),
- 0,
- 0,
- &indio_dev->dev,
- &indio_dev->channel_attr_list);
- if (ret)
- goto error_ret;
- attrcount++;
-
+ if (chan->info_mask & IIO_CHAN_INFO_VALUE_SEPARATE_BIT) {
+ ret = __iio_add_chan_devattr(iio_data_type_name[chan->
+ processed_val],
+ chan,
+ &iio_read_channel_info,
+ (chan->output ?
+ &iio_write_channel_info : NULL),
+ 0,
+ 0,
+ &indio_dev->dev,
+ &indio_dev->channel_attr_list);
+ if (ret)
+ goto error_ret;
+ attrcount++;
+ }
for_each_set_bit_from(i, &chan->info_mask, sizeof(long)*8) {
ret = __iio_add_chan_devattr(iio_chan_info_postfix[i/2],
chan,
--
1.7.9.4
prev parent reply other threads:[~2012-04-10 20:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-10 20:27 [PATCH 00/10] IIO: Make the value attribute optional for channels Jonathan Cameron
2012-04-10 20:27 ` [PATCH 01/10] staging:iio: add a value element to the info_mask Jonathan Cameron
2012-04-11 8:36 ` Lars-Peter Clausen
2012-04-11 9:02 ` Jonathan Cameron
2012-04-10 20:27 ` [PATCH 02/10] staging:iio:accelerometer Add IIO_CHAN_INFO_VALUE entries to all drivers Jonathan Cameron
2012-04-10 20:27 ` [PATCH 03/10] staging:iio:adc " Jonathan Cameron
2012-04-10 20:27 ` [PATCH 04/10] staging:iio:dac " Jonathan Cameron
2012-04-10 20:27 ` [PATCH 05/10] staging:iio:gyro " Jonathan Cameron
2012-04-10 20:27 ` [PATCH 06/10] staging:iio:imu " Jonathan Cameron
2012-04-10 20:27 ` [PATCH 07/10] staging:iio:light " Jonathan Cameron
2012-04-10 20:27 ` [PATCH 08/10] staging:iio:magnetometer " Jonathan Cameron
2012-04-10 20:27 ` Jonathan Cameron [this message]
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=1334089663-22900-11-git-send-email-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=linux-iio@vger.kernel.org \
--cc=michael.hennerich@analog.com \
/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;
as well as URLs for NNTP newsgroup(s).