All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrille Pitchen <cyrille.pitchen@atmel.com>
To: Brian Norris <computersforpeace@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>
Cc: MTD Maling List <linux-mtd@lists.infradead.org>,
	Michal Suchanek <hramrach@gmail.com>, Marek Vasut <marex@denx.de>
Subject: Re: [PATCH 2/2] mtd: m25p80: consider max_transfer_size when reading
Date: Wed, 6 Apr 2016 15:55:36 +0200	[thread overview]
Message-ID: <57051558.5070600@atmel.com> (raw)
In-Reply-To: <20160405193952.GA5243@localhost>

Hi all,

Le 05/04/2016 21:39, Brian Norris a écrit :
> + others
> 
> Hi Heiner,
> 
> On Sat, Feb 27, 2016 at 11:50:11PM +0100, Heiner Kallweit wrote:
>> Some controllers have transfer size limits. To allow to deal with this
>> max_transfer_size was introduced in the SPI core recently.
>> Use this new feature to read in chunks if needed.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> Michal has been working on a similar series, with some differences (I'll
> comment below). I think his latest work is here:
> 
> http://lists.infradead.org/pipermail/linux-mtd/2015-December/063865.html
> 
> Is there a particular reason you've continued on your series instead of
> reviewing/fixing his?
> 
>> ---
>>  drivers/mtd/devices/m25p80.c | 30 +++++++++++++++++++++++++++++-
>>  1 file changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
>> index c2d1f65..69f3acf 100644
>> --- a/drivers/mtd/devices/m25p80.c
>> +++ b/drivers/mtd/devices/m25p80.c
>> @@ -119,7 +119,7 @@ static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor)
>>   * Read an address range from the nor chip.  The address range
>>   * may be any size provided it is within the physical boundaries.
>>   */
>> -static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>> +static int _m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>>  			size_t *retlen, u_char *buf)
>>  {
>>  	struct m25p *flash = nor->priv;
>> @@ -153,6 +153,34 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>>  	return ret;
>>  }
>>  
>> +/* Read in max_read_len chunks if len > max_read_len */
>> +static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>> +		       size_t *retlen, u_char *buf)
>> +{
>> +	struct m25p *flash = nor->priv;
>> +	/*
>> +	 * The controller transfer size limit refers to the overall transfer
>> +	 * including read command + actually read data. Therefore subtract
>> +	 * the command size when calculating the max read length.
>> +	 */
>> +	size_t max_read_len = spi_max_transfer_size(flash->spi) -
>> +			      (m25p_cmdsz(nor) + nor->read_dummy / 8);
>> +	size_t read_len;
>> +	int ret;
>> +
>> +	while (len > 0) {
> 
> ^^ I really don't want this loop to be in m25p80.c. This should be in
> the core spi-nor.c, and then the driver (like m25p80.c, but also
> possibly other non-SPI drivers that also use spi-nor.c) can simply
> pass its limitation up the spi-nor.c. (See Michal's patch 10.)

I agree with Brian on this point: it would be better to move a generic
algorithm into spi-nor.c which is directly used by some (Q)SPI controller
drivers, hence by-passing the m25p80 driver.

Best regards,

Cyrille

      parent reply	other threads:[~2016-04-06 13:56 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-27 22:50 [PATCH 2/2] mtd: m25p80: consider max_transfer_size when reading Heiner Kallweit
2016-04-05 19:39 ` Brian Norris
2016-04-05 20:08   ` Heiner Kallweit
2016-04-05 21:07     ` Brian Norris
2016-04-07 19:09       ` Heiner Kallweit
2016-05-05 23:57         ` Brian Norris
2016-05-05 23:57           ` Brian Norris
2016-05-06 12:14           ` Mark Brown
2016-05-06 12:14             ` Mark Brown
2016-06-03 22:22             ` Heiner Kallweit
2016-06-03 22:22               ` Heiner Kallweit
2016-06-06 17:40               ` Mark Brown
2016-06-06 17:40                 ` Mark Brown
2016-06-06 18:28                 ` Brian Norris
2016-06-06 18:28                   ` Brian Norris
2016-06-06 18:34                   ` Mark Brown
2016-06-06 18:34                     ` Mark Brown
2016-06-06 18:43                     ` Brian Norris
2016-06-06 18:43                       ` Brian Norris
2016-06-06 18:48                       ` Mark Brown
2016-06-06 18:48                         ` Mark Brown
2016-06-06 18:53                 ` Heiner Kallweit
2016-06-06 18:53                   ` Heiner Kallweit
2016-06-06 19:40                   ` Michal Suchanek
2016-06-06 19:40                     ` Michal Suchanek
2016-06-06 21:02                     ` Heiner Kallweit
2016-06-06 21:02                       ` Heiner Kallweit
2016-06-06 19:46                   ` Geert Uytterhoeven
2016-06-06 19:46                     ` Geert Uytterhoeven
2016-06-06 21:20                     ` Heiner Kallweit
2016-06-06 21:20                       ` Heiner Kallweit
2016-06-06 22:28                       ` Marek Vasut
2016-06-06 22:28                         ` Marek Vasut
2016-06-07  4:52                         ` Heiner Kallweit
2016-06-07  4:52                           ` Heiner Kallweit
2016-06-06 23:07                   ` Mark Brown
2016-06-06 23:07                     ` Mark Brown
2016-06-07  6:03                     ` Heiner Kallweit
2016-06-07  6:03                       ` Heiner Kallweit
2016-06-07  8:10                       ` Michal Suchanek
2016-06-07  8:10                         ` Michal Suchanek
2016-06-07 20:42                         ` Heiner Kallweit
2016-06-07 20:42                           ` Heiner Kallweit
2016-06-08 19:51                       ` Heiner Kallweit
2016-06-08 19:51                         ` Heiner Kallweit
2016-06-09  7:12                         ` Michal Suchanek
2016-06-09  7:12                           ` Michal Suchanek
2016-06-17 20:13                           ` Heiner Kallweit
2016-06-17 20:13                             ` Heiner Kallweit
2016-04-06 13:55   ` Cyrille Pitchen [this message]

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=57051558.5070600@atmel.com \
    --to=cyrille.pitchen@atmel.com \
    --cc=computersforpeace@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=hramrach@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.