Prev: [PATCH 06/13] Allow xen platform pci device to be compiled as a module
Next: [git pull] PCI fix
From: Jean Delvare on 21 Jun 2010 13:10 Hi Guenter, On Sun, 20 Jun 2010 10:57:53 -0700, Guenter Roeck wrote: > Sibyte i2c bus driver returns non-descriptive error values. > Update to return error values as defined in Documentation/i2c/fault-codes. > > Signed-off-by: Guenter Roeck <guenter.roeck(a)ericsson.com> > --- > drivers/i2c/busses/i2c-sibyte.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c > index 3d76a18..329cbee 100644 > --- a/drivers/i2c/busses/i2c-sibyte.c > +++ b/drivers/i2c/busses/i2c-sibyte.c > @@ -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 -ENXIO; > } > > if (data_bytes == 1) Definitely an improvement. However, returning -ENXIO on all errors seems wrong. This error value should only be returned on missing ack from the slave on address byte. Isn't it possible to distinguish between different error kinds? M_SMB_ERROR_TYPE seems promising, but one would need to look up the datasheet (which I don't have) to discover its meaning. -- Jean Delvare -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Guenter Roeck on 22 Jun 2010 08:00 On Mon, Jun 21, 2010 at 01:02:52PM -0400, Jean Delvare wrote: > Hi Guenter, > > On Sun, 20 Jun 2010 10:57:53 -0700, Guenter Roeck wrote: > > Sibyte i2c bus driver returns non-descriptive error values. > > Update to return error values as defined in Documentation/i2c/fault-codes. > > > > Signed-off-by: Guenter Roeck <guenter.roeck(a)ericsson.com> > > --- > > drivers/i2c/busses/i2c-sibyte.c | 4 ++-- > > 1 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c > > index 3d76a18..329cbee 100644 > > --- a/drivers/i2c/busses/i2c-sibyte.c > > +++ b/drivers/i2c/busses/i2c-sibyte.c > > @@ -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 -ENXIO; > > } > > > > if (data_bytes == 1) > > Definitely an improvement. However, returning -ENXIO on all errors > seems wrong. This error value should only be returned on missing ack > from the slave on address byte. Isn't it possible to distinguish > between different error kinds? M_SMB_ERROR_TYPE seems promising, but > one would need to look up the datasheet (which I don't have) to > discover its meaning. > Makes sense. I'll dig up a copy of the datasheet and see if I can improve it. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Jean Delvare on 22 Jun 2010 14:20 Hi Guenter, On Tue, 22 Jun 2010 07:09:08 -0700, Guenter Roeck wrote: > Sibyte i2c bus driver returns non-descriptive error values. > Update to return error values as defined in Documentation/i2c/fault-codes. > > Signed-off-by: Guenter Roeck <guenter.roeck(a)ericsson.com> > --- > 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(-) > > diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c > index 3d76a18..0fe505d 100644 > --- a/drivers/i2c/busses/i2c-sibyte.c > +++ b/drivers/i2c/busses/i2c-sibyte.c > @@ -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) Very nice, patch applied, thanks. -- Jean Delvare -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Maciej W. Rozycki on 26 Jun 2010 12:20 On Tue, 22 Jun 2010, Guenter Roeck wrote: > > > @@ -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 -ENXIO; > > > } > > > > > > if (data_bytes == 1) > > > > Definitely an improvement. However, returning -ENXIO on all errors > > seems wrong. This error value should only be returned on missing ack > > from the slave on address byte. Isn't it possible to distinguish > > between different error kinds? M_SMB_ERROR_TYPE seems promising, but > > one would need to look up the datasheet (which I don't have) to > > discover its meaning. > > > Makes sense. I'll dig up a copy of the datasheet and see if I can improve it. The M_SMB_ERROR_TYPE bit is cleared if an expected ackonwledgement has not been seen and set if the transfer has failed after 15 retries. So that's probably ENXIO for the former and EIO for the latter. Maciej -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: [PATCH 06/13] Allow xen platform pci device to be compiled as a module Next: [git pull] PCI fix |