mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: "'Marek Vasut'" <marex@denx.de>, "'Graham Moore'" <grmoore@altera.com>
Cc: ggrahammoore@gmail.com, "'David Woodhouse'" <dwmw2@infradead.org>,
	"'Brian Norris'" <computersforpeace@gmail.com>,
	"'Artem Bityutskiy'" <artem.bityutskiy@linux.intel.com>,
	"'Sourav Poddar'" <sourav.poddar@ti.com>,
	"'Sascha Hauer'" <s.hauer@pengutronix.de>,
	"'Geert Uytterhoeven'" <geert+renesas@linux-m68k.org>,
	"'Insop Song'" <insop.song@gainspeed.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	"'Alan Tull'" <atull@altera.com>,
	"'Dinh Nguyen'" <dinguyen@altera.com>,
	"'Yves Vandervennet'" <rocket.yvanderv@gmail.com>,
	"'Jingoo Han'" <jg1.han@samsung.com>
Subject: Re: [PATCH] Add support for flag status register on Micron chips.
Date: Wed, 09 Apr 2014 19:16:10 +0900	[thread overview]
Message-ID: <000801cf53dc$ba81e820$2f85b860$%han@samsung.com> (raw)
In-Reply-To: <201404091206.45967.marex@denx.de>

On Wednesday, April 09, 2014 7:07 PM, Marek Vasut wrote:
> On Tuesday, April 08, 2014 at 06:12:50 PM, grmoore@altera.com wrote:
> > From: Graham Moore <grmoore@altera.com>
> >
> > Some new Micron flash chips require reading the flag
> > status register to determine when operations have completed.
> >
> > Furthermore, chips with multi-die stacks of the 65nm 256Mb QSPI also
> > require reading the status register before reading the flag status
> > register.
> >
> > This patch adds support for the flag status register in the n25q512a1 and
> > n25q00 Micron QSPI flash chips.
> 
> [...]
> 
> > +static int read_fsr(struct m25p *flash)
> > +{
> > +	ssize_t retval;
> > +	u8 code = OPCODE_RDFSR;
> > +	u8 val;
> > +
> > +	retval = spi_write_then_read(flash->spi, &code, 1, &val, 1);
> > +
> > +	if (retval < 0) {
> > +		dev_err(&flash->spi->dev, "error %d reading FSR\n",
> > +				(int) retval);
> 
> Is the type-cast really needed here? Why ?

The type-cast looks clumsy.
The type of 'retval' is retval; thus, '%zd' can be used,
instead of '%d', as below.

 +		dev_err(&flash->spi->dev, "error %zd reading FSR\n",
 +				retval);


> 
> > +		return retval;
> > +	}
> > +
> > +	return val;
> > +}
> > +/*
> >   * Read configuration register, returning its value in the
> >   * location. Return the configuration register value.
> >   * Returns negative if error occured.
> > @@ -233,7 +259,7 @@ static inline int set_4byte(struct m25p *flash, u32
> > jedec_id, int enable) * Service routine to read status register until
> > ready, or timeout occurs. * Returns non-zero if error.
> >   */
> > -static int wait_till_ready(struct m25p *flash)
> > +static int _wait_till_ready(struct m25p *flash)
> 
> Please avoid using function names that start with underscore .

+1

I agree with Marek Vasut's opinion.
If there is no reason, please don't use it.

Best regards,
Jingoo Han

> [...]
> 
> Thanks!
> 
> Best regards,
> Marek Vasut


  reply	other threads:[~2014-04-09 10:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 16:12 grmoore
2014-04-08 16:12 ` grmoore
2014-04-08 16:52   ` Insop Song
2014-04-09 10:06   ` Marek Vasut
2014-04-09 10:16     ` Jingoo Han [this message]
2014-04-09 10:21       ` Jingoo Han
2014-04-09 10:03 ` Marek Vasut
2014-04-09 11:09   ` Gerhard Sittig
2014-04-09 18:14     ` Graham Moore
2014-04-09 18:31       ` Marek Vasut

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='000801cf53dc$ba81e820$2f85b860$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=atull@altera.com \
    --cc=computersforpeace@gmail.com \
    --cc=dinguyen@altera.com \
    --cc=dwmw2@infradead.org \
    --cc=geert+renesas@linux-m68k.org \
    --cc=ggrahammoore@gmail.com \
    --cc=grmoore@altera.com \
    --cc=insop.song@gainspeed.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    --cc=rocket.yvanderv@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sourav.poddar@ti.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

all inboxes | Powered by JetHome®