linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Brian Norris <computersforpeace@gmail.com>,
	Michal Suchanek <hramrach@gmail.com>
Cc: Mark Brown <broonie@kernel.org>,
	MTD Maling List <linux-mtd@lists.infradead.org>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	Martin Sperl <martin@sperl.org>
Subject: Re: RfC: Handle SPI controller limitations like maximum message length
Date: Sat, 21 Nov 2015 23:53:09 +0100	[thread overview]
Message-ID: <5650F5D5.2040901@gmail.com> (raw)
In-Reply-To: <20151120232211.GA64635@google.com>

Am 21.11.2015 um 00:22 schrieb Brian Norris:
> On Fri, Nov 20, 2015 at 08:05:48PM +0100, Michal Suchanek wrote:
>> On 20 November 2015 at 19:59, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>> Am 20.11.2015 um 13:35 schrieb Mark Brown:
>>>> On Fri, Nov 20, 2015 at 11:06:47AM +0100, Heiner Kallweit wrote:
>>>>> If the discussed case is valid a clear hint to all users of spi_sync and
>>>>> friends should be added that the caller can not rely on status code 0
>>>>> only but must check actual_length to verify that the complete message
>>>>> was transferred.
>>>>
>>>> You'll get an error on truncation.  It may be possible to recover.
>>>>
>>> OK, I interpret this as:
>>> Controller drivers shall return 0 only if the complete message was
>>> transferred successfully.
>>> If  a controller driver returns an error it has the option to set
>>> actual_length to what was transferred successfully.
>>>
>>> This means we can't use patch 4 from Michal because it bails out as soon
>>> as the underlying SPI transfer returns an error.
> 
> Right (although you meant patch 7).
> 
>>> Instead something like the spi-nor patch I sent on Oct 6th would be needed:
>>> [PATCH] mtd: spi-nor: handle controller driver limitations in spi_nor_read
> 
> I don't think your patch is good either...
> 
>>> It loops over nor->read and ignores errors as long as at least something
>>> was read.
>>>
>>
>> I don't think ignoring errors in general is good idea.
> 
> ...for this reason, at least.
> 
>> If it's desirable that a partial transfer is reported as error then a
>> particular error value should be defined for this case and drivers
>> that can continue the transfer in a driver-specific way (such as
>> spi-nor) can check for this error and handle it appropriately and pass
>> through any other error.
> 
> Based on Mark's further comments (and my own intuition), I'd rather not
> try to interpret different error codes to mean "truncated but keep
> going" vs. "truncated for other reason, stop now", unless we really have
> to.
> 
> I think if we do what Heiner was proposing from the beginning -- expose
> a reasonable max SPI message length -- then I think we'll cover the bulk
> of what we want. SPI NOR drivers can then try "small enough" transfers,
> and if we see any errors, those are unexpected, and we abort.

Based on what was discussed so far I'll submit a patch series as basis
for further discussion.

Heiner
> 
> Sound OK?
> 
> Brian
> 

  reply	other threads:[~2015-11-21 23:13 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 21:19 RfC: Handle SPI controller limitations like maximum message length Heiner Kallweit
2015-11-18 21:57 ` Mark Brown
2015-11-18 22:50   ` Heiner Kallweit
2015-11-19 11:40     ` Mark Brown
2015-11-19 15:00       ` Martin Sperl
2015-11-19 17:15         ` Mark Brown
2015-11-20  0:07           ` Brian Norris
2015-11-20 11:06             ` Mark Brown
2015-11-20 11:16               ` Martin Sperl
2015-11-20 10:18           ` Martin Sperl
2015-11-20 12:05             ` Mark Brown
2015-11-20 12:56               ` Martin Sperl
2015-11-21 13:49                 ` Mark Brown
2015-11-21 14:10                   ` Heiner Kallweit
2015-11-21 15:57                     ` Michal Suchanek
2015-11-21 22:59                       ` [PATCH 0/3] spi: mtd: Handle HW message length restrictions Heiner Kallweit
2015-11-21 23:01                       ` [PATCH 1/3] spi: core: add max_msg_size to spi_master Heiner Kallweit
2015-11-22 13:16                         ` Mark Brown
2015-11-22 16:15                           ` Heiner Kallweit
2015-11-23 11:38                             ` Mark Brown
2015-11-27 19:26                               ` Heiner Kallweit
2015-11-30 16:42                                 ` Mark Brown
2015-11-30 20:15                                   ` Heiner Kallweit
2015-11-21 23:08                       ` [PATCH 2/3] mtd: m25p80: handle HW message size restrictions Heiner Kallweit
2015-11-22 12:51                         ` Michal Suchanek
2015-11-21 23:11                       ` [PATCH 3/3] spi: fsl-espi: make use of max_msg_size in spi_master to handle HW restrictions Heiner Kallweit
2015-11-30 20:24                       ` [PATCH v2 1/2] spi: core: add max_msg_size to spi_master Heiner Kallweit
2015-11-30 20:25                       ` [PATCH resubmit 2/2] spi: fsl-espi: make use of max_msg_size in spi_master to handle HW restrictions Heiner Kallweit
2015-12-01 14:19                         ` Mark Brown
2015-12-01 18:53                           ` Heiner Kallweit
2015-11-22 13:19                     ` RfC: Handle SPI controller limitations like maximum message length Mark Brown
2015-11-20  0:02 ` Brian Norris
2015-11-20  6:59   ` Heiner Kallweit
2015-11-20 10:06     ` Heiner Kallweit
2015-11-20 12:35       ` Mark Brown
2015-11-20 18:59         ` Heiner Kallweit
2015-11-20 19:05           ` Michal Suchanek
2015-11-20 19:21             ` Mark Brown
2015-11-20 19:44               ` Michal Suchanek
2015-11-20 23:22             ` Brian Norris
2015-11-21 22:53               ` Heiner Kallweit [this message]
2015-11-20 19:18           ` Mark Brown
2015-11-20 19:37             ` Heiner Kallweit
2015-11-20 12:31   ` Mark Brown
2015-11-20 12:56 ` Michal Suchanek
2015-11-20 23:07   ` Brian Norris

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=5650F5D5.2040901@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=broonie@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=hramrach@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=martin@sperl.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).