linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] added API: spi_message_compile/optimize/hint/...
Date: Wed, 20 Nov 2013 11:29:20 +0000	[thread overview]
Message-ID: <20131120112920.GX2674@sirena.org.uk> (raw)
In-Reply-To: <0C7D5B1E-E561-4F52-BEA8-572EB0CA26A6-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>

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

On Tue, Nov 19, 2013 at 07:33:14PM +0100, Martin Sperl wrote:

> Here the patch for a spi_message_compile interface 
> (as discussed in a separate thread).

As well as the signoff please try to follow the other stuff in
SubmittingPatches, both in terms of the formatting of the patch and in
terms of things like coding style - checkpatch is a useful tool for
checking this stuff.

The shape of the patch looks good, but there's a few issues below.

> Naming of the API is subject to discussion - instead of "compile" it could
> also be "optimize" or "hint" or ...

Hrm.  I don't really like any of these options but can't think of
anything else right now.  Perhaps optimize is the best of the options
here.

> The patch creates:
> * 3 additional variables in spi_message
> * 2 additional function pointers in spi_master

Can you keep the master interface in a separate patch please?  I'm not
sure if we want to do this or if we want to push more of the work to the
core, especially given the desire to factor the generic bits of DMA work
out of drivers, but the external interface seems very clear now so we
should be able to get that merged more easily (and then things like the
mcp2515 can start building on that).

For the master interface I think I'd like to at least see a patch adding
a driver using it go in along with the core changes.  This is probably
going to be a bit difficult right now given the situation with the
Raspberry Pi kernels unfortunately.

> Here some measurements using my "standard" CAN test:
> * runs on Raspberry Pi without over-clocking
> * optimized mcp2515 driver with 3 Message chunks and callbacks running 
>   in listen only mode

Is this device part of the vanilla board out of interest?

> * kernel 3.10.16 (foundation based, as the vanilla RPI kernel still misses 
>   dmaengine, so it is easier to develop against this kernel)

Patches really need to be sent against the latest code for application -
this is going to collide with the factoring of the validation out of the
lock that I did too.  Normally that should be 

  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

though until the merge window is over that'll need to be topic/core.

> +/**
> + * spi_message_verify - verifies if the spi message is supported
> + *   by the bus-master
> + * @spi: device with which data will be exchanged
> + * @message: describes the data transfers, including completion callback
> + * Context: any (irqs may be blocked, etc)
> + *
> + * This call may be used in_irq and other contexts which can't sleep,
> + * as well as from task contexts which can sleep.
> + */
> +extern int spi_message_verify(struct spi_device *spi,
> +			struct spi_message *message)

This stuff does more than verify, it also initialises the message with
defaults - if it were really a verify() then it'd be able to have the
message passed as a const.

> +	if ((verify=spi_message_verify(spi,m)))
> +		return verify;

Assign and check the result separately.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2013-11-20 11:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 18:33 [PATCH] added API: spi_message_compile/optimize/hint/ Martin Sperl
     [not found] ` <0C7D5B1E-E561-4F52-BEA8-572EB0CA26A6-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2013-11-19 19:25   ` Mark Brown
2013-11-20  9:11   ` martin sperl
2013-11-20 11:29   ` Mark Brown [this message]
     [not found]     ` <20131120112920.GX2674-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-11-20 15:27       ` Martin Sperl
     [not found]         ` <05C64EF6-0F3B-4CBC-A462-45ED8F1564A7-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2013-11-20 16:24           ` Mark Brown
     [not found]             ` <20131120162449.GJ2674-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-11-20 18:42               ` Martin Sperl
     [not found]                 ` <9DE09AF6-AD13-45DE-A36F-BD65E619C342-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2013-11-21 19:10                   ` Mark Brown
     [not found]                     ` <20131121191004.GH8120-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-11-22  6:53                       ` Martin Sperl

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=20131120112920.GX2674@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).