From: Andy Shevchenko Date: Tue, 20 Oct 2015 09:28:29 +0000 (+0300) Subject: spi: core: use gpio_is_valid() helper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=243f07be2423efe0b17e8ffafc9a36dad50406d3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git spi: core: use gpio_is_valid() helper Check if GPIO pin is valid by API helper function. Signed-off-by: Andy Shevchenko Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 64c1aedde481..9136f30a9fbd 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -606,7 +606,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable) if (spi->mode & SPI_CS_HIGH) enable = !enable; - if (spi->cs_gpio >= 0) + if (gpio_is_valid(spi->cs_gpio)) gpio_set_value(spi->cs_gpio, !enable); else if (spi->master->set_cs) spi->master->set_cs(spi, !enable);