On Tuesday 03 February 2009, Manikandan Pillai wrote:
> +static int tps6235x_dcdc_is_enabled(struct regulator_dev *dev)
> +{
> + unsigned char vsel1;
> + struct tps *tps = rdev_get_drvdata(dev);
> +
> + tps_6235x_read_reg(tps, TPS6235X_REG_VSEL1, &vsel1);
> +
> + return !(vsel1 & TPS6235X_EN_DCDC);
> +}
Let me correct my earlier comment about bugs in this routine.
Today's is_enabled() predicate *DOES* support error reporting.
So that code should be
ret = tps_6235x_read_reg(...);
if (ret < 0)
return ret;
But another bug here is the "!(vsel & ...)", returning zero
when the regulator is *ENABLED* not disabled.
Either return "!!(vsel & ...)" to return zero/one, or
else remove the "!( )" entirely
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html