linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: computersforpeace@gmail.com, bbrezillon@kernel.org,
	juliensu@mxic.com.tw, richard@nod.at,
	linux-kernel@vger.kernel.org, marek.vasut@gmail.com,
	linux-mtd@lists.infradead.org,
	Mason Yang <masonccyang@mxic.com.tw>,
	dwmw2@infradead.org
Subject: Re: [PATCH v1] mtd: rawnand: Add Macronix NAND read retry support
Date: Fri, 10 May 2019 15:53:40 +0200	[thread overview]
Message-ID: <20190510155340.1130487f@xps13> (raw)
In-Reply-To: <20190510153704.33de9568@windsurf.home>

Hi Mason,

Thomas Petazzoni <thomas.petazzoni@bootlin.com> 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 <masonccyang@mxic.com.tw> 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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2019-05-10 13:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10  7:41 [PATCH v1] mtd: rawnand: Add Macronix NAND read retry support Mason Yang
2019-05-10  7:45 ` Miquel Raynal
     [not found]   ` <OF5E2BF75D.98A43E33-ON482583F6.002E7A65-482583F6.0030A2DE@mxic.com.tw>
2019-05-10  9:12     ` Miquel Raynal
     [not found]       ` <OF3A216E48.80ABBB8A-ON482583F9.002A09DA-482583F9.002AD40E@mxic.com.tw>
2019-05-13  9:59         ` Miquel Raynal
2019-05-14  2:16           ` masonccyang
2019-05-10 13:37 ` Thomas Petazzoni
2019-05-10 13:53   ` Miquel Raynal [this message]
2019-05-10 14:18   ` Miquel Raynal
     [not found]   ` <OF1EDBA487.7723094D-ON482583F9.00297ABF-482583F9.0029E3EE@mxic.com.tw>
2019-05-13  9:40     ` Thomas Petazzoni
     [not found]       ` <OFB5D53BFC.6B44E7E0-ON482583FA.00090982-482583FA.000A5E93@mxic.com.tw>
2019-05-14  7:41         ` Thomas Petazzoni
2019-05-15  1:30           ` masonccyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190510155340.1130487f@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=juliensu@mxic.com.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=masonccyang@mxic.com.tw \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).