From: Jonathan Cameron <jic23@kernel.org>
To: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
Cc: "andrea.merello@gmail.com" <andrea.merello@gmail.com>,
"Hennerich, Michael" <Michael.Hennerich@analog.com>,
"lars@metafoo.de" <lars@metafoo.de>,
"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
"knaack.h@gmx.de" <knaack.h@gmx.de>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 1/4] iio: ad7949: kill pointless "readback"-handling code
Date: Sun, 15 Sep 2019 11:26:17 +0100 [thread overview]
Message-ID: <20190915112617.7121665f@archlinux> (raw)
In-Reply-To: <e592cdc194cfa0ac0eb1a9539d890a1e5f70feb1.camel@analog.com>
On Fri, 13 Sep 2019 06:37:17 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> On Thu, 2019-09-12 at 16:43 +0200, Andrea Merello wrote:
> > [External]
> >
> > The device could be configured to spit out also the configuration word
> > while reading the AD result value (in the same SPI xfer) - this is called
> > "readback" in the device datasheet.
> >
> > The driver checks if readback is enabled and it eventually adjusts the SPI
> > xfer length and it applies proper shifts to still get the data, discarding
> > the configuration word.
> >
> > The readback option is actually never enabled (the driver disables it), so
> > the said checks do not serve for any purpose.
> >
> > Since enabling the readback option seems not to provide any advantage (the
> > driver entirely sets the configuration word without relying on any default
> > value), just kill the said, unused, code.
>
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to poke at it.
Thanks,
Jonathan
>
> >
> > Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
> > ---
> > drivers/iio/adc/ad7949.c | 27 +++------------------------
> > 1 file changed, 3 insertions(+), 24 deletions(-)
> >
> > diff --git a/drivers/iio/adc/ad7949.c b/drivers/iio/adc/ad7949.c
> > index ac0ffff6c5ae..518044c31a73 100644
> > --- a/drivers/iio/adc/ad7949.c
> > +++ b/drivers/iio/adc/ad7949.c
> > @@ -57,29 +57,11 @@ struct ad7949_adc_chip {
> > u32 buffer ____cacheline_aligned;
> > };
> >
> > -static bool ad7949_spi_cfg_is_read_back(struct ad7949_adc_chip *ad7949_adc)
> > -{
> > - if (!(ad7949_adc->cfg & AD7949_CFG_READ_BACK))
> > - return true;
> > -
> > - return false;
> > -}
> > -
> > -static int ad7949_spi_bits_per_word(struct ad7949_adc_chip *ad7949_adc)
> > -{
> > - int ret = ad7949_adc->resolution;
> > -
> > - if (ad7949_spi_cfg_is_read_back(ad7949_adc))
> > - ret += AD7949_CFG_REG_SIZE_BITS;
> > -
> > - return ret;
> > -}
> > -
> > static int ad7949_spi_write_cfg(struct ad7949_adc_chip *ad7949_adc, u16 val,
> > u16 mask)
> > {
> > int ret;
> > - int bits_per_word = ad7949_spi_bits_per_word(ad7949_adc);
> > + int bits_per_word = ad7949_adc->resolution;
> > int shift = bits_per_word - AD7949_CFG_REG_SIZE_BITS;
> > struct spi_message msg;
> > struct spi_transfer tx[] = {
> > @@ -107,7 +89,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
> > unsigned int channel)
> > {
> > int ret;
> > - int bits_per_word = ad7949_spi_bits_per_word(ad7949_adc);
> > + int bits_per_word = ad7949_adc->resolution;
> > int mask = GENMASK(ad7949_adc->resolution, 0);
> > struct spi_message msg;
> > struct spi_transfer tx[] = {
> > @@ -138,10 +120,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
> >
> > ad7949_adc->current_channel = channel;
> >
> > - if (ad7949_spi_cfg_is_read_back(ad7949_adc))
> > - *val = (ad7949_adc->buffer >> AD7949_CFG_REG_SIZE_BITS) & mask;
> > - else
> > - *val = ad7949_adc->buffer & mask;
> > + *val = ad7949_adc->buffer & mask;
> >
> > return 0;
> > }
next prev parent reply other threads:[~2019-09-15 10:26 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 14:43 [PATCH 0/4] Fixes for ad7949 Andrea Merello
2019-09-12 14:43 ` [PATCH 1/4] iio: ad7949: kill pointless "readback"-handling code Andrea Merello
2019-09-13 6:37 ` Ardelean, Alexandru
2019-09-15 10:26 ` Jonathan Cameron [this message]
2019-09-12 14:43 ` [PATCH 2/4] iio: ad7949: fix incorrect SPI xfer len Andrea Merello
2019-09-13 6:46 ` Ardelean, Alexandru
2019-09-13 7:56 ` Andrea Merello
2019-09-13 8:28 ` Ardelean, Alexandru
2019-09-15 10:36 ` Jonathan Cameron
2019-09-16 7:51 ` Ardelean, Alexandru
2019-09-21 17:16 ` Jonathan Cameron
2019-09-12 14:43 ` [PATCH 3/4] iio: ad7949: fix SPI xfer delays Andrea Merello
2019-09-13 6:59 ` Ardelean, Alexandru
2019-09-13 8:23 ` Andrea Merello
2019-09-13 8:43 ` Ardelean, Alexandru
2019-09-12 14:43 ` [PATCH 4/4] iio: ad7949: fix channels mixups Andrea Merello
2019-09-13 7:19 ` Ardelean, Alexandru
2019-09-13 8:30 ` Andrea Merello
2019-09-13 11:30 ` Couret Charles-Antoine
2019-09-13 11:40 ` Andrea Merello
2019-09-20 7:45 ` Andrea Merello
2019-09-21 17:12 ` Jonathan Cameron
2019-09-23 8:21 ` Andrea Merello
2019-10-05 9:55 ` Jonathan Cameron
[not found] ` <CAN8YU5PRO5Y5EeEj2SZGm5XfuKSB1rtS7nKdu6wWxXYDOfexqw@mail.gmail.com>
2019-10-22 8:56 ` Jonathan Cameron
2019-11-04 14:12 ` Andrea Merello
2019-11-09 11:58 ` Jonathan Cameron
2019-11-12 15:09 ` Couret Charles-Antoine
2019-12-02 14:13 ` [v2] " Andrea Merello
2019-12-02 15:36 ` Couret Charles-Antoine
2019-12-04 11:06 ` Jonathan Cameron
2019-12-04 11:13 ` Couret Charles-Antoine
2019-12-06 16:45 ` Jonathan Cameron
2019-09-13 7:24 ` [PATCH 0/4] Fixes for ad7949 Ardelean, Alexandru
2019-09-13 14:00 ` Couret Charles-Antoine
2019-09-15 10:49 ` Jonathan Cameron
2019-09-16 7:39 ` Andrea Merello
2019-09-16 7:48 ` Ardelean, Alexandru
2019-09-16 7:50 ` Ardelean, Alexandru
2019-09-16 7:34 ` Andrea Merello
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=20190915112617.7121665f@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=alexandru.Ardelean@analog.com \
--cc=andrea.merello@gmail.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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