From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755172AbdCGM3N (ORCPT ); Tue, 7 Mar 2017 07:29:13 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:55469 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755153AbdCGM2n (ORCPT ); Tue, 7 Mar 2017 07:28:43 -0500 Date: Tue, 7 Mar 2017 12:40:34 +0100 From: Boris Brezillon To: Masahiro Yamada Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse , Cyrille Pitchen Subject: Re: [PATCH] mtd: nand: fix write accessor sanity checks Message-ID: <20170307124034.59b5b763@bbrezillon> In-Reply-To: <1488885839-18470-1-git-send-email-yamada.masahiro@socionext.com> References: <1488885839-18470-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Mar 2017 20:23:59 +0900 Masahiro Yamada wrote: > If the higher level accessor chip->write_page() is implemented, > ecc->write_page() and ecc->write_page_raw() are not required. I'm about to remove the chip->write_page() hook [1], I hope you're not planning to use it. [1]https://patchwork.ozlabs.org/patch/729966/ > > Signed-off-by: Masahiro Yamada > --- > > drivers/mtd/nand/nand_base.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > index a3c0f47..c32e700 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -4585,11 +4585,12 @@ static bool invalid_ecc_page_accessors(struct nand_chip *chip) > * default helpers are not suitable when the core does not > * send the READ0/PAGEPROG commands. > */ > - return (!ecc->read_page || !ecc->write_page || > - !ecc->read_page_raw || !ecc->write_page_raw || > + return !ecc->read_page || !ecc->read_page_raw || > (NAND_HAS_SUBPAGE_READ(chip) && !ecc->read_subpage) || > - (NAND_HAS_SUBPAGE_WRITE(chip) && !ecc->write_subpage && > - ecc->hwctl && ecc->calculate)); > + (!chip->write_page && > + (!ecc->write_page || !ecc->write_page_raw || > + (NAND_HAS_SUBPAGE_WRITE(chip) && !ecc->write_subpage && > + ecc->hwctl && ecc->calculate))); > } > > /** > @@ -4699,8 +4700,9 @@ int nand_scan_tail(struct mtd_info *mtd) > if ((!ecc->calculate || !ecc->correct || !ecc->hwctl) && > (!ecc->read_page || > ecc->read_page == nand_read_page_hwecc || > - !ecc->write_page || > - ecc->write_page == nand_write_page_hwecc)) { > + (!chip->write_page && > + (!ecc->write_page || > + ecc->write_page == nand_write_page_hwecc)))) { > WARN(1, "No ECC functions supplied; hardware ECC not possible\n"); > ret = -EINVAL; > goto err_free;