lkml.org 
[lkml]   [2008]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 2.6.28-rc9] spi: spi_write_then_read() regression fix


On Sat, 20 Dec 2008, David Brownell wrote:
>
> All SPI transfers are full duplex, and are packaged as half duplex
> by either discarding the data that's read ("write only"), or else
> by writing zeroes ("read only"). That patch wasn't ensuring that
> zeroes were getting written out during the "half duplex read" part
> of the transaction; instead, old RX bits were getting sent.

Hmm. In addition, isn't this broken (in that same function):

memcpy(local_buf, txbuf, n_tx);
x.tx_buf = local_buf;
x.rx_buf = local_buf;

/* do the i/o */
status = spi_sync(spi, &message);
if (status == 0)
memcpy(rxbuf, x.rx_buf + n_tx, n_rx);
shouldn't that 'rx_buf' setup be

x.rx_buf = local_buf + n_tx;

since the whole point was that we allocated a buffer that can hold _both_
the rx and tx parts? Especially as that final copy into the resulting
"rxbuf" thing uses that "+ n_tx" addition?

Linus


\
 
 \ /
  Last update: 2008-12-22 00:49    [from the cache]
©2003-2011 Jasper Spaans