Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp401870ybd; Tue, 25 Jun 2019 23:48:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwj8u50AJ/M76ybAU9DHGC9Xmhusuhg/A81FaLt6AKXap6otFpwjPBKuQ16s8nVtgtGI1/C X-Received: by 2002:a17:902:7791:: with SMTP id o17mr3372042pll.162.1561531732309; Tue, 25 Jun 2019 23:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561531732; cv=none; d=google.com; s=arc-20160816; b=EDLvbREJ7FWZct+k4z1QewNIAjDeS7Wp7IvFCZNqo3qzsEr2ysP+YIjW0Fs4BrnbEE 2InJbuA8g9WGjwp56QsTDaKznvT7DlLifMX/OIN5GP6A/ryoTAi950nvME8I8OXmV2zy CD64Jvb66fgqRBcIKsHT1juA43DDi2Vm2yeI1WgsfQfSFhi/X0bG/Mz5VK7Xh9KQyhYv SRRU/cSVXRNzEw9uIu798vYjA/1/GITVP9Y+yAcf2+IC2tIv9mx5iWYg93bLRiEGBc7p mBrZO0EDY9LzUHi1KtIg4YTTpLbPwEOfpmtROusgowOb4Fk8IJymTym5y8dRTok2IOzM Tg1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=rc3kclh0N9d2zwhX6x7fkZL7c3GKF7R2RmFTciis8l4=; b=qxsLpE1Ofv0FbvsrcELgd0+kTnPW1l3LSKXR8GG3JRWUfr2vvE7XVGNXHzKYrQhpJb mEfsioJZiPBX7Rm/zhvL1YcvRCD7BKozmlHLEiufRZncNofxbchPi7FDGtIo1jCpsoeH w2gcv7BHqLvu87v6JkvEKBQVpRMVTMjwbxB3iUIeWIW0wLvPey0p5gXpw3ZA0MVY4bHo dCEBusB1DvEFBj71EDTEngbsW2r7SyX8FPdnYeiN8MnYgIxfhrLSe254FCQ56De4oDJ/ CNXzUWs0+vvRibojowIUAlOENI10jP5FLke0h2VlpGgoAjK+QT+i3zkrg80HMNFQwB6J oByA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si16771586pfi.211.2019.06.25.23.48.35; Tue, 25 Jun 2019 23:48:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726462AbfFZGsN (ORCPT + 99 others); Wed, 26 Jun 2019 02:48:13 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34632 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbfFZGsN (ORCPT ); Wed, 26 Jun 2019 02:48:13 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 55B34267743; Wed, 26 Jun 2019 07:48:11 +0100 (BST) Date: Wed, 26 Jun 2019 08:48:07 +0200 From: Boris Brezillon To: Naga Sureshkumar Relli Cc: miquel.raynal@bootlin.com, helmut.grohne@intenta.de, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, vigneshr@ti.com, bbrezillon@kernel.org, yamada.masahiro@socionext.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [LINUX PATCH v17 1/2] mtd: rawnand: nand_micron: Do not over write driver's read_page()/write_page() Message-ID: <20190626084807.3f06e718@collabora.com> In-Reply-To: <20190625044630.31717-1-naga.sureshkumar.relli@xilinx.com> References: <20190625044630.31717-1-naga.sureshkumar.relli@xilinx.com> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 24 Jun 2019 22:46:29 -0600 Naga Sureshkumar Relli wrote: > Add check before assigning chip->ecc.read_page() and chip->ecc.write_page() > > Signed-off-by: Naga Sureshkumar Relli > --- > drivers/mtd/nand/raw/nand_micron.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/raw/nand_micron.c b/drivers/mtd/nand/raw/nand_micron.c > index cbd4f09ac178..565f2696c747 100644 > --- a/drivers/mtd/nand/raw/nand_micron.c > +++ b/drivers/mtd/nand/raw/nand_micron.c > @@ -500,8 +500,11 @@ static int micron_nand_init(struct nand_chip *chip) > chip->ecc.size = 512; > chip->ecc.strength = chip->base.eccreq.strength; > chip->ecc.algo = NAND_ECC_BCH; > - chip->ecc.read_page = micron_nand_read_page_on_die_ecc; > - chip->ecc.write_page = micron_nand_write_page_on_die_ecc; > + if (!chip->ecc.read_page) > + chip->ecc.read_page = micron_nand_read_page_on_die_ecc; > + > + if (!chip->ecc.write_page) > + chip->ecc.write_page = micron_nand_write_page_on_die_ecc; That's wrong, if you don't want on-die ECC to be used, simply don't set nand-ecc-mode to "on-die". > > if (ondie == MICRON_ON_DIE_MANDATORY) { > chip->ecc.read_page_raw = nand_read_page_raw_notsupp;