All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@sirena.org.uk>
To: David Brownell <david-b@pacbell.net>
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 22:53:13 +0000	[thread overview]
Message-ID: <20081201225312.GA6699@sirena.org.uk> (raw)
In-Reply-To: <200812011335.43551.david-b@pacbell.net>

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...  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 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.

> @@ -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() 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.

>  		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.

  reply	other threads:[~2008-12-01 22:53 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 [this message]
2008-12-01 23:58   ` David Brownell
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=20081201225312.GA6699@sirena.org.uk \
    --to=broonie@sirena.org.uk \
    --cc=david-b@pacbell.net \
    --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.