archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <>
To: David Brownell
Subject: [RFC] SPI transfer with (count % bpw >> 3) != 0
Date: Fri, 16 Oct 2009 22:37:08 +0200	[thread overview]
Message-ID: <> (raw)

Just stumbled over this one: for instance bpw = 16 and len = 1.
I've found a few possible results:
- no transfer at all and return 0 (spi_gpio)
- no transfer at all and return with -EINVAL (spi_mpc8xxx)
- transfer two bytes and overwrite one probably unallocated byte in the
  read case. Return 1 (amba-pl022)
- write until an exception stops it (orion_spi)

Variant three and four is obviously wrong and should be fixed. However
I'm torn between variant one and two as the correct way to deal with
this. This problem is not just an in-kernel thing but also exposed to
user space via spidev. The man page for read() and write() says that the
function might return less than the number of requested bytes if more
data is not available. In this case there is more data available but
due to an programming error (?) we don't get anything. From that angle
-EINVAL sounds good.


Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!

                 reply	other threads:[~2009-10-16 20:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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).