[PATCH] mtd_dataflash use command allocated on stack
Vitja Makarov
vitja.makarov at gmail.com
Wed Apr 23 00:00:34 EDT 2008
2008/4/23 David Woodhouse <dwmw2 at infradead.org>:
> On Fri, 2008-04-04 at 09:02 +0400, Vitja Makarov wrote:
> > Hi!
> >
> >
> > Currently mtd_dataflash driver has command in their private structure.
> > That is only 4 bytes, sometimes actually 8 is needed.
> > Also it could be accessed twice before lock is taken.
> >
> > This patch moves command to stack.
>
> Is that allowed? The SPI code might DMA from it, surely?
>
> --
> dwmw2
>
>
I'm using this driver with dma enabled on blackfin arch and that seems to work.
Btw mutex is taken before priv->command is accessed so no race could be here.
But I still think that having command 4 bytes when it's actually 8 (4
+ 4 don't cares) isn't a good idea.
If you are asking about could spi DMA from stack, I think so, as
spi_sync() is called before ret, but there still are cache issues,
dataflash or better spi driver should call invalidate/flush for the
given address if needed, I moved it to spi_bfin code, and that seems
to work for me wo modifyng original dataflash driver.
More information about the linux-mtd
mailing list