linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio <linux-iio@vger.kernel.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v2 01/12] iio:dac:ad5755: Switch to generic firmware properties and drop pdata
Date: Sun, 5 Dec 2021 17:36:03 +0200	[thread overview]
Message-ID: <CAHp75VdB-rV-KxwpWtapG7jhJHcdH8az9FWt+WgKNWCpZpojQg@mail.gmail.com> (raw)
In-Reply-To: <CAHp75Vd7vPfNMMBwDYuFSNtSZryyeGEDp9P6wcWCuJrz5B2OqA@mail.gmail.com>

On Sun, Dec 5, 2021 at 5:02 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Sat, Dec 4, 2021 at 7:07 PM Jonathan Cameron <jic23@kernel.org> wrote:

...

> > +       const struct ad5755_platform_data *pdata = NULL;
> >         struct iio_dev *indio_dev;
> >         struct ad5755_state *st;
> >         int ret;
>
> > -       if (spi->dev.of_node)
> > -               pdata = ad5755_parse_dt(&spi->dev);
> > -       else
> > -               pdata = spi->dev.platform_data;
> > +       if (dev_fwnode(&spi->dev))
> > +               pdata = ad5755_parse_fw(&spi->dev);
> >
> >         if (!pdata) {
> > -               dev_warn(&spi->dev, "no platform data? using default\n");
> > +               dev_warn(&spi->dev,
> > +                        "no firmware provided parameters? using default\n");
>
> It's fine to have it on one line (and not related to the 80 vs 100
> case, it's about string literal as the last argument).
>
> >                 pdata = &ad5755_default_pdata;
> >         }
>
>
> Perhaps
>
>     const struct ad5755_platform_data *pdata;
>     ...
>     if (dev_fwnode(...))
>       pdata = ...
>     else
>       pdata = &_default;
>     if (pdata == &_default)
>       dev_warn(...);
>
> ?

After reading it again, I realized that pdata may be NULL in fwnode
case. So, original code is fine, but I would rather move NULL
assignment closer to the conditional (up to you, I'm fine with either,
i.o.w. you may ignore this comment).

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-12-05 15:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 17:12 [PATCH v2 00/12] IIO: More of to generic fw conversions Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 01/12] iio:dac:ad5755: Switch to generic firmware properties and drop pdata Jonathan Cameron
2021-12-05 15:02   ` Andy Shevchenko
2021-12-05 15:36     ` Andy Shevchenko [this message]
2021-12-05 16:26       ` Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 02/12] iio:dac:ad5758: Drop unused of specific headers Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 03/12] iio:dac:dpot-dac: Swap of.h for mod_devicetable.h Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 04/12] iio:dac:lpc18xx_dac: Swap from of* to mod_devicetable.h Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 05/12] iio:pot:mcp41010: Switch to generic firmware properties Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 06/12] iio:light:cm3605: " Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 07/12] iio:adc:max9611: " Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 08/12] iio:adc:mcp3911: " Jonathan Cameron
2021-12-05 15:07   ` Andy Shevchenko
2021-12-05 16:19     ` Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 09/12] iio:adc:ti-adc12138: " Jonathan Cameron
2021-12-05 15:12   ` Andy Shevchenko
2021-12-05 15:13     ` Andy Shevchenko
2021-12-05 16:38       ` Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 10/12] iio:adc:envelope-detector: Switch from of headers to mod_devicetable.h Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 11/12] iio:adc:ti-ads124s08: Drop dependency on OF Jonathan Cameron
2021-12-04 17:12 ` [PATCH v2 12/12] iio:adc/dac:Kconfig: Update to drop OF dependencies Jonathan Cameron
2021-12-05 15:15   ` Andy Shevchenko
2021-12-05 16:48     ` Jonathan Cameron
2021-12-05 15:16 ` [PATCH v2 00/12] IIO: More of to generic fw conversions Andy Shevchenko
2021-12-05 15:17   ` 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=CAHp75VdB-rV-KxwpWtapG7jhJHcdH8az9FWt+WgKNWCpZpojQg@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.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).