From: Tomoya MORINAGA Date: Thu, 23 Jun 2011 07:17:10 +0000 (+0900) Subject: i2c-eg20t : Fix the issue of Combined R/W transfer mode X-Git-Tag: next-20110726~53^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=650d96ab785c0786cb3c9dfefa0dfd6d47d0f681;p=karo-tx-linux.git i2c-eg20t : Fix the issue of Combined R/W transfer mode issue-1 In case combined transfer mode fails halfway, the processing must be stopped halfway. However currently, the processing is continued. This patch breaks the processing. issue-2 Currently, pch_i2c_xfer returns read/write size at that time. However pch_i2c_xfer must return the number of messages to be read/written. This patch modifies correctly. Signed-off-by: Tomoya MORINAGA Signed-off-by: Ben Dooks --- diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index 9b072fd42108..ce1a32b71e47 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c @@ -673,7 +673,7 @@ static s32 pch_i2c_xfer(struct i2c_adapter *i2c_adap, /* transfer not completed */ adap->pch_i2c_xfer_in_progress = true; - for (i = 0; i < num; i++) { + for (i = 0; i < num && ret >= 0; i++) { pmsg = &msgs[i]; pmsg->flags |= adap->pch_buff_mode_en; status = pmsg->flags; @@ -699,7 +699,7 @@ static s32 pch_i2c_xfer(struct i2c_adapter *i2c_adap, mutex_unlock(&pch_mutex); - return ret; + return (ret < 0) ? ret : num; } /**