Re: [patch 2.6.28-rc9] spi: spi_write_then_read() regression fix

From: Linus Torvalds
Date: Tue Dec 23 2008 - 13:56:21 EST




On Sun, 21 Dec 2008, David Brownell wrote:

> On Sunday 21 December 2008, Linus Torvalds wrote:
> >
> > Hmm. In addition, isn't this broken (in that same function):
>
> No -- this is full duplex. The write_then_read() helper is
> simplifying a common half-duplex idiom for short operations,
> but the harware still does full duplex. Buffer layout is:
>
> Before: WWWWW0000000
> After: xxxxxRRRRRRR

Then, the problem is this:

x.tx_buf = local_buf;
x.rx_buf = local_buf;

which makes no sense. It's not two separate "tx_buf"/"rx_buf" things, it's
just a single "buf".

Having two separate pointers is not only confusing, but it's actively
WRONG, since the "rx_buf" clearly does not start at local_buf.

But that's not how most spi drivers seem to do it. They literally set
tx_bug and rx_buf to different values. So again, none of what you talk
about makes sense, and none of your "explanations" are anything but just
incoherent noise.

So please explain how it can _possibly_ make sense to

- have two separate pointers

- and have one of them point to what is clearly not the data it is
supposed to point to.

Hmm?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/