linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Rob Clark <robdclark@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>,
	lgirdwood@gmail.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Airlie <airlied@linux.ie>,
	David Brown <davidb@codeaurora.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] regulator: stub out devm_regulator_get_exclusive
Date: Fri, 24 Oct 2014 22:18:48 +0100	[thread overview]
Message-ID: <20141024211848.GP3729@sirena.org.uk> (raw)
In-Reply-To: <CAF6AEGssn23wSaSCY-MH+CUk1YD2g7Ld+rejQq0BSHUAcXgZEQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2138 bytes --]

On Fri, Oct 24, 2014 at 04:36:24PM -0400, Rob Clark wrote:

> iirc, I was using _get_exclusive() in a few places where I wanted to
> be sure not to get dummy-regulator in cases where I should
> -EPROBE_DEFER instead (since probe order with DT is slightly
> hilarious, and since I depend on a few other drivers I end up
> deferring at least a couple times at boot)... I don't quite remember
> the details.  But afaict regulator_get() still allows dummy-regulator,
> which is what I specifically don't want.

No, this is actually making things worse.  You will only get a dummy
regulator from regulator_get() if no regulator at all is mapped in the
DT, if one is mapped then you'll always get either an -EPROBE_DEFER or
the real regulator.  Right now the driver is broken with respect to
-EPROBE_DEFER since it just completely ignores the error code and
carries on happily if any error is returned which means that the
behaviour is going to be unstable on any given system, what happens will
depend on probe order which could in turn depend on what's been built
modular and so on.

As far as I can tell the only thing the driver does with the regulator
it's grabbing exclusively is enable it in probe() and that's going to
work just as well with the dummy regulator anyway so I can't see any
reason to worry if the driver is getting one.

> If you have a recommendation for a better way, I am all ears.

Just use regulator_get() (or better, devm_regulator_get()) and pay
attention to the errors.  The driver should also disable the regulator
on remove and I'd be surprised if the other two regulators shouldn't be
using a normal _get() too.  If there is a good reason to use _optional()
then the code should be changed to use ERR_PTR() rather than NULL to
check for missing regulators and the driver needs to keep them enabled
as long as it's using them.

Given that the two optional regulators are only set to one specific
value it's a bit surprising that the DT doesn't do this but I guess it's
possible there could be broken DTs out there that do give permission for
set_voltage() for a range rather than specifying the correct voltage.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-10-24 21:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 19:15 [PATCH] regulator: stub out devm_regulator_get_exclusive Felipe Balbi
2014-10-24 19:20 ` Felipe Balbi
2014-10-24 20:11 ` Mark Brown
2014-10-24 20:18   ` Felipe Balbi
2014-10-24 20:58     ` Mark Brown
2014-10-24 20:36   ` Rob Clark
2014-10-24 21:18     ` Mark Brown [this message]
2014-10-24 21:57       ` Rob Clark
2014-10-25  9:46         ` 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=20141024211848.GP3729@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=airlied@linux.ie \
    --cc=balbi@ti.com \
    --cc=davidb@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.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;
as well as URLs for NNTP newsgroup(s).