Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bf3e2d1d9b860591f3f204aa66d6a3c30058818d
Commit:     bf3e2d1d9b860591f3f204aa66d6a3c30058818d
Parent:     cf978ab2846d86709802f38c80d1d53da364bf51
Author:     David Brownell <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 27 18:14:46 2008 +0100
Committer:  Jean Delvare <[EMAIL PROTECTED]>
CommitDate: Sun Jan 27 18:14:46 2008 +0100

    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: David Brownell <[EMAIL PROTECTED]>
    Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
---
 drivers/i2c/algos/i2c-algo-bit.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 260c5d7..3581282 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -357,10 +357,26 @@ static int sendbytes(struct i2c_adapter *i2c_adap, struct 
i2c_msg *msg)
                        count--;
                        temp++;
                        wrcount++;
-               } else { /* arbitration or no acknowledge */
-                       dev_err(&i2c_adap->dev, "sendbytes: error - 
bailout.\n");
-                       return (retval<0)? retval : -EFAULT;
-                               /* got a better one ?? */
+
+               /* A slave NAKing the master means the slave didn't like
+                * something about the data it saw.  For example, maybe
+                * 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;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to