From patchwork Thu Nov 18 10:04:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: samu.p.onkalo@nokia.com X-Patchwork-Id: 335491 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAIA576P012495 for ; Thu, 18 Nov 2010 10:05:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756492Ab0KRKEp (ORCPT ); Thu, 18 Nov 2010 05:04:45 -0500 Received: from smtp.nokia.com ([147.243.128.26]:29256 "EHLO mgw-da02.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756382Ab0KRKEm (ORCPT ); Thu, 18 Nov 2010 05:04:42 -0500 Received: from localhost.localdomain (4fid08082.nmp.nokia.com [172.22.211.11]) by mgw-da02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id oAIA4Kpr013056; Thu, 18 Nov 2010 12:04:21 +0200 From: Samu Onkalo To: ben-linux@fluff.org Cc: linux-i2c@vger.kernel.org, khilman@deeprootsystems.com, paul@pwsan.com, linux-omap@vger.kernel.org Subject: [PATCH] i2c-omap: Set latency requirements only once for several messages Date: Thu, 18 Nov 2010 12:04:20 +0200 Message-Id: <1290074660-2640-1-git-send-email-samu.p.onkalo@nokia.com> X-Mailer: git-send-email 1.6.0.4 X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 18 Nov 2010 10:05:08 +0000 (UTC) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b33c785..3e9323e 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -616,12 +616,8 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, * REVISIT: We should abort the transfer on signals, but the bus goes * into arbitration and we're currently unable to recover from it. */ - if (dev->set_mpu_wkup_lat != NULL) - dev->set_mpu_wkup_lat(dev->dev, dev->latency); r = wait_for_completion_timeout(&dev->cmd_complete, OMAP_I2C_TIMEOUT); - if (dev->set_mpu_wkup_lat != NULL) - dev->set_mpu_wkup_lat(dev->dev, -1); dev->buf_len = 0; if (r < 0) return r; @@ -672,12 +668,18 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) if (r < 0) goto out; + if (dev->set_mpu_wkup_lat != NULL) + dev->set_mpu_wkup_lat(dev->dev, dev->latency); + for (i = 0; i < num; i++) { r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1))); if (r != 0) break; } + if (dev->set_mpu_wkup_lat != NULL) + dev->set_mpu_wkup_lat(dev->dev, -1); + if (r == 0) r = num;