lkml.org 
[lkml]   [2020]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Re: [PATCH v2 1/2] iio: adc: ad7291: convert to device tree
On Mon, Mar 30, 2020 at 11:12 PM Michael Auchter <michael.auchter@ni.com> wrote:
> On Sun, Mar 22, 2020 at 01:46:21AM +0200, Andy Shevchenko wrote:
> > On Tue, Mar 17, 2020 at 4:53 PM Michael Auchter <michael.auchter@ni.com> wrote:

...

> > > + chip->reg = devm_regulator_get_optional(&client->dev, "vref");
> > > + if (!IS_ERR(chip->reg)) {
> >
> > Why not to go with usual positive conditional?
>
> I took this pattern from ad7266.c which Lars pointed me to. I agree that
> a positive conditional here would probably be more natural. I'll change
> that if you'd prefer.

Yes, please do.

...

> > > + .of_match_table = of_match_ptr(ad7291_of_match),
> >
> > No need to use of_match_ptr(). Haven't you got a compiler warning in !OF case?
>
> Hm, no warning as far as I can see with !OF...

Have you used `make W=1 ...`? With it you should get a warning that
table defined but not used.

> but agreed that this
> doesn't make much sense as-is.
>
> Is dropping of_match_ptr() the preferred route here? The driver doesn't
> depend on OF, so it seems like keeping of_match_ptr and instead guarding
> the ad7291_of_match table with #ifdef CONFIG_OF would be preferred. Of
> course, maybe that's not worth it for saving some bytes from the final
> image.

You need either both (of_match_ptr() _and_ ugly ifdeffery, and note
you will need of.h for that) or none (mod_devicetable.h maybe needed,
though).

> Let me know which route would be preferred.

If we would like to use this in non-DT environment, then drop all that
OF-specific stuff.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-03-31 12:57    [W:0.102 / U:6.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site