spi: omap2-mcspi: Handle error on gpio_request
If a valid GPIO is specified but cannot be requested by the driver, print a message and error out of omap2_mcspi_setup. Signed-off-by: Michael Welling <mwelling@ieee.org> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
a06b430fd8
commit
c4339ac775
1 changed files with 6 additions and 3 deletions
|
@ -1023,9 +1023,12 @@ static int omap2_mcspi_setup(struct spi_device *spi)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpio_is_valid(spi->cs_gpio)) {
|
if (gpio_is_valid(spi->cs_gpio)) {
|
||||||
if (gpio_request(spi->cs_gpio, dev_name(&spi->dev)) == 0)
|
ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev));
|
||||||
gpio_direction_output(spi->cs_gpio,
|
if (ret) {
|
||||||
!(spi->mode & SPI_CS_HIGH));
|
dev_err(&spi->dev, "failed to request gpio\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = pm_runtime_get_sync(mcspi->dev);
|
ret = pm_runtime_get_sync(mcspi->dev);
|
||||||
|
|
Loading…
Reference in a new issue