From patchwork Sun Sep 14 20:14:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 389129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7A0621400D5 for ; Mon, 15 Sep 2014 07:10:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752906AbaINVKL (ORCPT ); Sun, 14 Sep 2014 17:10:11 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:57142 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752866AbaINVKK (ORCPT ); Sun, 14 Sep 2014 17:10:10 -0400 Received: by mail-wg0-f50.google.com with SMTP id x13so2988686wgg.33 for ; Sun, 14 Sep 2014 14:10:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=2cz8jeB+kRLrnDoJIpqtHku3tXheb776NgwZGwQgPyE=; b=HfIVEmzCbTaYiaStKvLjCKeESwbkl9TbsTdvfddo2VgAb4GArI5PXbL1U+3IF1OGKO 88kuDoD3za8qUfpuWQa1iK42Gfjog7gibHMtOSztm2f11JGhItRuVG+DJ/LpnFU6zVx2 shKCA/5OhhhoMxlaRRY+QVHJoDeHwMzCO3PLlhfOVo0XFNUcs64P8n0EcM/xKVX91GOc liOON7lUmhA/dydze/lnQ2P8RlF8QHAkp+9z3ITKoeuKo3394Z82wQGExlSkZm/BuNfL 3wyVm49AyNNrU3w+859Mf7lsLt34Tt3sy/C1eChyTm3NwBuqxL6H6MfHQYYyoqAS80ts qNew== X-Gm-Message-State: ALoCoQkvmRPv2Uwn4CNyp6zrlTsKGY6n1sjjqsyu6i/ME4GJa9xfi5N5X7Qp6YSbakqkX+RygAcj X-Received: by 10.180.19.233 with SMTP id i9mr18260280wie.17.1410729009560; Sun, 14 Sep 2014 14:10:09 -0700 (PDT) Received: from wasted.cogentembedded.com (80.178.206.101.adsl.012.net.il. [80.178.206.101]) by mx.google.com with ESMTPSA id ju1sm12512620wjc.1.2014.09.14.14.10.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Sep 2014 14:10:08 -0700 (PDT) From: Sergei Shtylyov To: wsa@the-dreams.de, linux-i2c@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH v2 1/3] i2c-rcar: simplify check for last message Date: Mon, 15 Sep 2014 00:14:14 +0400 Message-ID: <1757193.42K2JNstnx@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.13.3 (Linux/3.15.10-201.fc20.x86_64; KDE/4.13.3; x86_64; ; ) In-Reply-To: <2245366.q99HVYG3pL@wasted.cogentembedded.com> References: <2245366.q99HVYG3pL@wasted.cogentembedded.com> MIME-Version: 1.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org rcar_i2c_master_xfer() needlessly compares the message pointers (using indirect addressing) in order to detect the last I2C message, while it's enough to only compare the message indexes. Signed-off-by: Sergei Shtylyov --- Changes in version 2: - refreshed patch. drivers/i2c/busses/i2c-rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/drivers/i2c/busses/i2c-rcar.c =================================================================== --- linux.orig/drivers/i2c/busses/i2c-rcar.c +++ linux/drivers/i2c/busses/i2c-rcar.c @@ -453,7 +453,7 @@ static int rcar_i2c_master_xfer(struct i priv->msg = &msgs[i]; priv->pos = 0; priv->flags = 0; - if (priv->msg == &msgs[num - 1]) + if (i == num - 1) rcar_i2c_flags_set(priv, ID_LAST_MSG); ret = rcar_i2c_prepare_msg(priv);