From: Axel Lin Date: Thu, 11 Mar 2010 01:50:07 +0000 (+0800) Subject: lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic X-Git-Tag: v2.6.34-rc3~40^2~1 X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=commitdiff_plain;h=451a73cd46573444f68f412c87439c0a291718ec lp3971: Fix BUCK_VOL_CHANGE_SHIFT logic Given x=0,1,2, current implementation of BUCK_VOL_CHANGE_SHIFT(x) returns 0,4,8. The correct return value should be 0,4,6. This patch fix the logic. Signed-off-by: Axel Lin Acked-by: Marek Szyprowski Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index 8bdcf41..b20b3e1 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c @@ -45,7 +45,7 @@ static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val); LP3971_BUCK2 -> 4 LP3971_BUCK3 -> 6 */ -#define BUCK_VOL_CHANGE_SHIFT(x) (((1 << x) & ~0x01) << 1) +#define BUCK_VOL_CHANGE_SHIFT(x) (((!!x) << 2) | (x & ~0x01)) #define BUCK_VOL_CHANGE_FLAG_GO 0x01 #define BUCK_VOL_CHANGE_FLAG_TARGET 0x02 #define BUCK_VOL_CHANGE_FLAG_MASK 0x03