Skip to contentSkip to conversation

i2c/mips: Fix error return codes from Sibyte i2c bus driver

PATCH In review Guenter Roeck 2 participants 2 messages Jun 22, 2010 I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c/mips: Fix error return codes from Sibyte i2c bus driver

Sibyte i2c bus driver returns non-descriptive error values. Update to return error values as defined in Documentation/i2c/fault-codes.

---
v2: Return -ENXIO for missing ACK and -EIO for other errors

---
 drivers/i2c/busses/i2c-sibyte.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-sibyte.c +2 -2
index 3d76a18..0fe505d 100644
@@ -94,7 +94,7 @@ static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr,
 		}
 		break;
 	default:
-		return -1;      /* XXXKW better error code? */
+		return -EOPNOTSUPP;
 	}
 
 	while (csr_in32(SMB_CSR(adap, R_SMB_STATUS)) & M_SMB_BUSY)
@@ -104,7 +104,7 @@ static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr,
 	if (error & M_SMB_ERROR) {
 		/* Clear error bit by writing a 1 */
 		csr_out32(M_SMB_ERROR, SMB_CSR(adap, R_SMB_STATUS));
-		return -1;      /* XXXKW better error code? */
+		return (error & M_SMB_ERROR_TYPE) ? -EIO : -ENXIO;
 	}
 
 	if (data_bytes == 1)
Signature · 1 line
1.7.0.87.g0901d
#1 lore raw

Hi Guenter,

Quoted 24 lines · Guenter Roeck

Sibyte i2c bus driver returns non-descriptive error values. Update to return error values as defined in Documentation/i2c/fault-codes.

---
v2: Return -ENXIO for missing ACK and -EIO for other errors

---
 drivers/i2c/busses/i2c-sibyte.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-sibyte.c +1 -1
index 3d76a18..0fe505d 100644
@@ -94,7 +94,7 @@ static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr,
 		}
 		break;
 	default:
-		return -1;      /* XXXKW better error code? */
+		return -EOPNOTSUPP;
 	}
 
 	while (csr_in32(SMB_CSR(adap, R_SMB_STATUS)) & M_SMB_BUSY)

drivers/i2c/busses/i2c-sibyte.c static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr, · line 110

Quoted 8 lines
drivers/i2c/busses/i2c-sibyte.c +1 -1
@@ -104,7 +104,7 @@ static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr,
 	if (error & M_SMB_ERROR) {
 		/* Clear error bit by writing a 1 */
 		csr_out32(M_SMB_ERROR, SMB_CSR(adap, R_SMB_STATUS));
-		return -1;      /* XXXKW better error code? */
+		return (error & M_SMB_ERROR_TYPE) ? -EIO : -ENXIO;
 	}
 
 	if (data_bytes == 1)

Very nice, patch applied, thanks.

Signature · 1 line
Jean Delvare