linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio:core: Handle error when mask type is not separate
Date: Fri, 11 Jul 2014 21:19:36 +0100	[thread overview]
Message-ID: <53C046D8.5070500@kernel.org> (raw)
In-Reply-To: <1404853414-9263-1-git-send-email-srinivas.pandruvada@linux.intel.com>

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;
>
>


      reply	other threads:[~2014-07-11 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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=53C046D8.5070500@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.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).