[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200525132735.GG4544@sirena.org.uk>
Date: Mon, 25 May 2020 14:27:35 +0100
From: Mark Brown <broonie@...nel.org>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: Tim Harvey <tharvey@...eworks.com>,
open list <linux-kernel@...r.kernel.org>,
linux-can@...r.kernel.org, Wolfgang Grandegger <wg@...ndegger.com>,
Timo Schlüßler <schluessler@...use.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-spi@...r.kernel.org, Jan Glauber <jglauber@...vell.com>,
Robert Richter <rrichter@...vell.com>
Subject: Re: [PATCH] can: mcp251x: convert to half-duplex SPI
On Mon, May 25, 2020 at 03:12:05PM +0200, Marc Kleine-Budde wrote:
> On 5/25/20 2:57 PM, Mark Brown wrote:
> > On Mon, May 25, 2020 at 02:41:31PM +0200, Marc Kleine-Budde wrote:
> >> On 5/25/20 1:31 PM, Mark Brown wrote:
> >> The core could merge several half duplex transfers (until there's as cs_change)
> >> into a single full duplex transfer.
> > Yes, that is what I am suggesting.
> Where in the SPI stack do you see such a "merge" function? One point to clarify
> is when and where to allocate and free the memory for the contiguous full duplex
> buffers.
My first thought would be about the same point as we're rewriting to
handle MUST_TX and MUST_RX in map_msg() which does similar allocations
and deallocations to insert dummy data for controllers that need them.
> >> I think spi_write_then_read() can be extended to generate one full duplex
> >> transfer instead on two half duplex ones it does a memcpy() anyways.
> > This has the same problem as doing it in any other driver code - it
> > causes a needless incompatibility with three wire and single duplex
> > devices.
> What about the note "portable code should never use this for more than 32 bytes"
> in spi_write_then_read()? The CAN driver in question may read more than 32 bytes
> of data.
I think that comment is actually not valid any more - we used to use a
fixed statically allocated buffer in write_then_read() but added the
option to fall back onto allocating one dynamically if another user was
running or the transfer was too big.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists