From patchwork Sat Aug 16 01:28:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 380450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 93573140097 for ; Sat, 16 Aug 2014 11:30:32 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XISo3-0006wP-0g; Sat, 16 Aug 2014 01:29:19 +0000 Received: from mail-pd0-x22c.google.com ([2607:f8b0:400e:c02::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XISo1-0006uS-1Z for linux-mtd@lists.infradead.org; Sat, 16 Aug 2014 01:29:17 +0000 Received: by mail-pd0-f172.google.com with SMTP id y13so4188012pdi.31 for ; Fri, 15 Aug 2014 18:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=xGH2JVO+VlsDFyCay3i0ToW2Pvbs6u/jneNpNavlJWY=; b=V+9s7ApYwPJtjmbY8PSctCTWAohobClBFpklaSY2dhr4niMw0XmNGzlH9xzq34W66z nStCqKLXw+IVDJtE32UK5LxXeDd+Ca/nhT8a5apaTzLUFabCNF94qLfJhwpOy07P0U33 cCbVq1sl4qdMDzVc/g6BwQamN5XnPnb2dJJc9q3wCUdIl1jIF3KIl4zBbw25MLbxZqtA qrJwEt2RInb9ljGJRF1Ojgt14dKnYoUVyG8bwAz+svFRyycK67VrfevDSDDYMFeGQ4EZ eDvkajmphCgvEKuAQ/pvGBOqq0GFRXW59Ka4XR/lMH2ukKMEqFB4JcMQaMzzXr+JznP9 9P1A== X-Received: by 10.70.88.39 with SMTP id bd7mr22470751pdb.68.1408152535794; Fri, 15 Aug 2014 18:28:55 -0700 (PDT) Received: from ld-irv-0074 (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id bl12sm32719990pac.44.2014.08.15.18.28.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 Aug 2014 18:28:55 -0700 (PDT) Date: Fri, 15 Aug 2014 18:28:52 -0700 From: Brian Norris To: Aaron Wu Subject: Re: [PATCH] [mtd] gpio_flash: fix the bug in handling gpio flash read/write when offset + len from mtd exceeds the window size Message-ID: <20140816012852.GI18411@ld-irv-0074> References: <1407383029-24290-1-git-send-email-Aaron.wu@analog.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1407383029-24290-1-git-send-email-Aaron.wu@analog.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140815_182917_129814_D367BB07 X-CRM114-Status: GOOD ( 17.65 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c02:0:0:0:22c listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Cc: dwmw2@infradead.org, sonic.zhang@analog.com, linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Thu, Aug 07, 2014 at 11:43:49AM +0800, Aaron Wu wrote: > Signed-off-by: Aaron Wu > > fix the bug in handling gpio flash read/write when offset + len > from mtd exceeds the window size Typically, you should have the commit message comments before the 'Signed-off-by'. > --- > drivers/mtd/maps/gpio-addr-flash.c | 43 ++++++++++++++++++++++++------------ > 1 file changed, 29 insertions(+), 14 deletions(-) > > diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c > index a4c477b..947631a 100644 > --- a/drivers/mtd/maps/gpio-addr-flash.c > +++ b/drivers/mtd/maps/gpio-addr-flash.c > @@ -99,22 +99,29 @@ static map_word gf_read(struct map_info *map, unsigned long ofs) > * @from: flash offset to copy from > * @len: how much to copy > * > - * We rely on the MTD layer to chunk up copies such that a single request here > - * will not cross a window size. This allows us to only wiggle the GPIOs once > - * before falling back to a normal memcpy. Reading the higher layer code shows > - * that this is indeed the case, but add a BUG_ON() to future proof. > + *Toggle the correct GPIO according to @from to enable the right flash bank, > + *still the read offset plus len may execceds the actual Window size,when > + *this happnes, reverts the value for multiple read until all data is read. > */ The spacing and wording is a little off, so I reworded this. Queued to l2-mtd.git/next, with the following diff applied: Thanks, Brian diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 947631a329f7..2fb346091af2 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c @@ -99,9 +99,8 @@ static map_word gf_read(struct map_info *map, unsigned long ofs) * @from: flash offset to copy from * @len: how much to copy * - *Toggle the correct GPIO according to @from to enable the right flash bank, - *still the read offset plus len may execceds the actual Window size,when - *this happnes, reverts the value for multiple read until all data is read. + * The "from" region may straddle more than one window, so toggle the GPIOs for + * each window region before reading its data. */ static void gf_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) {