From: David Brownell <david-b@pacbell.net>
To: Mark Brown <broonie@sirena.org.uk>
Cc: lrg@slimlogic.co.uk, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 2.6.28-rc6+] regulator: bugfixes and messaging cleanup
Date: Mon, 1 Dec 2008 15:58:08 -0800 [thread overview]
Message-ID: <200812011558.09154.david-b@pacbell.net> (raw)
In-Reply-To: <20081201225312.GA6699@sirena.org.uk>
On Monday 01 December 2008, Mark Brown wrote:
> On Mon, Dec 01, 2008 at 01:35:43PM -0800, David Brownell wrote:
>
> > Regulator core bugfixes:
>
> ...
>
> > And messaging updates;
>
> This could usefuly be split into a patch series, there's rather a lot
> of different changes in here...
Could be ... I was mostly just collecting core updates involved in
making sure I could regulator_enable() on one board. The messaging
in the current code was decidedly un-helpful for that task.
At most I'd see two patches: one with bugfixes, one with messaging
fixes that aren't strictly "bug" fixes (i.e. messages worked but
violated normal conventions like driver model).
> On the whole it looks good, a few
> things, though:
>
> > @@ -894,7 +915,7 @@ struct regulator *regulator_get(struct d
> > struct regulator *regulator = ERR_PTR(-ENODEV);
> >
> > if (id == NULL) {
> > - printk(KERN_ERR "regulator: get() with no identifier\n");
> > + dev_dbg(dev, "regulator_get with no identifier\n");
> > return regulator;
> > }
>
> dev may legally be NULL here
The kerneldoc doesn't mention that at all ... seems like a pretty
major interface artifact. Hmm, for that matter I notice that if
you were to run kerneldoc, regulator_register() -- and presumably
other functions -- would get lots of errors.
Allowing it to be NULL seems pretty much contrary to the model that
a supply name is associated with a device. I'd call that a bug and
fix it ... vs calling it a feature and diverging from standard
framework models.
> which is going to cause upset if the
> dev_dbg() is hit. Things like cpufreq which can use regulators don't
> use a struct device (currently!) so it's supported.
Which cpufreq driver(s) in mainline use regulator code?
I had commented not long ago that the regulator framework needs
updates to support cpufreq. For example, trying to enable hardware
support for DVFS (Dynamic Voltage and Frequency Scaling) on several
platforms requires configuring more than one voltage ... floor and
ceiling, switched automatically by a CPU signal, for starters.
It would be good to overhaul cpufreq before trying to make it use
things like the clock and regulator frameworks. Fitting into the
driver model seems overdue, for one.
> > @@ -971,19 +991,16 @@ static int _regulator_enable(struct regu
> > int ret = -EINVAL;
> >
> > if (!rdev->constraints) {
> > - printk(KERN_ERR "%s: %s has no constraints\n",
> > - __func__, rdev->desc->name);
> > + dev_err(&rdev->dev, "%s has no constraints\n",
> > + rdev->desc->name);
>
> Hrm. You've downgraded most of the diagnostics to dev_dbg()
No; just ones in the enable/disable paths, and even there just
ones where the caller has control over the illegal parameters.
Recall that rdev->constraints can be nulled for various reasons
that aren't under control of the regulator client.
> but left
> this as KERN_ERR. It'd be nice to be a bit more consistent. My
> personal preference is to make things in the constraints and machine
> definitions display at dev_err() since they should never happen and a
> plain text error is often helpful for new users but it's not a very
> strong one either way.
I think this was as consistent as possible with the basic rule
that when the caller could have prevented it, it's their job to
handle the fault code they get.
>
> > ret = rdev->desc->ops->enable(rdev);
> > - if (ret < 0) {
> > - printk(KERN_ERR "%s: failed to enable %s: %d\n",
> > - __func__, rdev->desc->name, ret);
> > - return ret;
> > + if (ret >= 0) {
> > + dev_dbg(&rdev->dev, "enabled %s\n", rdev->desc->name);
> > + rdev->use_count++;
>
> I have to say I'd be happier keeping the logic as it was here. The
> behaviour does stay the same due to fall through but it's not quite so
> clear since it's not consistent with the error handling style for the
> rest of the function.
You mean in this case you'd want to see a (needless) GOTO? I suppose
it could be done. If you want consistency, I'd get rid of the unique
message for missing constraints, and rely on unique fault codes ...
- Dave
next prev parent reply other threads:[~2008-12-01 23:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 21:35 [patch 2.6.28-rc6+] regulator: bugfixes and messaging cleanup David Brownell
2008-12-01 22:53 ` Mark Brown
2008-12-01 23:58 ` David Brownell [this message]
2008-12-02 1:22 ` Mark Brown
2008-12-02 5:50 ` [patch 2.6.28-rc7] regulator: init/link earlier David Brownell
2008-12-02 10:51 ` Mark Brown
2008-12-03 21:45 ` Liam Girdwood
2008-12-02 5:50 ` [patch 2.6.28-rc7] regulator: catch some registration errors David Brownell
2008-12-02 13:32 ` Mark Brown
2009-01-05 23:45 ` David Brownell
2009-01-06 10:10 ` Mark Brown
2009-01-06 10:21 ` David Brownell
2009-01-06 12:58 ` Mark Brown
2008-12-03 21:48 ` Liam Girdwood
2008-12-04 11:12 ` Mark Brown
2009-01-05 23:45 ` David Brownell
2009-01-06 10:33 ` Mark Brown
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=200812011558.09154.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=broonie@sirena.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.