Skip to content

Commit 193a7f9

Browse files
andy-shevbroonie
authored andcommitted
spidev: Switch to use spi_get_csgpiod()
spidev_ioctl() checks if there is an SPI chip select is driven by GPIO. Instead of current code, we can call spi_get_csgpiod(). Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Alexander Sverdlin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 12c8d7a commit 193a7f9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/spi/spidev.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
393393
case SPI_IOC_RD_MODE32:
394394
tmp = spi->mode;
395395

396-
if (ctlr->use_gpio_descriptors && ctlr->cs_gpiods &&
397-
ctlr->cs_gpiods[spi_get_chipselect(spi, 0)])
396+
if (ctlr->use_gpio_descriptors && spi_get_csgpiod(spi, 0))
398397
tmp &= ~SPI_CS_HIGH;
399398

400399
if (cmd == SPI_IOC_RD_MODE)
@@ -430,8 +429,7 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
430429
break;
431430
}
432431

433-
if (ctlr->use_gpio_descriptors && ctlr->cs_gpiods &&
434-
ctlr->cs_gpiods[spi_get_chipselect(spi, 0)])
432+
if (ctlr->use_gpio_descriptors && spi_get_csgpiod(spi, 0))
435433
tmp |= SPI_CS_HIGH;
436434

437435
tmp |= spi->mode & ~SPI_MODE_MASK;

0 commit comments

Comments
 (0)