From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF55AC04A6B for ; Fri, 10 May 2019 13:37:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C13262089E for ; Fri, 10 May 2019 13:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727810AbfEJNhN (ORCPT ); Fri, 10 May 2019 09:37:13 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:38899 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727258AbfEJNhM (ORCPT ); Fri, 10 May 2019 09:37:12 -0400 X-Originating-IP: 90.88.28.253 Received: from windsurf.home (aaubervilliers-681-1-86-253.w90-88.abo.wanadoo.fr [90.88.28.253]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 939B11C001A; Fri, 10 May 2019 13:37:05 +0000 (UTC) Date: Fri, 10 May 2019 15:37:04 +0200 From: Thomas Petazzoni To: Mason Yang Cc: bbrezillon@kernel.org, marek.vasut@gmail.com, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, linux-mtd@lists.infradead.org, juliensu@mxic.com.tw Subject: Re: [PATCH v1] mtd: rawnand: Add Macronix NAND read retry support Message-ID: <20190510153704.33de9568@windsurf.home> In-Reply-To: <1557474062-4949-1-git-send-email-masonccyang@mxic.com.tw> References: <1557474062-4949-1-git-send-email-masonccyang@mxic.com.tw> Organization: Bootlin 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 Hello, Some purely cosmetic suggestions below. On Fri, 10 May 2019 15:41:02 +0800 Mason Yang wrote: > + if (ret) > + pr_err("set feature failed to read retry moded:%d\n", mode); I don't know what is the policy in the MTD/NAND subsystem, but shouldn't you be using dev_err() instead of pr_err() here to have a nice prefix for the message ? dev_err(&nand_to_mtd(chip)->dev, "set feature ..", mode); > +static void macronix_nand_onfi_init(struct nand_chip *chip) > +{ > + struct nand_parameters *p = &chip->parameters; > + > + if (p->onfi) { Change to: if (!p->onfi) return; This way the rest of the function can save one level of indentation. > + struct nand_onfi_vendor_macronix *mxic = > + (void *)p->onfi->vendor; > + > + if (mxic->reliability_func & MACRONIX_READ_RETRY_BIT) { Change to: if (mxic->reliability_func & MACRONIX_READ_RETRY_BIT == 0) return; And the rest of the function can save one level of indentation. > + chip->read_retries = MACRONIX_READ_RETRY_MODE + 1; > + chip->setup_read_retry = > + macronix_nand_setup_read_retry; > + if (p->supports_set_get_features) { > + set_bit(ONFI_FEATURE_ADDR_READ_RETRY, > + p->set_feature_list); > + set_bit(ONFI_FEATURE_ADDR_READ_RETRY, > + p->get_feature_list); > + } Which will require less wrapping in those lines that are already at the third indentation level. To me, it is also more logical: we exclude the cases we are not interested in and return early, and then if we are still in the case we are interested, we handle it. Best regards, Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com