[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 8 Aug 2023 09:22:24 +0200
From: Marcus Folkesson <marcus.folkesson@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Kent Gustavsson <kent@...oris.se>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Cosmin Tanislav <demonsingur@...il.com>,
Arnd Bergmann <arnd@...db.de>,
ChiYuan Huang <cy_huang@...htek.com>,
Haibo Chen <haibo.chen@....com>,
Ramona Bolboaca <ramona.bolboaca@...log.com>,
Ibrahim Tilki <Ibrahim.Tilki@...log.com>,
ChiaEn Wu <chiaen_wu@...htek.com>,
William Breathitt Gray <william.gray@...aro.org>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] iio: adc: mcp3911: add support for the whole
MCP39xx family
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
>
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists