From patchwork Fri Jun 29 10:13:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 1131121 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 68682DFF34 for ; Fri, 29 Jun 2012 10:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753614Ab2F2KOF (ORCPT ); Fri, 29 Jun 2012 06:14:05 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:48533 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753448Ab2F2KOE (ORCPT ); Fri, 29 Jun 2012 06:14:04 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q5TADnDb027295; Fri, 29 Jun 2012 05:13:50 -0500 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q5TADm1F023361; Fri, 29 Jun 2012 15:43:49 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Fri, 29 Jun 2012 15:43:48 +0530 Received: from ula0393217.india.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q5TADivj027416; Fri, 29 Jun 2012 15:43:48 +0530 From: Shubhrajyoti D To: CC: , , , , , Felipe Balbi , Shubhrajyoti D Subject: [PATCHv3 02/17] i2c: omap: simplify num_bytes handling Date: Fri, 29 Jun 2012 15:43:22 +0530 Message-ID: <1340964817-8599-3-git-send-email-shubhrajyoti@ti.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1340964817-8599-1-git-send-email-shubhrajyoti@ti.com> References: <1340964817-8599-1-git-send-email-shubhrajyoti@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Felipe Balbi trivial patch, no functional changes If the fifo is disabled or fifo_size is 0 the num_bytes is set to 1. Else it is set to fifo_size or in case of a draining interrupt the remaining bytes in the buff stat. So the zero check is redundant and can be safely optimised. Signed-off-by: Felipe Balbi Reviewed-by : Santosh Shilimkar Signed-off-by: Shubhrajyoti D --- drivers/i2c/busses/i2c-omap.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 7ad4efd..1df2bc9 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -831,8 +831,7 @@ complete: OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F; } - while (num_bytes) { - num_bytes--; + while (num_bytes--) { w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG); if (dev->buf_len) { *dev->buf++ = w; @@ -874,8 +873,7 @@ complete: OMAP_I2C_BUFSTAT_REG) & 0x3F; } - while (num_bytes) { - num_bytes--; + while (num_bytes--) { w = 0; if (dev->buf_len) { w = *dev->buf++;