Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758234Ab2F1Dqz (ORCPT ); Wed, 27 Jun 2012 23:46:55 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:36491 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758194Ab2F1Dqu convert rfc822-to-8bit (ORCPT ); Wed, 27 Jun 2012 23:46:50 -0400 MIME-Version: 1.0 In-Reply-To: <20120627185136.315e6625@endymion.delvare> References: <1340805255-8041-1-git-send-email-djkurtz@chromium.org> <1340805255-8041-5-git-send-email-djkurtz@chromium.org> <20120627185136.315e6625@endymion.delvare> From: Daniel Kurtz Date: Thu, 28 Jun 2012 11:46:28 +0800 X-Google-Sender-Auth: Jod9TGh7RODhpyNRbADgIvMK57o Message-ID: Subject: Re: [PATCH 4/8 v3] i2c: i801: check and return errors during byte-by-byte transfers To: Jean Delvare Cc: Ben Dooks , Wolfram Sang , Seth Heasley , Olof Johansson , Benson Leung , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2871 Lines: 69 On Thu, Jun 28, 2012 at 12:51 AM, Jean Delvare wrote: > On Wed, 27 Jun 2012 21:54:11 +0800, Daniel Kurtz wrote: >> If an error is detected in the polling loop, abort the transaction and >> return an error code. >> >> ?* DEV_ERR is set if the device does not respond with an acknowledge, and >> the SMBus controller times out (minimum 25ms). >> ?* BUS_ERR is set if a bus arbitration collision is detected. ?In other >> words, when the SMBus controller tries to generate a START condition, but >> detects that the SMBDATA is being held low, usually by another SMBus/I2C >> master. >> ?* FAILED is only set if a the transaction is set by software (using the >> SMBHSTCNT KILL bit). That was supposed to say: * FAILED is only set if a transaction is stopped by software (using the SMBHSTCNT KILL bit). > Not quite sure what you mean with "set by software". Other than this, > patch looks good, applied, thanks. Applied where? I'd like to send a rebased patchset onto whatever you have already staged. > >> >> Signed-off-by: Daniel Kurtz >> --- >> ?drivers/i2c/busses/i2c-i801.c | ? 10 ++++++---- >> ?1 files changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c >> index 6a53338..ba56b74 100644 >> --- a/drivers/i2c/busses/i2c-i801.c >> +++ b/drivers/i2c/busses/i2c-i801.c >> @@ -131,9 +131,11 @@ >> ?#define SMBHSTSTS_INTR ? ? ? ? ? ? ? 0x02 >> ?#define SMBHSTSTS_HOST_BUSY ?0x01 >> >> -#define STATUS_FLAGS ? ? ? ? (SMBHSTSTS_BYTE_DONE | SMBHSTSTS_FAILED | \ >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SMBHSTSTS_BUS_ERR | SMBHSTSTS_DEV_ERR | \ >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SMBHSTSTS_INTR) >> +#define STATUS_ERROR_FLAGS ? (SMBHSTSTS_FAILED | SMBHSTSTS_BUS_ERR | \ >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?SMBHSTSTS_DEV_ERR) >> + >> +#define STATUS_FLAGS ? ? ? ? (SMBHSTSTS_BYTE_DONE | SMBHSTSTS_INTR | \ >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?STATUS_ERROR_FLAGS) >> >> ?/* Older devices have their ID defined in */ >> ?#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS ? ? ? ?0x1c22 >> @@ -385,7 +387,7 @@ static int i801_block_transaction_byte_by_byte(struct i801_priv *priv, >> ? ? ? ? ? ? ? do { >> ? ? ? ? ? ? ? ? ? ? ? usleep_range(250, 500); >> ? ? ? ? ? ? ? ? ? ? ? status = inb_p(SMBHSTSTS(priv)); >> - ? ? ? ? ? ? } while ((!(status & SMBHSTSTS_BYTE_DONE)) >> + ? ? ? ? ? ? } while (!(status & (SMBHSTSTS_BYTE_DONE | STATUS_ERROR_FLAGS)) >> ? ? ? ? ? ? ? ? ? ? ? ?&& (timeout++ < MAX_RETRIES)); >> >> ? ? ? ? ? ? ? result = i801_check_post(priv, status, timeout > MAX_RETRIES); > > > -- > Jean Delvare -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/