Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2140878yba; Fri, 10 May 2019 06:57:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzsn7KHSwDoFDYz/RQpDWlT8Jpp4wrTjWxUeunPtKVSVZU2L8zS1Xy5uR6y5QNNgfRUfWcx X-Received: by 2002:a63:4c45:: with SMTP id m5mr13565599pgl.78.1557496634549; Fri, 10 May 2019 06:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557496634; cv=none; d=google.com; s=arc-20160816; b=jtj1u7n1SqXDPcLyksiHRV2hxIXU5Ax6e0RIvHCr9wjH4tJqmj4RmUvM5PlZaP5Klt TJeJ1Odca2whoaOwaZgqRgti54HLmSFiJFy1cSBv1Mhy83zmjhfnqbLoN/A/HFDa5nZi UweXHVdEYGhpn98S4v/ueiC3yVl2H4K+DXRCtvzEAPN7EMk1tw24YlBGN7rgRjPMBVaG n/Je5xm7jLy/fPixFtp79zTQ29iN3uvWbn3cAsJGNZ2cXlZxBNh8vABisIZeusI1CH5+ VnX2hakHBwoda5l2GwbqtTMMmVef6DSiqYQ6Qe31oIjyEKjyUxbxY3TaXH7PjrmxYeES snXw== 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=jlg30RBQ7tIbK4ES6fPuGuh+Pn6F64KsPjCLEy6QtHk=; b=b5GE/iwzV1Lu2ScGDV4DVY8aeGZYy/+I/dPMki/rst4bFFRfelebMFczIfrbY15iOy 2+4f61zd5clpi4bLz3rRnW5IoUxhH6wYg1QwRcu7FujB4cVFol6EuKBQpZYyo8d2VG6i RT1F1Ru9wf3vqizdpC2c0L8xQpw5AWsmibMYOTcm/Grx7xJQMc4zYJUi4eHzO4JVfSp5 sCSf1q7B6jqFGPMHhDhHZ9P4zue3oVrfWY7J3xNAsEYvMKppheVcuessw3RkT+EzbYwi lqSIzwnnJyGymC59Orz9UwBLbnRdBFifDXUtAxbJXFF4rQwM00lO/pROz8H8Z2s3KuDJ IURA== 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 1si8074858plz.45.2019.05.10.06.56.58; Fri, 10 May 2019 06:57:14 -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 S1727603AbfEJNxq convert rfc822-to-8bit (ORCPT + 99 others); Fri, 10 May 2019 09:53:46 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:54965 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727249AbfEJNxq (ORCPT ); Fri, 10 May 2019 09:53:46 -0400 X-Originating-IP: 90.88.28.253 Received: from xps13 (aaubervilliers-681-1-86-253.w90-88.abo.wanadoo.fr [90.88.28.253]) (Authenticated sender: miquel.raynal@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id D5D0A240011; Fri, 10 May 2019 13:53:41 +0000 (UTC) Date: Fri, 10 May 2019 15:53:40 +0200 From: Miquel Raynal To: Thomas Petazzoni Cc: Mason Yang , bbrezillon@kernel.org, marek.vasut@gmail.com, linux-kernel@vger.kernel.org, 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: <20190510155340.1130487f@xps13> In-Reply-To: <20190510153704.33de9568@windsurf.home> References: <1557474062-4949-1-git-send-email-masonccyang@mxic.com.tw> <20190510153704.33de9568@windsurf.home> Organization: Bootlin X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; 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 Mason, Thomas Petazzoni wrote on Fri, 10 May 2019 15:37:04 +0200: > 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); Indeed. You can even dereference an mtd_info object first, then use mtd->dev. > > > +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. I definitely agree with these cosmetic changes. Thanks, Miquèl