Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp168652imm; Thu, 26 Jul 2018 16:15:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdf6BzCDcGkUgbevVX2lR96kCVGsdZ1UBhPi5xhOGYNyvnPDQL1yglfZAylKWROkBU5uCNt X-Received: by 2002:a62:ea05:: with SMTP id t5-v6mr4030730pfh.228.1532646912055; Thu, 26 Jul 2018 16:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532646912; cv=none; d=google.com; s=arc-20160816; b=L2bxtDhZTqjwqajfWw4mpE/gu9aRLl773Io/GebwzV/pN/0m526/dEmKim67XDanhh yiZxrMtjXlair+w+l+k+l/FUwhBqDf6NtTl96PKkDZaC2FIRwjhFTKuyAlGWXTW/nTjh NO2abtHnnf3yqup8c7dBYApSULFquLmkZdqmqLSQe1L5P7DKggO3aNIxwF2/t5HmmgZG wzcDKPLzKieTp+CfQc2K/FEPgL+PqI7/qpvqWcrpy8GMHQVcEL9yzfGhozbPjI2sNG9W EOgoihhFZcRk1NHNRcG+2Cr4Hx2vWgbwykO2U8V7Uzv4NseFg6rGcSAM+3Cly8oaREhD BnNg== 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:arc-authentication-results; bh=tacjXLYvD4ketcN3ESZjd48+Bk9aC1MossWQaRQ46+g=; b=D8BNQA8SPDaDDUaEk4UR2AQteVEMbEPuUJm5zqBoCCqp9ifetIElmAHFle8hdraLI6 7CEvNugVGtRaqmKtQO04hkx7CWgt+vVrjS2raS1v0NLChXB7jyjaJ3nxB0U2UCwOHslv Bp+XjAP2iiSofd5IttEdV19GkM/BU6IAB8RY/aFJ37Lf4xqtyaPBTcp8kqBPcT0CVoBd 0yNAbEv/93HpdEVXxmG8pO6lHtu8EC1jWTHSItXU+XaFntI4yWldOOpp3AvhNdNBBk6M LiZSfp6OnL6H4Is+Hpr7qOwx3GJsOFnANevM1pV8Eb9e809FV8ytuFzCmdRzsa46C4B2 /neg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4-v6si2063132plo.459.2018.07.26.16.14.51; Thu, 26 Jul 2018 16:15:12 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731630AbeG0Acv convert rfc822-to-8bit (ORCPT + 99 others); Thu, 26 Jul 2018 20:32:51 -0400 Received: from mail.bootlin.com ([62.4.15.54]:48615 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731231AbeG0Acu (ORCPT ); Thu, 26 Jul 2018 20:32:50 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 7C5C52082B; Fri, 27 Jul 2018 01:13:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from xps13 (unknown [91.224.148.103]) by mail.bootlin.com (Postfix) with ESMTPSA id A99BE20618; Fri, 27 Jul 2018 01:13:46 +0200 (CEST) Date: Fri, 27 Jul 2018 01:13:46 +0200 From: Miquel Raynal To: Boris Brezillon Cc: Alexandre Belloni , Mans Rullgard , Maxime Ripard , Stefan Agner , linux-kernel@vger.kernel.org, Masahiro Yamada , linux-mtd@lists.infradead.org, Kamal Dasu , Josh Wu , Marc Gonzalez , Marek Vasut , Chen-Yu Tsai , bcm-kernel-feedback-list@broadcom.com, Sylvain Lemieux , Wenyou Yang , Tudor Ambarus , Vladimir Zapolskiy , Harvey Hunt , linux-mediatek@lists.infradead.org, Matthias Brugger , Han Xu , Xiaolei Li , linux-arm-kernel@lists.infradead.org, Nicolas Ferre , Richard Weinberger , Brian Norris , David Woodhouse Subject: Re: [PATCH v4 27/35] mtd: rawnand: sm_common: convert driver to nand_scan_with_ids() Message-ID: <20180727011346.3931dbe9@xps13> In-Reply-To: <20180726210655.03eca681@bbrezillon> References: <20180720151527.16038-1-miquel.raynal@bootlin.com> <20180720151527.16038-28-miquel.raynal@bootlin.com> <20180722084432.61b579b1@bbrezillon> <20180726210655.03eca681@bbrezillon> Organization: Bootlin X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Boris, Boris Brezillon wrote on Thu, 26 Jul 2018 21:06:55 +0200: > On Sun, 22 Jul 2018 08:44:32 +0200 > Boris Brezillon wrote: > > > On Fri, 20 Jul 2018 17:15:19 +0200 > > Miquel Raynal wrote: > > > > > Two helpers have been added to the core to make ECC-related > > > configuration between the detection phase and the final NAND scan. Use > > > these hooks and convert the driver to just use nand_scan_with_ids() > > > (alternative to nand_scan() for passing a flash IDs table) instead of > > > both nand_scan_ident() and nand_scan_tail(). > > > > > > Signed-off-by: Miquel Raynal > > > > Reviewed-by: Boris Brezillon > > > > > --- > > > drivers/mtd/nand/raw/sm_common.c | 39 +++++++++++++++++++++++++-------------- > > > 1 file changed, 25 insertions(+), 14 deletions(-) > > > > > > diff --git a/drivers/mtd/nand/raw/sm_common.c b/drivers/mtd/nand/raw/sm_common.c > > > index 7f5044a79f01..d05e3f976a5e 100644 > > > --- a/drivers/mtd/nand/raw/sm_common.c > > > +++ b/drivers/mtd/nand/raw/sm_common.c > > > @@ -160,19 +160,9 @@ static struct nand_flash_dev nand_xd_flash_ids[] = { > > > {NULL} > > > }; > > > > > > -int sm_register_device(struct mtd_info *mtd, int smartmedia) > > > +static int sm_attach_chip(struct nand_chip *chip) > > > { > > > - struct nand_chip *chip = mtd_to_nand(mtd); > > > - int ret; > > > - > > > - chip->options |= NAND_SKIP_BBTSCAN; > > > - > > > - /* Scan for card properties */ > > > - ret = nand_scan_ident(mtd, 1, smartmedia ? > > > - nand_smartmedia_flash_ids : nand_xd_flash_ids); > > > - > > > - if (ret) > > > - return ret; > > > + struct mtd_info *mtd = nand_to_mtd(chip); > > > > > > /* Bad block marker position */ > > > chip->badblockpos = 0x05; > > > @@ -187,12 +177,33 @@ int sm_register_device(struct mtd_info *mtd, int smartmedia) > > > else > > > return -ENODEV; > > > > > > - ret = nand_scan_tail(mtd); > > > + return 0; > > > +} > > > > > > +static const struct nand_controller_ops sm_controller_ops = { > > > + .attach_chip = sm_attach_chip, > > > +}; > > > + > > > +int sm_register_device(struct mtd_info *mtd, int smartmedia) > > > +{ > > > + struct nand_chip *chip = mtd_to_nand(mtd); > > > + struct nand_flash_dev *flash_ids; > > > + int ret; > > > + > > > + chip->options |= NAND_SKIP_BBTSCAN; > > > + > > > + /* Scan for card properties */ > > > + chip->dummy_controller.ops = &sm_controller_ops; > > > + flash_ids = smartmedia ? nand_smartmedia_flash_ids : nand_xd_flash_ids; > > > + ret = nand_scan_with_ids(mtd, 1, flash_ids); > > > if (ret) > > > return ret; > > > > > > - return mtd_device_register(mtd, NULL, 0); > > > + ret = mtd_device_register(mtd, NULL, 0); > > > + if (ret) > > > + nand_release(mtd); > > Didn't notice that while reviewing, but it would have been better to > use nand_cleanup() and do this change separately. Indeed, will fix it. Miquèl