From patchwork Wed May 2 17:15:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 156510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 587D1B6FA8 for ; Thu, 3 May 2012 03:18:41 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SPdAz-0003CX-9w; Wed, 02 May 2012 17:17:17 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SPdA8-0002kK-4m for linux-mtd@lists.infradead.org; Wed, 02 May 2012 17:16:25 +0000 Received: by mail-pb0-f49.google.com with SMTP id rq13so1447731pbb.36 for ; Wed, 02 May 2012 10:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=w0+Nd1EAgT8zM9aelrZ/DuzB9VDsOSKdO3utj6kjEuY=; b=fBYKeUbtL38B5z7UR7DaZ+oJE/rjK1hRNfRYHw5TXj/yz4ZS1KEZD2vK1jrrFFIqoh NyE69JeOanXYgytGM3B/JMP2I1RBmRkQ/RSfmkhIVMF8rTBhacjL4RxRuCqRaFzD4/MT mfdsVsX/SQVpfhAbhsDzXXwDcBAaGzrRQvnEbN9jBbg/KorPQBw8TXtjZ1nEmxBaIDK+ HJOb4FX+cPzaTxNXPB66ThhTOk7lnTOGp5zSOgBPytAD1s3L7Tqkv2gwZFrKvtTEnOPc YiHFsbFR0y6KCBNK5nSja2kZf/qQyIjYuLbtYbAwFDJancwIVmXisEwKy7fR+Ws5SFVk Ml6A== Received: by 10.68.239.65 with SMTP id vq1mr838418pbc.117.1335978983886; Wed, 02 May 2012 10:16:23 -0700 (PDT) Received: from localhost.localdomain (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPS id mr6sm2484662pbb.29.2012.05.02.10.16.21 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 May 2012 10:16:22 -0700 (PDT) From: Brian Norris To: Subject: [PATCH v4 09/10] mtd: nand: utilize oob_required parameter Date: Wed, 2 May 2012 10:15:03 -0700 Message-Id: <1335978904-8005-10-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.5.4.2.g519b1 In-Reply-To: <1335978904-8005-1-git-send-email-computersforpeace@gmail.com> References: <1335978904-8005-1-git-send-email-computersforpeace@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 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 -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Brian Norris , David Woodhouse , Shmulik Ladkani , Artem Bityutskiy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Don't read/write OOB if the caller doesn't require it. Signed-off-by: Brian Norris --- v4 note: I think this patch is safe after killing autoincrement in nand_do_read_ops() drivers/mtd/nand/nand_base.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 464b742..14e9b32 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1075,7 +1075,8 @@ static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, uint8_t *buf, int oob_required, int page) { chip->read_buf(mtd, buf, mtd->writesize); - chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); + if (oob_required) + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); return 0; } @@ -1928,7 +1929,8 @@ static void nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf, int oob_required) { chip->write_buf(mtd, buf, mtd->writesize); - chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); + if (oob_required) + chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); } /**