From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
jic23@kernel.org, lars@metafoo.de
Subject: Re: [PATCH v2 5/5] iio: adc: ad7793: use read_avail iio hook for scale available
Date: Sat, 21 Mar 2020 21:37:26 +0200 [thread overview]
Message-ID: <20200321193726.GA2813151@smile.fi.intel.com> (raw)
In-Reply-To: <20200321090802.11537-5-alexandru.ardelean@analog.com>
On Sat, Mar 21, 2020 at 11:08:02AM +0200, Alexandru Ardelean wrote:
> This change uses the read_avail and '.info_mask_shared_by_type_available'
> modifier to set the available scale.
> Essentially, nothing changes to the driver's ABI.
>
> The main idea for this patch is to remove the AD7793 driver from
> checkpatch's radar. There have been about ~3 attempts to fix/break the
> 'in_voltage-voltage_scale_available' attribute, because checkpatch assumed
> it to be an arithmetic operation and people were trying to change that.
> +static int ad7793_read_avail(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan,
> + const int **vals, int *type, int *length,
> + long mask)
> {
> struct ad7793_state *st = iio_priv(indio_dev);
>
> + switch (mask) {
> + case IIO_CHAN_INFO_SCALE:
> + *vals = (int *)st->scale_avail;
> + *type = IIO_VAL_INT_PLUS_NANO;
> + /* Values are stored in a 2D matrix */
> + *length = ARRAY_SIZE(st->scale_avail) * 2;
>
> + return IIO_AVAIL_LIST;
> + }
>
> + return -EINVAL;
Wouldn't be better move this under default case?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-03-21 19:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-21 9:07 [PATCH v2 1/5] iio: adc: ad7780: define/use own IIO channel macros Alexandru Ardelean
2020-03-21 9:07 ` [PATCH v2 2/5] iio: adc: ad7791: " Alexandru Ardelean
2020-03-21 16:51 ` Jonathan Cameron
2020-03-21 9:08 ` [PATCH v2 3/5] iio: adc: ad7793: " Alexandru Ardelean
2020-03-21 16:52 ` Jonathan Cameron
2020-03-21 9:08 ` [PATCH v2 4/5] iio: ad_sigma_delta: remove unused " Alexandru Ardelean
2020-03-21 16:53 ` Jonathan Cameron
2020-03-21 9:08 ` [PATCH v2 5/5] iio: adc: ad7793: use read_avail iio hook for scale available Alexandru Ardelean
2020-03-21 16:57 ` Jonathan Cameron
2020-03-22 9:38 ` Ardelean, Alexandru
2020-03-21 19:37 ` Andy Shevchenko [this message]
2020-03-22 9:18 ` Ardelean, Alexandru
2020-03-22 15:15 ` Jonathan Cameron
2020-03-21 16:50 ` [PATCH v2 1/5] iio: adc: ad7780: define/use own IIO channel macros Jonathan Cameron
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=20200321193726.GA2813151@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=alexandru.ardelean@analog.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).