From: Jonathan Cameron <jic23@kernel.org>
To: Peter Meerwald <pmeerw@pmeerw.net>,
Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: pali.rohar@gmail.com, pavel@ucw.cz, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org,
Ivaylo Dimitrov <freemangordon@abv.bg>
Subject: Re: [PATCH] iio: tsl2563: Use the correct channel2 member
Date: Sat, 18 Jan 2014 11:37:45 +0000 [thread overview]
Message-ID: <52DA6789.4000500@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.01.1401132222150.3351@pmeerw.net>
On 13/01/14 21:25, Peter Meerwald wrote:
>
>> Use the correct channel2 member instead of channel when dealing with sysfs
>> reads/writes
>
>> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
>
> as a bonus, m is renamed to mask
Which would have been relevant back when it was a mask. Still it doesn't
make things worse, so never mind ;) One day someone might be bored enough
to clean up all the places in read_raw etc where the variable is called mask
but is infact a straight number.
>
> Acked-by: Peter Meerwald <pmeerw@pmeerw.net>
Applied to the fixes-togreg branch of iio.git - initially pushed out as testing
for the autobuilders to thoroughly hammer.
>
>> ---
>> drivers/iio/light/tsl2563.c | 16 ++++++++++------
>> 1 files changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
>> index 5e5d9de..2be6df3 100644
>> --- a/drivers/iio/light/tsl2563.c
>> +++ b/drivers/iio/light/tsl2563.c
>> @@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
>> {
>> struct tsl2563_chip *chip = iio_priv(indio_dev);
>>
>> - if (chan->channel == IIO_MOD_LIGHT_BOTH)
>> + if (mask != IIO_CHAN_INFO_CALIBSCALE)
>> + return -EINVAL;
>> + if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
>> chip->calib0 = calib_from_sysfs(val);
>> - else
>> + else if (chan->channel2 == IIO_MOD_LIGHT_IR)
>> chip->calib1 = calib_from_sysfs(val);
>> + else
>> + return -EINVAL;
>>
>> return 0;
>> }
>> @@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
>> struct iio_chan_spec const *chan,
>> int *val,
>> int *val2,
>> - long m)
>> + long mask)
>> {
>> int ret = -EINVAL;
>> u32 calib0, calib1;
>> struct tsl2563_chip *chip = iio_priv(indio_dev);
>>
>> mutex_lock(&chip->lock);
>> - switch (m) {
>> + switch (mask) {
>> case IIO_CHAN_INFO_RAW:
>> case IIO_CHAN_INFO_PROCESSED:
>> switch (chan->type) {
>> @@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
>> ret = tsl2563_get_adc(chip);
>> if (ret)
>> goto error_ret;
>> - if (chan->channel == 0)
>> + if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
>> *val = chip->data0;
>> else
>> *val = chip->data1;
>> @@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
>> break;
>>
>> case IIO_CHAN_INFO_CALIBSCALE:
>> - if (chan->channel == 0)
>> + if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
>> *val = calib_to_sysfs(chip->calib0);
>> else
>> *val = calib_to_sysfs(chip->calib1);
>>
>
next prev parent reply other threads:[~2014-01-18 11:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-12 19:54 [PATCH] iio: tsl2563: Initialize channels Ivaylo Dimitrov
2014-01-12 20:55 ` Peter Meerwald
2014-01-12 21:08 ` Ivaylo Dimitrov
2014-01-12 21:41 ` Jonathan Cameron
2014-01-13 17:24 ` [PATCH] iio: tsl2563: Use the correct channel2 member Ivaylo Dimitrov
2014-01-13 21:25 ` Peter Meerwald
2014-01-18 11:37 ` Jonathan Cameron [this message]
2014-01-18 11:38 ` 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=52DA6789.4000500@kernel.org \
--to=jic23@kernel.org \
--cc=freemangordon@abv.bg \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=pavel@ucw.cz \
--cc=pmeerw@pmeerw.net \
/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.