Message ID | 20190205140759.2360-3-ikegami_to@yahoo.co.jp |
---|---|
State | Superseded |
Delegated to: | Vignesh R |
Headers | show
Return-Path: <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=yahoo.co.jp Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="amcX1CQf"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=yahoo.co.jp header.i=@yahoo.co.jp header.b="WnAjqS4c"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43v5zT4ypfz9s4Z for <incoming@patchwork.ozlabs.org>; Wed, 6 Feb 2019 01:09:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=kZY/Ux8vd9yaDMPdShftcs3VNWun1HSMb2K1FrUyq5U=; b=amcX1CQfrXUnugNKgNLng43nPh /qM7390I1nlKG/cCxc5vCm+lu8rPGJc5bHCgE7vrUEDMzlMF9RqDqYFor5edRhxwatT7K4JpzSsgp FMRyBE6wtSwyy0rj7OI0cdStEE3ZTHq5RVydPMPopoR7glBaeQ1JHRvh1n8pkiYdD1lcW+9QFZ+Yt B04OcCe4ljVXqTV4IppmMYYhYak1ey714TMKJkPNJCE89hrrR3lzVmzNhqwM5mC/bx4RL7Ey+0QHU f0raqjREnqAsZVymB9ll+anClRJ7jzYmND5jmge+1S6OhrPUNMjFdv7uPqwaYx2/XFT7foxVfIJ58 agmRFmDw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gr1PL-0006np-Vj; Tue, 05 Feb 2019 14:09:03 +0000 Received: from nh603-vm5.bullet.mail.ssk.yahoo.co.jp ([182.22.90.46]) by bombadil.infradead.org with smtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gr1PH-0006lS-Bj for linux-mtd@lists.infradead.org; Tue, 05 Feb 2019 14:09:02 +0000 Received: from [182.22.66.103] by nh603.bullet.mail.ssk.yahoo.co.jp with NNFMP; 05 Feb 2019 14:08:55 -0000 Received: from [182.22.91.132] by t601.bullet.mail.ssk.yahoo.co.jp with NNFMP; 05 Feb 2019 14:08:55 -0000 Received: from [127.0.0.1] by omp605.mail.ssk.yahoo.co.jp with NNFMP; 05 Feb 2019 14:08:55 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 613366.19131.bm@omp605.mail.ssk.yahoo.co.jp Received: (qmail 45588 invoked by alias); 5 Feb 2019 14:08:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.jp; s=yj20110701; t=1549375735; bh=GWQfPqv0aZCsCVXewgkoEkzJb3RofaMP6Igg+afbTZw=; h=Received:X-YMail-JAS:X-Apparently-From:X-YMail-OSG:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=WnAjqS4ckGRya/hEE5WbZ/4kIswIiM484x2ij2KnKu22/MSCOirUDSzxJpS3n52PJM1ZRgBwMyRH+SdkFQ7V/YvenMexjPiheOnXsT3SFBISOHdUfKSm9Zp/IWZ8+U7+zFpAsBfijuXf83x5bF33tAgDS/4gKIvRGD5dC0YQjBk= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Received:X-YMail-JAS:X-Apparently-From:X-YMail-OSG:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=QDmiixyEbFmLUQ85fVy47ch4OXropz3EjvvUvAxcs2tT9izdssGleLtSJTzX8hDgxy/h3sfUhJAc+krEFp0L8eqFhJ+wVLPdOLkJVnoqQAMqeRGx9MUIXfRiPJgcA+F4LGs2jRYK2/7dw0kuOZf4DZXC9JQE/Wz6NqFziu5lFPY= ; Received: from unknown (HELO localhost.localdomain) (106.72.39.32 with login) by smtp5006.mail.kks.ynwp.yahoo.co.jp with SMTP; 5 Feb 2019 14:08:54 -0000 X-YMail-JAS: yAzcHXUVM1l70vaPPPJiRSARrqFb_dkGKnmGHVREExTUoigRLv5SmqdsCLNXY1tE2NBOTSsDJNGwNgN7XT5.sSMqRRsDo4wK3uCONcoc.pSzxFD9.zOHEmIjpnmyq8lKW7munmR1bg-- X-Apparently-From: <ikegami_to@yahoo.co.jp> X-YMail-OSG: _COmcmYVM1mOnF571hC6g2MrGjsJEv7RLx8SXTm6ksEaKaH ZjLjEEbFF1W7T6536XBWYT0qsTP9b69gFrID.2AgACq4hzxamoJgK5mx4Awj d6fBbz8yoCuvBzf0.hr5i1Hq6PL_R9yof.n8TmBWDTv2CKwH6qDP0zn4vWMx G6F2ryZJ4ZD36q1kPU8Dy5LzuqMkqIVIrV3uKziiGfM30PR2geFPlaSvtT5n a6kr6Mg5z_p9EjFnkslHOonvlKqKW7EqT7Wtc1ymSFumvQINRq8GNfdl6ViG w2xIpfa6qezx7PzCfxNSODUZtDuzA2SEFa9WgVNsbW7np48tcjaY.mVL4QQR B6alDoJGCwjr.Ez3VSkahynMv7YclvxUCzk.jpsBRGrcDAhlKpFsTjk_W8KN dPUP6gvo6VgqjyHOmoa4Q2WNPIDOCVt.9jNRAnhCTcYtP..D3lGP57NkJjAm i1_CucYLQolxZRypsTA5q5UertenjtlP3Cqb.PGDv763kOE.0VoYI2f4yAiN w2p7eGq96ZGZWoLLpUVgRB3xT5mTu4tM2hKNCrlZs62Gv3jQx.HSXPcAutKK yP.EQaoHFFzSkVps2BwW3oxWOJWZoeAiIR9bfRyEcIqfYnPIt From: Tokunori Ikegami <ikegami_to@yahoo.co.jp> To: Boris Brezillon <bbrezillon@kernel.org> Subject: [PATCH v5 02/11] mtd: cfi_cmdset_0002: Remove chip_ready() from do_write_buffer() Date: Tue, 5 Feb 2019 23:07:50 +0900 Message-Id: <20190205140759.2360-3-ikegami_to@yahoo.co.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190205140759.2360-1-ikegami_to@yahoo.co.jp> References: <20190205140759.2360-1-ikegami_to@yahoo.co.jp> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190205_060859_779229_D6D28BB0 X-CRM114-Status: GOOD ( 15.59 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [182.22.90.46 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ikegami_to[at]yahoo.co.jp) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list <linux-mtd.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mtd/> List-Post: <mailto:linux-mtd@lists.infradead.org> List-Help: <mailto:linux-mtd-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe> Cc: stable@vger.kernel.org, Joakim Tjernlund <Joakim.Tjernlund@infinera.com>, Tokunori Ikegami <ikegami_to@yahoo.co.jp>, linux-mtd@lists.infradead.org, Chris Packham <chris.packham@alliedtelesis.co.nz>, Fabio Bettoni <fbettoni@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org> Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
mtd: cfi_cmdset_0002: Fix flash write issue for OpenWrt Project
|
expand
|
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 91a491b..ca9d5fa 100755 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -1878,14 +1878,14 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, continue; } - if (time_after(jiffies, timeo) && !chip_ready(map, adr)) - break; - if (chip_good(map, adr, datum)) { xip_enable(map, chip, adr); goto op_done; } + if (time_after(jiffies, timeo)) + break; + /* Latency issues. Drop the lock, wait a while and retry */ UDELAY(map, chip, adr, 1); }
It is enough to use chip_good() only so chip_ready() is not necessary. Since chip_good() is doing the same check chip_ready() is doing plus an extra check to make sure we end up with the data we wrote. For this change the order to check timeout also will be changed at same time. The order is not a hard requirement, it's just better to avoid the case where the data update happens just after the timeout has expired. This change actually a bux that it might cause an infinite loop. Since currently the infinite loop is only exited by the conditions below. 1. Timed out and not chip_ready() 2. chip_good() So if chip_ready() and not chip_good() the loop is not exited as infinite. Signed-off-by: Tokunori Ikegami <ikegami_to@yahoo.co.jp> Fixes: dfeae1073583d ("mtd: cfi_cmdset_0002: Change write buffer to check correct value") Reported-by: Przemyslaw Sobon <psobon@amazon.com> Cc: Fabio Bettoni <fbettoni@gmail.com> Co: Hauke Mehrtens <hauke@hauke-m.de> Co: Koen Vandeputte <koen.vandeputte@ncentric.com> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz> Cc: Joakim Tjernlund <Joakim.Tjernlund@infinera.com> Cc: linux-mtd@lists.infradead.org Cc: stable@vger.kernel.org --- Changes since v4: - Update the commit message about the infinite loop problem. Changes since v3: - Update the commit message for the comment. - Change the email address of Tokunori Ikegami to ikegami_to@yahoo.co.jp. Changes since v2: - None. Changes since v1: - None. drivers/mtd/chips/cfi_cmdset_0002.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)