Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1563948 > unrolled thread
| Started by | Alison Schofield <amsfield22@gmail.com> |
|---|---|
| First post | 2017-01-20 23:20 +0100 |
| Last post | 2017-01-21 13:30 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] iio: proximity: sx9500: claim direct mode during raw proximity reads Alison Schofield <amsfield22@gmail.com> - 2017-01-20 23:20 +0100
Re: [PATCH] iio: proximity: sx9500: claim direct mode during raw proximity reads Vlad Dogaru <ddvlad@gmail.com> - 2017-01-21 09:50 +0100
Re: [PATCH] iio: proximity: sx9500: claim direct mode during raw proximity reads Jonathan Cameron <jic23@kernel.org> - 2017-01-21 13:30 +0100
| From | Alison Schofield <amsfield22@gmail.com> |
|---|---|
| Date | 2017-01-20 23:20 +0100 |
| Subject | [PATCH] iio: proximity: sx9500: claim direct mode during raw proximity reads |
| Message-ID | <t1PHj-4ym-7@gated-at.bofh.it> |
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>
---
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
[toc] | [next] | [standalone]
| From | Vlad Dogaru <ddvlad@gmail.com> |
|---|---|
| Date | 2017-01-21 09:50 +0100 |
| Message-ID | <t1ZwZ-1Ri-3@gated-at.bofh.it> |
| In reply to | #1563948 |
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>
> ---
> 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
>
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-01-21 13:30 +0100 |
| Message-ID | <t22XT-3WX-3@gated-at.bofh.it> |
| In reply to | #1564075 |
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
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web