mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Vlad Dogaru <ddvlad@gmail.com>, Alison Schofield <amsfield22@gmail.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	lars@metafoo.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: proximity: sx9500: claim direct mode during raw proximity reads
Date: Sat, 21 Jan 2017 12:22:39 +0000	[thread overview]
Message-ID: <aa2b2d4d-c531-7463-f1d5-1128918f4eeb@kernel.org> (raw)
In-Reply-To: <CAA+rx9TfvFH2JaCcD6OCjB3f1iUWrMgTZCwuOBUUuVP8HUitgA@mail.gmail.com>

On 21/01/17 08:49, Vlad Dogaru wrote:
> On Fri, Jan 20, 2017 at 11:11 PM, Alison Schofield <amsfield22@gmail.com> wrote:
>> Driver was checking for direct mode but not locking it.  Use the
>> claim/release helper functions to guarantee the device stays in
>> direct mode during raw reads of proximity data.
>>
>> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> 
> Reviewed-by: Vlad Dogaru <ddvlad@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Thanks,

Jonathan
> 
>> ---
>>  drivers/iio/proximity/sx9500.c | 10 +++++++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
>> index 1f06282..9ea147f 100644
>> --- a/drivers/iio/proximity/sx9500.c
>> +++ b/drivers/iio/proximity/sx9500.c
>> @@ -387,14 +387,18 @@ static int sx9500_read_raw(struct iio_dev *indio_dev,
>>                            int *val, int *val2, long mask)
>>  {
>>         struct sx9500_data *data = iio_priv(indio_dev);
>> +       int ret;
>>
>>         switch (chan->type) {
>>         case IIO_PROXIMITY:
>>                 switch (mask) {
>>                 case IIO_CHAN_INFO_RAW:
>> -                       if (iio_buffer_enabled(indio_dev))
>> -                               return -EBUSY;
>> -                       return sx9500_read_proximity(data, chan, val);
>> +                       ret = iio_device_claim_direct_mode(indio_dev);
>> +                       if (ret)
>> +                               return ret;
>> +                       ret = sx9500_read_proximity(data, chan, val);
>> +                       iio_device_release_direct_mode(indio_dev);
>> +                       return ret;
>>                 case IIO_CHAN_INFO_SAMP_FREQ:
>>                         return sx9500_read_samp_freq(data, val, val2);
>>                 default:
>> --
>> 2.1.4
>>
> --
> 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
> 

      reply	other threads:[~2017-01-21 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 22:11 Alison Schofield
2017-01-21  8:49 ` Vlad Dogaru
2017-01-21 12:22   ` 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=aa2b2d4d-c531-7463-f1d5-1128918f4eeb@kernel.org \
    --to=jic23@kernel.org \
    --cc=amsfield22@gmail.com \
    --cc=ddvlad@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®