linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Vignesh R <vigneshr@ti.com>
To: Michal Suchanek <hramrach@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
	MTD Maling List <linux-mtd@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND][PATCH] mtd: devices: m25p80: add support for mmap read request
Date: Wed, 18 May 2016 15:09:27 +0530	[thread overview]
Message-ID: <573C384F.8000209@ti.com> (raw)
In-Reply-To: <CAOMqctR75awkRbwzG4_U91wuZqdZJH9MGrcfCtQm7f6qP=ezUw@mail.gmail.com>

Hi,

On 05/18/2016 02:53 PM, Michal Suchanek wrote:
> Hello,
[...]
>>
>> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
>> index c9c3b7fa3051..7730e633d7d3 100644
>> --- a/drivers/mtd/devices/m25p80.c
>> +++ b/drivers/mtd/devices/m25p80.c
>> @@ -131,6 +131,26 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>>         /* convert the dummy cycles to the number of bytes */
>>         dummy /= 8;
>>
>> +       if (spi_flash_read_supported(spi)) {
>> +               struct spi_flash_read_message msg;
>> +               int ret;
>> +
>> +               msg.buf = buf;
>> +               msg.from = from;
>> +               msg.len = len;
>> +               msg.read_opcode = nor->read_opcode;
>> +               msg.addr_width = nor->addr_width;
>> +               msg.dummy_bytes = dummy;
>> +               /* TODO: Support other combinations */
>> +               msg.opcode_nbits = SPI_NBITS_SINGLE;
>> +               msg.addr_nbits = SPI_NBITS_SINGLE;
>> +               msg.data_nbits = m25p80_rx_nbits(nor);
>> +
>> +               ret = spi_flash_read(spi, &msg);
>> +               *retlen = msg.retlen;
> 
> This is wrong. The previous retlen is never passed into msg so it must
> be added and not assigned as is seen a few lines below:
> 
>         ret = m.actual_length - m25p_cmdsz(nor) - dummy;
>         if (ret < 0)
>                 return -EIO;
>         *retlen += ret;
> 
> This interface with odd design and poor documentation will be
> hopefully weeded out with
> mtd: spi-nor: stop passing around retlen
> so there is probably no need to patch this separately.
> 

This patch was applied by Brian quite sometime back and the v7  of "mtd:
spi-nor: stop passing around retlen" patch takes care of removing the
offending code: https://lkml.org/lkml/2016/5/5/692

-- 
Regards
Vignesh

  reply	other threads:[~2016-05-18  9:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29  5:46 [RESEND][PATCH] mtd: devices: m25p80: add support for mmap read request Vignesh R
2016-04-05 18:14 ` Brian Norris
2016-04-06  5:18   ` Vignesh R
2016-04-06 13:44     ` Cyrille Pitchen
2016-05-18  9:23 ` Michal Suchanek
2016-05-18  9:39   ` Vignesh R [this message]
2016-05-18  9:49     ` Michal Suchanek

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=573C384F.8000209@ti.com \
    --to=vigneshr@ti.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=hramrach@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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).