spi: core: use gpio_is_valid() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 20 Oct 2015 09:28:29 +0000 (12:28 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 21 Oct 2015 12:27:37 +0000 (13:27 +0100)
Check if GPIO pin is valid by API helper function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c

index 64c1aedde4817f8524d66ad8a829d2eb576f3194..9136f30a9fbd6db8c5e440ea50875e50deed6285 100644 (file)
@@ -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);