tty: max310x: Don't pass stacked buffers to SPI
authorSerge Semin <fancer.lancer@gmail.com>
Tue, 14 May 2019 10:14:11 +0000 (13:14 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2019 10:15:53 +0000 (12:15 +0200)
commitb7382c73b2d7102154cb077dde9aa9370b776874
tree3bc176d23ca7d0ea7d382838653022c56de63628
parent1b5d239af3dad5b2572c9dab2e70f6735410e18f
tty: max310x: Don't pass stacked buffers to SPI

SPI transfer tx/rx buffers must be DMA-safe and the structure
documentation clearly states this. Data declared on the system stack isn't
DMA-safe [1]. Instead at least kernel memory should be used for the
buffers. In order to fix this here we can create the buffers at the device
probing stage and use them without any synchronization, since batch
read/write methods are called from non-reentrant contexts - either from
rx-event IRQ threaded handler or from the tx workqueue item.

[1] Documentation/DMA-API-HOWTO.txt

Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/max310x.c