[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131216185753.GN3185@sirena.org.uk>
Date: Mon, 16 Dec 2013 18:57:53 +0000
From: Mark Brown <broonie@...nel.org>
To: Anson Huang <b20788@...escale.com>
Cc: lgirdwood@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regulator: anatop: add is_enabled interface
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.
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists