From patchwork Sun Apr 28 20:28:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 332 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8CC073F08F for ; Sun, 28 Apr 2019 22:29:46 +0200 (CEST) Received: by mail-pg1-f197.google.com with SMTP id e14sf6071766pgg.12 for ; Sun, 28 Apr 2019 13:29:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1556483385; cv=pass; d=google.com; s=arc-20160816; b=ay+Y5Cj9aXd3ZOCUNYGcg4KVZgs9ImRFkDK2zEjW9N7pygODij3bKlbtOvDILRfG0P riCwWitI82aoyIyoJC8CsPULIo27HR79LBmACpALak9BqW151jPHJNPFanHwmauBl8gY Fmk0/4KmfKT9zib8fFgxae+8vBRQMvTFOopI67Z1ofk7HAQdZVgclL9ok+L664Hl0qya 7nvhcwYCAO6qh43vuVVQJ6yHfB60xl4Did5hIxCaIBi0oZ9/BdW8j/JFIQ6b5fOigPeg zsoq1Jh9Xt+yVDrFXp2Y+jdR10xDjncwtCTpo5hIbrAtOvqC55aY4ir13idZabZlZkmQ 29lA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=aEyHCEdb0p2Ye0lZALO5gPq7IPNfe6qmLpOdl7p7iNo=; b=KXE7mGqF8wnAG/25kDzGXJCfac94VAxv1lTQZ2MQXrbUhsIfax0ZUUUiRVPEvS/ynp 95CKP3Na/Nm0pd01jgieHWZKsp5uboBaNo4ARzAPzFmi3GPgEqjFBw0NhuBwogUwbbEz mhMBguYfUvySjkCoXixEriSxy6MdtoDVLmspycL4ThMkbcgar+uZ2JVYFCZDIbA4fmBB wYpPIo+Fyl4PS0P7qWJMUN8e5pI5spVq08u/Eg48qRSOXpBJl54XuBBvC2NX0kDIvvdW O3HPQ6Ztx4duLxDu9eM0uOJ+bn7hHtkMF4yKGqg1s/FjyMuxDqAGqjFoK2bFrjPhxFO7 tCYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Waoj0AbG; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=aEyHCEdb0p2Ye0lZALO5gPq7IPNfe6qmLpOdl7p7iNo=; b=OszTaZsxoHZI6rhSZHktuCYSSaz0HL6gROTbjVTVVyKda027/+b9ywj9IAHI8nZ0o2 lGbfYUvyZxsnBGSDxkQkM6A07pFcMd1DC1qXmQMHmmQcTDUd2h7XWYbt5KHomrI5lT3R Rfgvulwj6lxZqcT+k7zNpoc5IaSIgDT2+Ld6E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=aEyHCEdb0p2Ye0lZALO5gPq7IPNfe6qmLpOdl7p7iNo=; b=cabs+mw2WBcdqfOFYfeydZMpg/bXjgDvgH3G2Et7UOqbOWRsdHE5+wGhYjpkynX54m FXG2qf5qXblE4peZ3K3l5BbxlaCX7Ejy1blPLRtacrRdE7GqbsUGcIeWnmpgYBgh634S HX/6jv4Vk6wKVNs6iKdhDrql36nHnuZ1UIAvde1EqzoCOV2IMgOXCvGqzWpwoToyHpdB Jm2ZTaHJi/Vu+fWXcaaSx9+UUHdYQxwLyDQPSaCAk5Pje1BneYQNFwQEORSyfUHdTvx3 JML93fQFMk9uQ9Juf5YU94o75UR7ZhE2xgsHKfHqe8HnEnNfBTGXkyRo62WuR7IrJn4m RNiA== X-Gm-Message-State: APjAAAXq0D4HcZzZrb9OTCHNARf08UuvJciE7ks7fmH4Yw25PJh1Rzrx kEJC7fRXvLbhvDp7qFxOg9gvmitF X-Google-Smtp-Source: APXvYqxLA9LFdKpALqcFkCoGyaYsLs/4CY8IZhWvrSdvwJblYowB5HlEEr8j4ZImdcsQ06HvVXO1Aw== X-Received: by 2002:a63:521c:: with SMTP id g28mr54859437pgb.431.1556483385373; Sun, 28 Apr 2019 13:29:45 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:8287:: with SMTP id s7ls38205pfm.7.gmail; Sun, 28 Apr 2019 13:29:45 -0700 (PDT) X-Received: by 2002:a62:ed16:: with SMTP id u22mr58501143pfh.47.1556483385005; Sun, 28 Apr 2019 13:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556483385; cv=none; d=google.com; s=arc-20160816; b=fRLlgaG0QB/ZC/gl4NTplGfJ96P66zayf3ufsBs52I2oIW65vNubRLxCTG7RV7Kldv bgRFdmzbXhaSwAAs7oCJTysd8Gx4Rx38iNiwQteaq+klTmUIxFOUeS1MxEwsn9mymvJe 7XaNKcyYtNm/lAGFWMSjj1XVgkHluT8iCXOCosbicYRbCkFSyTnBMcL83xM4lHdH8fj6 y8FcUVLU5XSu4PZWbzYgXRozCFZHblDcOAvg8LjEJjOWkQBGGcatj+E8BwVU/rc9FHyN sViU0HDuNn/Lgz+7f/zFswcNdIikpOuyVgNa8Xq35ScWx9t7Z8yIwWSWKKn+oBLXcsVp K45Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=duQcG3hEbT6ithd7O9rAGFAiDOa0nOfhdjNb0drRc+E=; b=uSM8pK08ehA26U1S8vW+GDSBB9MhuEqJK6pYG77nnf36uFwvzTpjN17OdRzy1H8iZQ yKq8FAwT/zJ4fXS2k+/I+Uq8UtkMzoByEml1jnL1jhjs3mfBCdX/mNcHAZIXgWH5XZEg YxTdWUIEdDbGINLth9Oyn0DsAi+F7GiQeQGmwmI7/80aqsXyD9l9gz3AlQI1DiJ3VI1S b8pALU/JNQ8My31kA/e5uOWG2jjfOe+S0CYEfNwdj0RtEerGBGDN8GHTER7cGrgE4LxV reYPeCnj/SFvbi/6ktn+hRS1FxrUm1SzLRbc8QRU/JlWj8U8oyhdH8NQ+TZ64QNHsYhy xp0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Waoj0AbG; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 30sor28934076pgo.39.2019.04.28.13.29.44 for (Google Transport Security); Sun, 28 Apr 2019 13:29:44 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a65:644e:: with SMTP id s14mr2431391pgv.290.1556483384743; Sun, 28 Apr 2019 13:29:44 -0700 (PDT) Received: from localhost.localdomain ([115.97.185.144]) by smtp.gmail.com with ESMTPSA id x66sm68841439pfb.78.2019.04.28.13.29.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 13:29:44 -0700 (PDT) From: Jagan Teki To: Heiko Schocher , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Mario Six Subject: [PATCH v2 16/19] spi: mpc8xxx: Fix if check Date: Mon, 29 Apr 2019 01:58:51 +0530 Message-Id: <20190428202854.8590-17-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190428202854.8590-1-jagan@amarulasolutions.com> References: <20190428202854.8590-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Waoj0AbG; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mario Six Decreasing the bit length and increasing the write data pointer should be done when there are more than 32 bit of data, not 16 bit. This did not produce incorrect behavior, because the only time where the two checks produce different outcomes is the case of 16 < bitlen < 32, and in this case the subsequent transmission is the last one regardless, hence the additional bit length decrease and write data pointer increase has no effect anyway. Still, the correct check is the check for "bitlen > 32", so correct this behavior. Signed-off-by: Mario Six --- drivers/spi/mpc8xxx_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index 1e7c0144c2..e09e91c8e9 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -132,7 +132,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din, /* Shift data so it's msb-justified */ tmpdout = *(u32 *)dout >> (32 - xfer_bitlen); - if (bitlen > 16) { + if (bitlen > 32) { /* Set up the next iteration if sending > 32 bits */ bitlen -= 32; dout += 4;