提交 bf3e2d1d 编写于 作者: D David Brownell 提交者: Jean Delvare

i2c-algo-bit: Fix NAK/ARB comments

Update comments and logging on return path for byte writes.  NAK is
an error, to be reported or optionally ignored.  Timeouts are always
errors.  Lost arbitration is not currently handled, so don't even list
it as an option in the error message.

Don't return bogus EFAULT code for inappropriate NAK; EIO is better,
there is no bad userspace address in question.
Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: NJean Delvare <khali@linux-fr.org>
上级 cf978ab2
...@@ -357,10 +357,26 @@ static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) ...@@ -357,10 +357,26 @@ static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
count--; count--;
temp++; temp++;
wrcount++; wrcount++;
} else { /* arbitration or no acknowledge */
dev_err(&i2c_adap->dev, "sendbytes: error - bailout.\n"); /* A slave NAKing the master means the slave didn't like
return (retval<0)? retval : -EFAULT; * something about the data it saw. For example, maybe
/* got a better one ?? */ * the SMBus PEC was wrong.
*/
} else if (retval == 0) {
dev_err(&i2c_adap->dev, "sendbytes: NAK bailout.\n");
return -EIO;
/* Timeout; or (someday) lost arbitration
*
* FIXME Lost ARB implies retrying the transaction from
* the first message, after the "winning" master issues
* its STOP. As a rule, upper layer code has no reason
* to know or care about this ... it is *NOT* an error.
*/
} else {
dev_err(&i2c_adap->dev, "sendbytes: error %d\n",
retval);
return retval;
} }
} }
return wrcount; return wrcount;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册