]> www.infradead.org Git - users/jedix/linux-maple.git/commit
spi: img-spfi: fix multiple calls to request gpio
authorSifan Naeem <sifan.naeem@imgtec.com>
Wed, 29 Jul 2015 10:55:26 +0000 (11:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Sep 2015 17:05:35 +0000 (10:05 -0700)
commit1d43421636933f74c6f642a61951dbfa3732edec
tree8b3aec47001b09030c517b2ddc641d4cb2eff843
parentb82ed8c90e5f1ad73d1c355c58ef38a789a16c7d
spi: img-spfi: fix multiple calls to request gpio

commit b03ba9e314c12b2127243145b5c1f41b2408de62 upstream.

spfi_setup may be called many times by the spi framework, but
gpio_request_one can only be called once without freeing, repeatedly
calling gpio_request_one will cause an error to be thrown, which
causes the request to spi_setup to be marked as failed.

We can have a per-spi_device flag that indicates whether or not the
gpio has been requested. If the gpio has already been requested use
gpio_direction_output to set the direction of the gpio.

Fixes: 8c2c8c03cdcb ("spi: img-spfi: Control CS lines with GPIO")
Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi-img-spfi.c