From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Kent Gustavsson <kent@minoris.se>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Cosmin Tanislav <demonsingur@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
ChiYuan Huang <cy_huang@richtek.com>,
Haibo Chen <haibo.chen@nxp.com>,
Ramona Bolboaca <ramona.bolboaca@analog.com>,
Ibrahim Tilki <Ibrahim.Tilki@analog.com>,
ChiaEn Wu <chiaen_wu@richtek.com>,
William Breathitt Gray <william.gray@linaro.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] iio: adc: mcp3911: add support for the whole MCP39xx family
Date: Tue, 8 Aug 2023 09:22:24 +0200 [thread overview]
Message-ID: <ZNHtMBG4yHpgL1kj@gmail.com> (raw)
In-Reply-To: <ZNETcVNsEmvK0KKH@smile.fi.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]
On Mon, Aug 07, 2023 at 06:53:21PM +0300, Andy Shevchenko wrote:
> On Mon, Aug 07, 2023 at 09:18:31AM +0200, Marcus Folkesson wrote:
> > Microchip does have many similar chips, add support for those.
> >
> > The new supported chips are:
> > - microchip,mcp3910
> > - microchip,mcp3912
> > - microchip,mcp3913
> > - microchip,mcp3914
> > - microchip,mcp3918
> > - microchip,mcp3919
>
> ...
>
> > +#define MCP3910_STATUSCOM_DRHIZ BIT(20)
>
> Is it deliberately using spaces? If so, why?
No, probably due to my with my new vim setup..
>
> ...
>
> > +static int mcp3910_get_osr(struct mcp3911 *adc, int *val)
> > +{
> > + int ret, osr;
> > +
> > + ret = mcp3911_read(adc, MCP3910_REG_CONFIG0, val, 3);
>
> > + osr = FIELD_GET(MCP3910_CONFIG0_OSR, *val);
> > + *val = 32 << osr;
> > + return ret;
>
> I believe this is wrong order. Or bad code. The rule of thumb is not pollute
> the output variable if we know the error happened.
>
> Same applies to another function.
>
> > +}
>
> ...
>
> > - ret = mcp3911_config(adc);
> > + ret = device_property_read_u32(&adc->spi->dev, "microchip,device-addr", &adc->dev_addr);
>
> Why not spi->dev? Ditto for other uses like this.
After all, I think it is better to stick sith adc->spi-dev to be
consistent with the rest of the probe function. Change to spi->dev
should probably be a seperate patch.
Do you agree?
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-08-08 17:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 7:18 [PATCH v3 1/2] dt-bindings: iio: adc: mcp3911: add support for the whole MCP39xx family Marcus Folkesson
2023-08-07 7:18 ` [PATCH v3 2/2] " Marcus Folkesson
2023-08-07 15:53 ` Andy Shevchenko
2023-08-08 7:22 ` Marcus Folkesson [this message]
2023-08-08 7:49 ` Krzysztof Kozlowski
2023-08-08 13:26 ` Andy Shevchenko
2023-08-08 13:26 ` Andy Shevchenko
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=ZNHtMBG4yHpgL1kj@gmail.com \
--to=marcus.folkesson@gmail.com \
--cc=Ibrahim.Tilki@analog.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=chiaen_wu@richtek.com \
--cc=conor+dt@kernel.org \
--cc=cy_huang@richtek.com \
--cc=demonsingur@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=haibo.chen@nxp.com \
--cc=jic23@kernel.org \
--cc=kent@minoris.se \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ramona.bolboaca@analog.com \
--cc=robh+dt@kernel.org \
--cc=william.gray@linaro.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).