linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] can: flexcan: add a regulator for transceiver
Date: Tue, 3 Jul 2012 15:46:47 +0100	[thread overview]
Message-ID: <20120703144646.GT29030@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20120703141829.GG22705@S2101-09.ap.freescale.net>

On Tue, Jul 03, 2012 at 10:18:31PM +0800, Shawn Guo wrote:
> On Tue, Jul 03, 2012 at 02:07:47PM +0100, Mark Brown wrote:

> > No, the regulator API will stub itself out if not enabled, and if the
> > supply is fixed then a fixed voltage regulator will do the job.  We
> > shouldn't be open coding this stuff in individual users.

> Ah, yes.  But when you say "a fixed voltage regulator", you actually
> meant dummy regulator, right?

No, I really do mean a fixed voltage regulator.  Dummy regulators should
essentially never be used in production.

>  static void flexcan_transceiver_switch(const struct flexcan_priv *priv, int on)
>  {
> +       if (on)
> +               regulator_enable(priv->reg_xcvr);
> +       else
> +               regulator_disable(priv->reg_xcvr);
> +

So long as the stack guarantees that you won't get unbalanced calls to
this and...

> +       priv->reg_xcvr = devm_regulator_get(&pdev->dev, "xcvr");

...add error checking here the code should be fine, yes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120703/782081de/attachment.sig>

  reply	other threads:[~2012-07-03 14:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03 12:46 [PATCH] can: flexcan: add a regulator for transceiver Shawn Guo
2012-07-03 13:07 ` Mark Brown
2012-07-03 14:18   ` Shawn Guo
2012-07-03 14:46     ` Mark Brown [this message]
2012-07-03 15:28       ` Shawn Guo
2012-07-03 16:56         ` 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=20120703144646.GT29030@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).