From ebb63ed242d455449fa1ec732ff3c6809202b793 Mon Sep 17 00:00:00 2001 From: Zhang Xiaodong Date: Wed, 12 Dec 2012 15:57:31 +0800 Subject: [PATCH] ENGR00223037-1 pmic: Fix the bug of pmic I2C Fix the bug of wm831x pmic I2C Signed-off-by: Zhang Xiaodong Acked-by: Lily Zhang --- drivers/mfd/wm831x-i2c.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) mode change 100644 => 100755 drivers/mfd/wm831x-i2c.c diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c old mode 100644 new mode 100755 index a06cbc739716..7a4f998776f2 --- a/drivers/mfd/wm831x-i2c.c +++ b/drivers/mfd/wm831x-i2c.c @@ -53,23 +53,21 @@ static int wm831x_i2c_write_device(struct wm831x *wm831x, unsigned short reg, struct i2c_client *i2c = wm831x->control_data; struct i2c_msg xfer[2]; int ret; + char buf_to_write[4]; reg = cpu_to_be16(reg); + memcpy( buf_to_write, ®, 2); + memcpy( buf_to_write + 2, src, 2); xfer[0].addr = i2c->addr; xfer[0].flags = 0; - xfer[0].len = 2; - xfer[0].buf = (char *)® + xfer[0].len = 4; + xfer[0].buf = buf_to_write; - xfer[1].addr = i2c->addr; - xfer[1].flags = I2C_M_NOSTART; - xfer[1].len = bytes; - xfer[1].buf = (char *)src; - - ret = i2c_transfer(i2c->adapter, xfer, 2); + ret = i2c_transfer(i2c->adapter, xfer, 1); if (ret < 0) return ret; - if (ret != 2) + if (ret != 1) return -EIO; return 0; -- 2.39.5