]> git.baikalelectronics.ru Git - kernel.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)
committerMark Brown <broonie@kernel.org>
Tue, 4 Aug 2015 17:46:54 +0000 (18:46 +0100)
commit341a75e79c0e77ae2c005c304049dd158f0a4537
treee909d33caf1fea825693ef42d3baec7778ea0ae6
parent878ebb1362feaf2e1cc5281d4435ebbe3e35f427
spi: img-spfi: fix multiple calls to request gpio

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: 22914805d797 ("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>
Cc: stable@vger.kernel.org
drivers/spi/spi-img-spfi.c