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 01/10] staging:iio: add a value element to the info_mask
Date: Tue, 10 Apr 2012 21:27:34 +0100 [thread overview]
Message-ID: <1334089663-22900-2-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <1334089663-22900-1-git-send-email-jic23@kernel.org>
This will allow us to have drivers where the channel value
may not be read or written but other information is available.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
---
drivers/staging/iio/iio.h | 4 +++-
drivers/staging/iio/industrialio-core.c | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index fa6fca0..d96ee4b 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -26,7 +26,7 @@ enum iio_data_type {
/* Could add the raw attributes as well - allowing buffer only devices */
enum iio_chan_info_enum {
- /* 0 is reserved for raw attributes */
+ IIO_CHAN_INFO_VALUE = 0,
IIO_CHAN_INFO_SCALE = 1,
IIO_CHAN_INFO_OFFSET,
IIO_CHAN_INFO_CALIBSCALE,
@@ -41,6 +41,8 @@ enum iio_chan_info_enum {
#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
+#define IIO_CHAN_INFO_VALUE_SEPARATE_BIT \
+ IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_VALUE)
#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \
IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
#define IIO_CHAN_INFO_SCALE_SHARED_BIT \
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index d303bfb..a4ac061 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -575,7 +575,8 @@ error_ret:
static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan)
{
- int ret, i, attrcount = 0;
+ int ret, attrcount = 0;
+ int i = 2;
const struct iio_chan_spec_ext_info *ext_info;
if (chan->channel < 0)
@@ -594,7 +595,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev,
goto error_ret;
attrcount++;
- for_each_set_bit(i, &chan->info_mask, sizeof(long)*8) {
+ for_each_set_bit_from(i, &chan->info_mask, sizeof(long)*8) {
ret = __iio_add_chan_devattr(iio_chan_info_postfix[i/2],
chan,
&iio_read_channel_info,
--
1.7.9.4
next 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 ` Jonathan Cameron [this message]
2012-04-11 8:36 ` [PATCH 01/10] staging:iio: add a value element to the info_mask 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 ` [PATCH 10/10] staging:iio: Make read / write attributes for channel values optional 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=1334089663-22900-2-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).