From: Mark Brown <broonie@kernel.org>
To: Anson Huang <b20788@freescale.com>
Cc: lgirdwood@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: anatop: add is_enabled interface
Date: Mon, 16 Dec 2013 18:57:53 +0000 [thread overview]
Message-ID: <20131216185753.GN3185@sirena.org.uk> (raw)
In-Reply-To: <1387228827-933-1-git-send-email-b20788@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 840 bytes --]
On Mon, Dec 16, 2013 at 04:20:27PM -0500, Anson Huang wrote:
> +{
> + struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
> + u32 val;
> +
> + if (!anatop_reg->control_reg)
> + return -ENOTSUPP;
In what situation would this happen and why would the operation be
provided in those situations?
> + regmap_read(anatop_reg->anatop, anatop_reg->control_reg, &val);
> +
> + return (val >> anatop_reg->vol_bit_shift) &
> + ((1 << anatop_reg->vol_bit_width) - 1) ? 1 : 0;
> +}
This isn't terribly legible but it looks like it's trying to read to see
if a non-zero voltage has been written. If that's the case it looks
like enable and disable operations should be supported since presumably
the register can be written as well.
Please try to avoid the ternery operator, especially in cases like this
where it's not adding anything.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-12-16 18:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-16 21:20 Anson Huang
2013-12-16 18:57 ` Mark Brown [this message]
2013-12-17 2:38 ` Anson.Huang
2013-12-17 12:29 ` Mark Brown
2013-12-17 12:38 ` Anson.Huang
2013-12-17 13:00 ` Mark Brown
2013-12-17 13:10 ` Anson.Huang
2013-12-17 13:53 ` 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=20131216185753.GN3185@sirena.org.uk \
--to=broonie@kernel.org \
--cc=b20788@freescale.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®