diff mbox

[v1,1/1] spi: core: use gpio_is_valid() helper

Message ID 1445333309-15436-1-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit 243f07be2423efe0b17e8ffafc9a36dad50406d3
Headers show

Commit Message

Andy Shevchenko Oct. 20, 2015, 9:28 a.m. UTC
Check if GPIO pin is valid by API helper function.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e900164..33836ee8 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -668,7 +668,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);