From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Linux I2C <linux-i2c@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [RFC PATCH] i2c: refactor parsing of timings
Date: Thu, 26 Mar 2020 12:50:12 +0200 [thread overview]
Message-ID: <20200326105012.GN1922688@smile.fi.intel.com> (raw)
In-Reply-To: <CAMuHMdXVy1acwXxD9C==gGve-Xb-oPbF7BOpu1BaT=1gvUTdQQ@mail.gmail.com>
On Thu, Mar 26, 2020 at 11:36:44AM +0100, Geert Uytterhoeven wrote:
> On Thu, Mar 26, 2020 at 11:17 AM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> > When I wanted to print the chosen values to debug output, I concluded
> > that a helper function to parse one timing would be helpful.
...
> > +static void i2c_parse_timing(struct device *dev, char *prop_name, u32 *cur_val_p,
> > + u32 def_val, bool use_def)
> > +{
> > + int ret;
> > +
> > + ret = device_property_read_u32(dev, prop_name, cur_val_p);
> > + if (ret && use_def)
> > + *cur_val_p = def_val;
>
> Alternatively, you could just preinitialize the value with the default value
> before calling this function, and ignoring ret.
> That would remove the need for both the def_val and use_def parameters.
Some drivers are using false to use_defaults. How they will survive this change?
(See rcar case, for instance)
> > + dev_dbg(dev, "%s: %u\n", prop_name, *cur_val_p);
> > +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-03-26 10:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 10:16 [RFC PATCH] i2c: refactor parsing of timings Wolfram Sang
2020-03-26 10:36 ` Geert Uytterhoeven
2020-03-26 10:50 ` Andy Shevchenko [this message]
2020-03-26 10:52 ` Wolfram Sang
2020-03-26 11:15 ` Geert Uytterhoeven
2020-03-26 12:05 ` Andy Shevchenko
2020-03-26 10:47 ` Andy Shevchenko
2020-03-26 11:00 ` Wolfram Sang
2020-03-26 11:16 ` 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=20200326105012.GN1922688@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=geert@linux-m68k.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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