* [PATCH] iio:core: Handle error when mask type is not separate
@ 2014-07-08 21:03 Srinivas Pandruvada
2014-07-11 20:19 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Pandruvada @ 2014-07-08 21:03 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Srinivas Pandruvada
When event spec is shared by multiple channels, which has definition
for mask_shared_by_type, iio_device_register_eventset fails.
For example:
static const struct iio_event_spec iio_dummy_events[] = {
{
.type = IIO_EV_TYPE_THRESH,
.dir = IIO_EV_DIR_RISING,
.mask_separate = BIT(IIO_EV_INFO_ENABLE),
.mask_shared_by_type = BIT(IIO_EV_INFO_VALUE),
}, {
.type = IIO_EV_TYPE_THRESH,
.dir = IIO_EV_DIR_FALLING,
.mask_separate = BIT(IIO_EV_INFO_ENABLE),a
.mask_shared_by_type = BIT(IIO_EV_INFO_VALUE),
}
};
If two channels use this event spec, this will result in error.
This change handles EBUSY error similar to iio_device_add_info_mask_type().
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/iio/industrialio-event.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
index 258a973..bfbf4d4 100644
--- a/drivers/iio/industrialio-event.c
+++ b/drivers/iio/industrialio-event.c
@@ -345,6 +345,9 @@ static int iio_device_add_event(struct iio_dev *indio_dev,
&indio_dev->event_interface->dev_attr_list);
kfree(postfix);
+ if ((ret == -EBUSY) && (shared_by != IIO_SEPARATE))
+ continue;
+
if (ret)
return ret;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio:core: Handle error when mask type is not separate
2014-07-08 21:03 [PATCH] iio:core: Handle error when mask type is not separate Srinivas Pandruvada
@ 2014-07-11 20:19 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2014-07-11 20:19 UTC (permalink / raw)
To: Srinivas Pandruvada; +Cc: linux-iio
On 08/07/14 22:03, Srinivas Pandruvada wrote:
> When event spec is shared by multiple channels, which has definition
> for mask_shared_by_type, iio_device_register_eventset fails.
>
> For example:
> static const struct iio_event_spec iio_dummy_events[] = {
> {
> .type = IIO_EV_TYPE_THRESH,
> .dir = IIO_EV_DIR_RISING,
> .mask_separate = BIT(IIO_EV_INFO_ENABLE),
> .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE),
> }, {
> .type = IIO_EV_TYPE_THRESH,
> .dir = IIO_EV_DIR_FALLING,
> .mask_separate = BIT(IIO_EV_INFO_ENABLE),a
> .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE),
> }
> };
>
> If two channels use this event spec, this will result in error.
>
> This change handles EBUSY error similar to iio_device_add_info_mask_type().
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Good spot. Applied to the fixes-togreg branch of iio.git and marked
for stable. Grep suggests there is only one user in the tree (lis3l02dq)
but still worth getting the fix out there for that one.
J
> ---
> drivers/iio/industrialio-event.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c
> index 258a973..bfbf4d4 100644
> --- a/drivers/iio/industrialio-event.c
> +++ b/drivers/iio/industrialio-event.c
> @@ -345,6 +345,9 @@ static int iio_device_add_event(struct iio_dev *indio_dev,
> &indio_dev->event_interface->dev_attr_list);
> kfree(postfix);
>
> + if ((ret == -EBUSY) && (shared_by != IIO_SEPARATE))
> + continue;
> +
> if (ret)
> return ret;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-11 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 21:03 [PATCH] iio:core: Handle error when mask type is not separate Srinivas Pandruvada
2014-07-11 20:19 ` Jonathan Cameron
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).