archive mirror
 help / color / mirror / Atom feed
* [RFC] SPI transfer with (count % bpw >> 3) != 0
@ 2009-10-16 20:37 Sebastian Andrzej Siewior
  0 siblings, 0 replies; only message in thread
From: Sebastian Andrzej Siewior @ 2009-10-16 20:37 UTC (permalink / raw)
  To: David Brownell; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-16 20:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-16 20:37 [RFC] SPI transfer with (count % bpw >> 3) != 0 Sebastian Andrzej Siewior

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