Re: [PATCH v3 08/14] iio: bmg160_core: Simplify using devm_regulator_*get_enable()
From: Jonathan Cameron
Date: Sat Aug 20 2022 - 07:27:37 EST
On Sat, 20 Aug 2022 06:19:00 +0000
"Vaittinen, Matti" <Matti.Vaittinen@xxxxxxxxxxxxxxxxx> wrote:
> Thanks for the review Andy
>
> On 8/20/22 02:30, Andy Shevchenko wrote:
> > On Fri, Aug 19, 2022 at 10:21 PM Matti Vaittinen
> > <mazziesaccount@xxxxxxxxx> wrote:
> >>
> >> Use devm_regulator_bulk_get_enable() instead of open coded bulk-get,
> >> bulk-enable, add-action-to-disable-at-detach - pattern.
> >
> > ...
> >
> >> int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
> >> const char *name)
> >> {
> >> struct bmg160_data *data;
> >> struct iio_dev *indio_dev;
> >> int ret;
> >> + static const char * const regulators[] = {"vdd", "vddio"};
> >
> > Please, keep this following the "longest line first" rule. Note, in
>
> This was not following the (IMO slightly silly) rule even prior my
> patch. I can for sure move my line up - but that won't give you the
> "reverse X-mas tree".
>
> I don't have any real objections on changing the styling though - I
> don't expect this to be merged before the dependency is in rc1 - so I
> guess I will anyways need to respin this for next cycle. I can do the
> styling then.
I was a bit surprised Mark didn't do an immutable branch for this, but
indeed looks like it's going to be a multiple cycle thing - so we'll
probably have a bunch of new cases introduced in the meantime that
we need to tidy up. Ah well.
>
> > this case you even can move it out of the function, so we will see
> > clearly that this is (not a hidden) global variable.
>
> Here I do disagree with you. Moving the array out of the function makes
> it _much_ less obvious it is not used outside this function. Reason for
> making is "static const" is to allow the data be placed in read-only
> area (thanks to Guenter who originally gave me this tip).
>
> > P.S. Same applies for the rest of the similar places in your series.
> >
>
> Br,
> -- Matti
>