From patchwork Sat Nov 1 00:29:25 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Ditto X-Patchwork-Id: 6763 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 4AE1ADDF67 for ; Sat, 1 Nov 2008 11:29:41 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from tidalnetworks.net (mail.consentry.com [75.35.230.10]) by ozlabs.org (Postfix) with ESMTP id EA349DDDF0 for ; Sat, 1 Nov 2008 11:29:26 +1100 (EST) Received: from swdev19.tidalnetworks.net ([172.16.1.134]) by tidalnetworks.net over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 31 Oct 2008 17:29:24 -0700 Message-ID: <490BA2E5.8010309@consentry.com> Date: Fri, 31 Oct 2008 17:29:25 -0700 From: Mike Ditto User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: Jochen Friedrich , linuxppc-dev@ozlabs.org, linux-i2c@vger.kernel.org Subject: [PATCH] i2c-cpm: Detect and report NAK right away instead of timing out. X-OriginalArrivalTime: 01 Nov 2008 00:29:24.0307 (UTC) FILETIME=[E4106230:01C93BB8] X-TM-AS-Product-Ver: SMEX-7.5.0.1243-5.5.1027-16252.003 X-TM-AS-Result: No--3.250100-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Make the driver report an ENXIO error immediately upon NAK instead of waiting for another interrupt and getting a timeout. Signed-off-by: Mike Ditto Acked-by: Jochen Friedrich --- When reading from a device that is not present or declines to respond to, e.g., a non-existent register address, CPM immediately reports a NAK condition in the TxBD, but the driver kept waiting until a timeout, which takes 1 second and causes an ugly console error message. Index: linux/drivers/i2c/busses/i2c-cpm.c =================================================================== retrieving revision 1.3 diff -u -p -r1.3 i2c-cpm.c --- linux/drivers/i2c/busses/i2c-cpm.c 31 Oct 2008 06:36:08 -0000 1.3 +++ linux/drivers/i2c/busses/i2c-cpm.c 1 Nov 2008 00:12:45 -0000 @@ -369,6 +369,7 @@ static int cpm_i2c_xfer(struct i2c_adapt pmsg = &msgs[tptr]; if (pmsg->flags & I2C_M_RD) ret = wait_event_interruptible_timeout(cpm->i2c_wait, + (in_be16(&tbdf[tptr].cbd_sc) & BD_SC_NAK) || !(in_be16(&rbdf[rptr].cbd_sc) & BD_SC_EMPTY), 1 * HZ); else