From 6e7bc37e9c025d37914d45ae87c8213caa8b4bd7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=BC=A0=E6=99=B4?= Date: Fri, 9 May 2014 10:06:40 +0800 Subject: [PATCH] rk3288:pmic:rk808&syr82x:modify lock error --- drivers/mfd/rk808.c | 26 ++++++++++++++++---------- drivers/regulator/syr82x.c | 23 +++++++++++++++-------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index d143ce34a4f9..d37d1b3ba8bb 100755 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -809,9 +809,10 @@ int rk808_reg_read(struct rk808 *rk808, u8 reg) ret = rk808_i2c_read(rk808, reg, 1, &val); DBG("reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff); - if (ret < 0) - return ret; - + if (ret < 0){ + mutex_unlock(&rk808->io_lock); + return ret; + } mutex_unlock(&rk808->io_lock); return val & 0xff; @@ -842,17 +843,22 @@ EXPORT_SYMBOL_GPL(rk808_reg_write); ret = rk808_i2c_read(rk808, reg, 1, &tmp); DBG("1 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff); - if (ret < 0) - return ret; + if (ret < 0){ + mutex_unlock(&rk808->io_lock); + return ret; + } tmp = (tmp & ~mask) | val; ret = rk808_i2c_write(rk808, reg, 1, tmp); DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff); - if (ret < 0) - return ret; - + if (ret < 0){ + mutex_unlock(&rk808->io_lock); + return ret; + } ret = rk808_i2c_read(rk808, reg, 1, &tmp); - if (ret < 0) - return ret; + if (ret < 0){ + mutex_unlock(&rk808->io_lock); + return ret; + } DBG("2 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff); mutex_unlock(&rk808->io_lock); diff --git a/drivers/regulator/syr82x.c b/drivers/regulator/syr82x.c index bab496235734..ed0d4746a1b5 100755 --- a/drivers/regulator/syr82x.c +++ b/drivers/regulator/syr82x.c @@ -388,9 +388,10 @@ static int syr82x_reg_read(struct syr82x *syr82x, u8 reg) ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &val); DBG("reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff); - if (ret < 0) + if (ret < 0){ + mutex_unlock(&syr82x->io_lock); return ret; - + } mutex_unlock(&syr82x->io_lock); return val & 0xff; @@ -405,17 +406,23 @@ static int syr82x_set_bits(struct syr82x *syr82x, u8 reg, u16 mask, u16 val) ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &tmp); DBG("1 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff); - if (ret < 0) - return ret; + if (ret < 0){ + mutex_unlock(&syr82x->io_lock); + return ret; + } tmp = (tmp & ~mask) | val; ret = syr82x_i2c_write(syr82x->i2c, reg, 1, tmp); DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff); - if (ret < 0) - return ret; + if (ret < 0){ + mutex_unlock(&syr82x->io_lock); + return ret; + } ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &tmp); DBG("2 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff); - if (ret < 0) - return ret; + if (ret < 0){ + mutex_unlock(&syr82x->io_lock); + return ret; + } mutex_unlock(&syr82x->io_lock); return 0;//ret; -- 2.34.1