linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Gardner <gardner.ben@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Wolfram Sang <wsa@the-dreams.de>,
	Linux I2C <linux-i2c@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property()
Date: Thu, 9 Feb 2017 09:27:29 -0600	[thread overview]
Message-ID: <CAE7DoPYfvdDJS=Q80P5-+Lf2L2j9sy9TcQ3eoh4CoAxtvs_yQg@mail.gmail.com> (raw)
In-Reply-To: <CAHp75Vd4iwOUaJFzS_AnDGSbmKPSg=f+9VAb6AZdkv51zpbbQA@mail.gmail.com>

Hi Andy,

Thanks for taking the time to look at this.

On Wed, Feb 8, 2017 at 6:07 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Wed, Feb 8, 2017 at 9:53 PM, Ben Gardner <gardner.ben@gmail.com> wrote:
> > Allow the at24 driver to get configuration information from both OF and
> > ACPI by using the more generic device_property functions.
> > This change was inspired by the at25.c driver.
> >

(snip)

> Few comments, after addressing them
>
> FWIW:
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>

(snip)

> >
> > -#ifdef CONFIG_OF
> > -static void at24_get_ofdata(struct i2c_client *client,
> > +static void at24_fw_to_chip(struct device *dev,
> >                             struct at24_platform_data *chip)
>
> "fw" here is ambiguous a bit.
> Would at24_get_pdata() work for you?

That name also works for me.

> >  {
> > -       const __be32 *val;
> > -       struct device_node *node = client->dev.of_node;
> > -
> > -       if (node) {
> > -               if (of_get_property(node, "read-only", NULL))
> > -                       chip->flags |= AT24_FLAG_READONLY;
> > -               val = of_get_property(node, "pagesize", NULL);
> > -               if (val)
> > -                       chip->page_size = be32_to_cpup(val);
> > -       }
> > +       u32 val;
> > +
> > +       if (device_property_present(dev, "read-only"))
> > +               chip->flags |= AT24_FLAG_READONLY;
> > +
>
> > +       if (device_property_read_u32(dev, "pagesize", &val) == 0)
>
> I would use default from probe here.
>
> int ret;
>
> ...
>
> ret = ..._u32(..., &val);
> if (ret) {
> /* ...long comment from ->probe()... */
>    chip->page_size = 1;
> } else
>    chip->page_size = val;

That sounds reasonable.

> > +               chip->page_size = val;
> >  }
> > -#else
> > -static void at24_get_ofdata(struct i2c_client *client,
> > -                           struct at24_platform_data *chip)
> > -{ }
> > -#endif /* CONFIG_OF */
> >
> >  static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> >  {
> > @@ -621,7 +611,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> >                 chip.page_size = 1;
> >
>
> >                 /* update chipdata if OF is present */
>
> This is now redundant.

Yeah, that comment doesn't seem all that useful.

> > -               at24_get_ofdata(client, &chip);
> > +               at24_fw_to_chip(&client->dev, &chip);
> >
> >                 chip.setup = NULL;
> >                 chip.context = NULL;
> > --
> > 2.7.4
> >
>
>
>
> --
> With Best Regards,
> Andy Shevchenko

I'll send an update.

Thanks,
Ben

  reply	other threads:[~2017-02-09 15:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 19:53 [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property() Ben Gardner
2017-02-09  0:07 ` Andy Shevchenko
2017-02-09 15:27   ` Ben Gardner [this message]
2017-02-09 15:33 ` [PATCH v2] " Ben Gardner
2017-02-09 16:20   ` Andy Shevchenko
2017-02-09 17:03     ` Ben Gardner
2017-02-09 17:09       ` [PATCH v3] " Ben Gardner
2017-02-09 17:18         ` Ben Gardner
2017-02-09 17:36           ` [PATCH v4] " Ben Gardner
2017-02-09 17:43             ` Andy Shevchenko
2017-02-09 19:58             ` Wolfram Sang
2017-02-09 20:31               ` Ben Gardner
2017-02-10 15:34             ` Wolfram Sang
2017-02-09 20:35   ` [PATCH v2] " kbuild test robot
2017-02-09 21:30     ` Andy Shevchenko
2017-02-09 23:52   ` kbuild test robot

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='CAE7DoPYfvdDJS=Q80P5-+Lf2L2j9sy9TcQ3eoh4CoAxtvs_yQg@mail.gmail.com' \
    --to=gardner.ben@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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).