Linux CAN drivers development
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "Tim Harvey" <tharvey@gateworks.com>,
	"open list" <linux-kernel@vger.kernel.org>,
	linux-can@vger.kernel.org,
	"Wolfgang Grandegger" <wg@grandegger.com>,
	"Timo Schlüßler" <schluessler@krause.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	linux-spi@vger.kernel.org, "Jan Glauber" <jglauber@marvell.com>,
	"Robert Richter" <rrichter@marvell.com>
Subject: Re: [PATCH] can: mcp251x: convert to half-duplex SPI
Date: Mon, 25 May 2020 14:27:35 +0100	[thread overview]
Message-ID: <20200525132735.GG4544@sirena.org.uk> (raw)
In-Reply-To: <a663d610-56d8-1c2d-90ad-4d128a2fa3a8@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2020-05-25 13:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 18:35 [PATCH] can: mcp251x: convert to half-duplex SPI Tim Harvey
2020-02-25 21:43 ` Marc Kleine-Budde
2020-02-25 22:25   ` Tim Harvey
2020-02-26  7:37     ` Marc Kleine-Budde
2020-02-26 10:19       ` Marc Kleine-Budde
     [not found]         ` <7b85e098-b9a9-dd14-203f-100cdf2e703e-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2020-05-21 20:19           ` Tim Harvey
     [not found]             ` <CAJ+vNU06DHVS25OQR1Kqyzy2ZxLVq-HdwenGv-jN5Rb3r8F86Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-05-21 21:08               ` Mark Brown
2020-05-25 11:17               ` Marc Kleine-Budde
2020-05-25 11:31                 ` Mark Brown
     [not found]                   ` <20200525113106.GB4544-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2020-05-25 12:41                     ` Marc Kleine-Budde
     [not found]                       ` <a337c8ea-66e2-13c2-f625-fbe93e367d44-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2020-05-25 12:57                         ` Mark Brown
2020-05-25 13:12                           ` Marc Kleine-Budde
2020-05-25 13:27                             ` Mark Brown [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=20200525132735.GG4544@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jglauber@marvell.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=rrichter@marvell.com \
    --cc=schluessler@krause.de \
    --cc=tharvey@gateworks.com \
    --cc=wg@grandegger.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