[U-Boot] [PATCH RESEND-WITH-JUSTIFICATION] spi: soft_spi: Support NULL din/dout buffers

Andrew Ruder andy at aeruder.net
Thu Apr 10 21:17:09 CEST 2014


On Fri, Apr 11, 2014 at 12:33:45AM +0530, Jagan Teki wrote:
> >> It would be great if you mentioned issue scenario for status poll case
> >> drivers/mtd/spi/sf_ops.c:               ret = spi_xfer(spi, 8, NULL,
> >> &status, 0);
> OK - means issue only with soft_spi.c is it?

Yes, and a couple other drivers.

> Can you share the issue log or typical use case scenario w.r.t soft_spi.c,
> I need to understand how this got resolved with your change.

Yes, you actually posted one such case that will not work "correctly"
with soft_spi.  In the line of code you posted above, soft_spi will
actually perform a read from address 0x0.  In most cases, the read side
isn't a huge deal, but on the write side it can cause all kinds of
surprises.

> I understand you assigned '0' when dout is NULL and you took the buf
> only when din is !NULL.

Yes, just handling NULL case to be how most drivers are handling it and
how apparently most users of the spi modules (like mtd/spi/sf_ops) are
clearly expecting it to work.

- Andy


More information about the U-Boot mailing list