From: Jonathan Cameron <jic23@cam.ac.uk>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org,
michael.hennerich@analog.com
Subject: Re: [PATCH 01/10] staging:iio: add a value element to the info_mask
Date: Wed, 11 Apr 2012 10:02:48 +0100 [thread overview]
Message-ID: <4F8548B8.8000709@cam.ac.uk> (raw)
In-Reply-To: <4F854295.4030009@metafoo.de>
On 4/11/2012 9:36 AM, Lars-Peter Clausen wrote:
> On 04/10/2012 10:27 PM, Jonathan Cameron wrote:
>> 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,
> I think it would make sense to introduce both IIO_CHAN_INFO_RAW and
> IIO_CHAN_INFO_PROCESSED. This will certainly make the code more simpler and
> it also allows drivers to export both processed and raw values.
Good point. I thought abouting using the two bits for the single entry
for this, but you
are right, simply having a separate entry would be cleaner and only
waste a couple
of bits of the mask... which we were wasting before anyway and allows us
to drop the
separate flags for it. I'll rework the set with that... your naming
suggestion works as well.
>
>> 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,
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-04-11 9:02 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 [this message]
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=4F8548B8.8000709@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--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).