All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: gregkh@linuxfoundation.org
Cc: linux-iio@vger.kernel.org,
	device-drivers-devel@blackfin.uclinux.org,
	Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 01/16] staging:iio: add a raw and processed elements to info_mask
Date: Sun, 15 Apr 2012 17:41:16 +0100	[thread overview]
Message-ID: <1334508091-24027-2-git-send-email-jic23@kernel.org> (raw)
In-Reply-To: <1334508091-24027-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.
Also adds the ability to have both processed and raw access
to a given channel, though in most cases this doesn't make
sense.

Ultimately will lead to simpler code by allowing us to drop
the special case handling for the value reading cases.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/iio.h               |    9 +++++++--
 drivers/staging/iio/industrialio-core.c |    5 +++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/iio.h b/drivers/staging/iio/iio.h
index b07ddd3..dda1602 100644
--- a/drivers/staging/iio/iio.h
+++ b/drivers/staging/iio/iio.h
@@ -26,8 +26,9 @@ 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_SCALE = 1,
+	IIO_CHAN_INFO_RAW = 0,
+	IIO_CHAN_INFO_PROCESSED,
+	IIO_CHAN_INFO_SCALE,
 	IIO_CHAN_INFO_OFFSET,
 	IIO_CHAN_INFO_CALIBSCALE,
 	IIO_CHAN_INFO_CALIBBIAS,
@@ -42,6 +43,10 @@ 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_RAW_SEPARATE_BIT			\
+	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
+#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT			\
+	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
 #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 9e42713..817e3fa 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -576,7 +576,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 = 4;
 	const struct iio_chan_spec_ext_info *ext_info;
 
 	if (chan->channel < 0)
@@ -595,7 +596,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


  reply	other threads:[~2012-04-15 16:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-15 16:41 [PATCH 00/16 V3] IIO: Make the value attribute optional for channels Jonathan Cameron
2012-04-15 16:41 ` Jonathan Cameron [this message]
2012-04-15 16:41 ` [PATCH 02/16] staging:iio:accel Add IIO_CHAN_INFO_RAW entries to all drivers Jonathan Cameron
2012-04-15 16:41 ` [PATCH 03/16] staging:iio:adc " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 05/16] staging:iio:gyro " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 06/16] staging:iio:imu " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 07/16] staging:iio:light Add IIO_CHAN_INFO_RAW/PROCESSED " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 08/16] staging:iio:magnetometer Add IIO_CHAN_INFO_RAW " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 09/16] staging:iio:resolver " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 10/16] staging:iio:impedance Add IIO_CHAN_INFO_RAW/PROCESSED " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 11/16] staging:iio:cdc " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 13/16] staging:iio:meter Add IIO_CHAN_INFO_RAW " Jonathan Cameron
2012-04-15 16:41 ` [PATCH 14/16] staging:iio:isl29028 Add IIO_CHAN_INFO_RAW/PROCESSED entries Jonathan Cameron
2012-04-15 16:41 ` [PATCH 15/16] staging:iio: Make read / write attributes for channel values optional Jonathan Cameron
2012-04-15 16:41 ` [PATCH 16/16] staging:iio: drop procesed_val element of chan_spec 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=1334508091-24027-2-git-send-email-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-iio@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 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.