spi: fsl-espi: pre-allocate message buffer
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 7 Sep 2016 20:50:22 +0000 (22:50 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 12 Sep 2016 18:58:45 +0000 (19:58 +0100)
commit1423877b73ed5f4982eaba8bed359605b9918a2b
tree19fe399436429fe4b6086f33300e619d1abb648e
parent71581a1507e642bbc6f698a3f43355552ee8056f
spi: fsl-espi: pre-allocate message buffer

Currently the driver allocates a 64kb buffer for each single message.
On systems with little and fragmented memory this can result in
memory allocation errors. Solve this by pre-allocating a buffer.

This patch was developed in OpenWRT long ago, however it never
made it upstream.

I slightly modified the original patch to re-initialize the buffer
at the beginning of each transfer.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-espi.c
drivers/spi/spi-fsl-lib.h