From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "lars@metafoo.de" <lars@metafoo.de>,
"knaack.h@gmx.de" <knaack.h@gmx.de>,
"jic23@kernel.org" <jic23@kernel.org>,
"Hennerich, Michael" <Michael.Hennerich@analog.com>,
"renatogeh@gmail.com" <renatogeh@gmail.com>,
"giuliano.belinassi@gmail.com" <giuliano.belinassi@gmail.com>,
"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"kernel-usp@googlegroups.com" <kernel-usp@googlegroups.com>
Subject: Re: [PATCH 3/3] staging: iio: ad7780: generates pattern_mask from PAT bits
Date: Thu, 8 Nov 2018 07:45:25 +0000 [thread overview]
Message-ID: <75e7843ec80a3adc9f4b7ea0a7f0b33c3d518093.camel@analog.com> (raw)
In-Reply-To: <f7925df556f37f48ae0b1707239aff5a108fea1d.1541615978.git.giuliano.belinassi@usp.br>
On Wed, 2018-11-07 at 16:50 -0200, Giuliano Belinassi wrote:
> Previously, all pattern_masks in the chip_info table were hardcoded. Now
> they
> are generated using the PAT macros, as described in the datasheets.
>
I like this change :)
I only have nitpicks.
See inline.
> Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
> ---
> drivers/staging/iio/adc/ad7780.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7780.c
> b/drivers/staging/iio/adc/ad7780.c
> index 0a473aae52f2..fa9e047b5191 100644
> --- a/drivers/staging/iio/adc/ad7780.c
> +++ b/drivers/staging/iio/adc/ad7780.c
> @@ -31,6 +31,8 @@
> #define AD7780_PAT1 BIT(1)
> #define AD7780_PAT0 BIT(0)
>
> +#define AD7170_PAT2 BIT(2)
> +
> struct ad7780_chip_info {
> struct iio_chan_spec channel;
> unsigned int pattern_mask;
> @@ -137,25 +139,25 @@ static const struct ad7780_chip_info
> ad7780_chip_info_tbl[] = {
> [ID_AD7170] = {
> .channel = AD7780_CHANNEL(12, 24),
> .pattern = 0x5,
> - .pattern_mask = 0x7,
> + .pattern_mask = AD7780_PAT0 | AD7780_PAT1 | AD7170_PAT2,
If you are updating these pattern masks, you should update the default
patterns as well with the macros to be consistent.
And to be a bit more compact, you could define:
#define AD7170_PATTERN_MASK (AD7780_PAT0 | AD7780_PAT1 | AD7170_PAT2)
#d
efine AD7780_PATTERN_MASK (AD7780_PAT0 | AD7780_PAT1)
#define AD7170_PATTERN (AD7780_PAT1 | AD7170_PAT2)
#define AD7780_PATTERN (AD7780_PAT0)
Then you can assign AD7170_PATTERN[_MASK] to AD7170/AD7171 &
AD7780_PATTERN[_MASK] to AD7780/AD7781.
> .is_ad778x = false,
> },
> [ID_AD7171] = {
> .channel = AD7780_CHANNEL(16, 24),
> .pattern = 0x5,
> - .pattern_mask = 0x7,
> + .pattern_mask = AD7780_PAT0 | AD7780_PAT1 | AD7170_PAT2,
> .is_ad778x = false,
> },
> [ID_AD7780] = {
> .channel = AD7780_CHANNEL(24, 32),
> .pattern = 0x1,
> - .pattern_mask = 0x3,
> + .pattern_mask = AD7780_PAT0 | AD7780_PAT1,
> .is_ad778x = true,
> },
> [ID_AD7781] = {
> .channel = AD7780_CHANNEL(20, 32),
> .pattern = 0x1,
> - .pattern_mask = 0x3,
> + .pattern_mask = AD7780_PAT0 | AD7780_PAT1,
> .is_ad778x = true,
> },
> };
prev parent reply other threads:[~2018-11-08 7:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-07 18:49 [PATCH 0/3] staging: iio: ad7780: pattern generation and gain update Giuliano Belinassi
2018-11-07 18:49 ` [PATCH 1/3] staging: iio: ad7780: Add is_ad778x flag chip info Giuliano Belinassi
2018-11-08 7:36 ` Ardelean, Alexandru
2018-11-07 18:50 ` [PATCH 2/3] staging: iio: ad7780: check if ad778x before gain update Giuliano Belinassi
2018-11-08 7:37 ` Ardelean, Alexandru
2018-11-07 18:50 ` [PATCH 3/3] staging: iio: ad7780: generates pattern_mask from PAT bits Giuliano Belinassi
2018-11-08 7:45 ` Ardelean, Alexandru [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=75e7843ec80a3adc9f4b7ea0a7f0b33c3d518093.camel@analog.com \
--to=alexandru.ardelean@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=giuliano.belinassi@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=kernel-usp@googlegroups.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=renatogeh@gmail.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
all inboxes | Powered by JetHome®