Re: [PATCH 1/2] Add support for TPS6235x support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux