From patchwork Wed Dec 16 14:02:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shishkin X-Patchwork-Id: 68367 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 nBI4ixoJ005715 for ; Fri, 18 Dec 2009 04:46:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934032AbZLPOFM (ORCPT ); Wed, 16 Dec 2009 09:05:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934023AbZLPOFK (ORCPT ); Wed, 16 Dec 2009 09:05:10 -0500 Received: from smtp.nokia.com ([192.100.105.134]:39298 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934021AbZLPOFI (ORCPT ); Wed, 16 Dec 2009 09:05:08 -0500 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nBGE4n4V030940; Wed, 16 Dec 2009 08:04:58 -0600 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 16 Dec 2009 16:03:05 +0200 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 16 Dec 2009 16:03:04 +0200 Received: from esdhcp04087 (esdhcp041145.research.nokia.com [172.21.41.145]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nBGE33XB030785 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Wed, 16 Dec 2009 16:03:03 +0200 Received: from ash by esdhcp04087 with local (Exim 4.69) (envelope-from ) id 1NKuT1-0008QE-0L; Wed, 16 Dec 2009 16:03:03 +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 16:02:24 +0200 Message-Id: <1260972144-31593-3-git-send-email-virtuoso@slind.org> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1260972144-31593-2-git-send-email-virtuoso@slind.org> References: <1260972144-31593-1-git-send-email-virtuoso@slind.org> <1260972144-31593-2-git-send-email-virtuoso@slind.org> X-OriginalArrivalTime: 16 Dec 2009 14:03:04.0870 (UTC) FILETIME=[7CC09C60:01CA7E58] 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; }