]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - drivers/gpio/gpio-74x164.c
gpio: 74x164: Use a single SPI transfer instead of multiple transfers
authorGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 30 Nov 2015 14:35:26 +0000 (15:35 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 10 Dec 2015 16:21:02 +0000 (17:21 +0100)
commit902e7e60086b925e27f68261feda4898c5be6966
tree9f72561704eded826b597f4b6d467a4aa24041c0
parent410f4574f43c8bd61cd413a15e26e8f03c608085
gpio: 74x164: Use a single SPI transfer instead of multiple transfers

Currently the 74x164 driver assembles an SPI message from an array of
one-byte SPI transfers, one for each daisy-chained shift register, as
the first byte sent will end up in the last register.
This array is allocated and deallocated on each GPIO write access.

By storing the data in the internal buffer in reverse order, we can
use a single SPI transfer with the internal buffer directly, simplifying
the code a lot, and avoiding memory (de)allocations.

This also avoids transient values on the GPIO outputs when using an SPI
master that cannot keep the hardware chip select asserted in between
multiple transfers (and would need cs-gpios for proper operation).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Mark Brown <broonie@kernel.org>
[Rebased changing .dev to .parent]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-74x164.c