From: Jonathan Cameron <jic23@kernel.org>
To: Phil Reid <preid@electromag.com.au>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/1] iio: inkern: add helper to enable a channel
Date: Sun, 8 Oct 2017 11:36:46 +0100 [thread overview]
Message-ID: <20171008113646.2243a76c@archlinux> (raw)
In-Reply-To: <1507171066-83517-1-git-send-email-preid@electromag.com.au>
On Thu, 5 Oct 2017 10:37:46 +0800
Phil Reid <preid@electromag.com.au> wrote:
> This is done by calling a generic write attribute helper similar
> to the existing read attribute helper. Update write raw helper
> to use new write attribute function.
>
> Signed-off-by: Phil Reid <preid@electromag.com.au>
> ---
> drivers/iio/inkern.c | 17 +++++++++++++++--
> include/linux/iio/consumer.h | 9 +++++++++
> 2 files changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index 069defc..51c5c967 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -850,7 +850,9 @@ static int iio_channel_write(struct iio_channel *chan, int val, int val2,
> chan->channel, val, val2, info);
> }
>
> -int iio_write_channel_raw(struct iio_channel *chan, int val)
> +static int iio_write_channel_attribute(struct iio_channel *chan,
> + int val, int val2,
> + enum iio_chan_info_enum attribute)
> {
> int ret;
>
> @@ -860,14 +862,25 @@ int iio_write_channel_raw(struct iio_channel *chan, int val)
> goto err_unlock;
> }
>
> - ret = iio_channel_write(chan, val, 0, IIO_CHAN_INFO_RAW);
> + ret = iio_channel_write(chan, val, val2, attribute);
> err_unlock:
> mutex_unlock(&chan->indio_dev->info_exist_lock);
>
> return ret;
> }
> +
> +int iio_write_channel_raw(struct iio_channel *chan, int val)
> +{
> + return iio_write_channel_attribute(chan, val, 0, IIO_CHAN_INFO_RAW);
> +}
> EXPORT_SYMBOL_GPL(iio_write_channel_raw);
>
> +int iio_write_channel_enable(struct iio_channel *chan, int val)
> +{
> + return iio_write_channel_attribute(chan, val, 0, IIO_CHAN_INFO_ENABLE);
> +}
> +EXPORT_SYMBOL_GPL(iio_write_channel_enable);
> +
> unsigned int iio_get_channel_ext_info_count(struct iio_channel *chan)
> {
> const struct iio_chan_spec_ext_info *ext_info;
> diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
> index 5e347a9..4a5a90d 100644
> --- a/include/linux/iio/consumer.h
> +++ b/include/linux/iio/consumer.h
> @@ -226,6 +226,15 @@ int iio_read_channel_raw(struct iio_channel *chan,
> int iio_write_channel_raw(struct iio_channel *chan, int val);
>
> /**
> + * iio_write_channel_enable() - enable a given channel
> + * @chan: The channel being queried.
> + * @val: Value being written.
> + *
> + * Enable / disable the channel.
> + */
> +int iio_write_channel_enable(struct iio_channel *chan, int val);
> +
> +/**
> * iio_read_max_channel_raw() - read maximum available raw value from a given
> * channel, i.e. the maximum possible value.
> * @chan: The channel being queried.
next prev parent reply other threads:[~2017-10-08 14:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-05 2:37 [PATCH 1/1] iio: inkern: add helper to enable a channel Phil Reid
2017-10-08 10:36 ` Jonathan Cameron [this message]
2017-10-08 10:41 ` Jonathan Cameron
2017-10-16 1:50 ` Phil Reid
2017-10-21 16:39 ` Jonathan Cameron
2017-10-25 3:43 ` Phil Reid
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=20171008113646.2243a76c@archlinux \
--to=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=preid@electromag.com.au \
/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).