From patchwork Wed Dec 16 13:46:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shishkin X-Patchwork-Id: 68363 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBI4ixoD005715 for ; Fri, 18 Dec 2009 04:46:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756174AbZLPNsU (ORCPT ); Wed, 16 Dec 2009 08:48:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756201AbZLPNsT (ORCPT ); Wed, 16 Dec 2009 08:48:19 -0500 Received: from smtp.nokia.com ([192.100.105.134]:38138 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756106AbZLPNsS (ORCPT ); Wed, 16 Dec 2009 08:48:18 -0500 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nBGDlpH3016526; Wed, 16 Dec 2009 07:48:06 -0600 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 16 Dec 2009 15:46:59 +0200 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 16 Dec 2009 15:46:58 +0200 Received: from esdhcp04087 (esdhcp041145.research.nokia.com [172.21.41.145]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nBGDksTH006671 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Wed, 16 Dec 2009 15:46:56 +0200 Received: from ash by esdhcp04087 with local (Exim 4.69) (envelope-from ) id 1NKuDO-0007Rr-2E; Wed, 16 Dec 2009 15:46:54 +0200 From: Alexander Shishkin To: ben-linux@fluff.org Cc: linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, Alexander Shishkin Subject: [PATCH 2/2] omap i2c: add a timeout to the busy waiting Date: Wed, 16 Dec 2009 15:46:38 +0200 Message-Id: <1260971198-28549-1-git-send-email-virtuoso@slind.org> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1260970986-26613-3-git-send-email-virtuoso@slind.org> References: <1260970986-26613-3-git-send-email-virtuoso@slind.org> X-OriginalArrivalTime: 16 Dec 2009 13:46:59.0052 (UTC) FILETIME=[3D147AC0:01CA7E56] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index ad8242a..b474c20 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -678,7 +678,9 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id) */ static int omap3430_workaround(struct omap_i2c_dev *dev, u16 *stat, int *err) { - while (!(*stat & OMAP_I2C_STAT_XUDF)) { + unsigned long timeout = 10000; + + while (!(*stat & OMAP_I2C_STAT_XUDF && --timeout)) { if (*stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) { omap_i2c_ack_stat(dev, *stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); @@ -689,6 +691,9 @@ static int omap3430_workaround(struct omap_i2c_dev *dev, u16 *stat, int *err) *stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); } + if (!timeout) + dev_err(dev->dev, "timeout waiting on XUDF bit\n"); + return 0; }