aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-gpio.c
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2025-02-05 13:19:20 +0000
committerMark Brown <[email protected]>2025-02-05 13:52:57 +0000
commit25fac20edd09b60651eabcc57c187b1277f43d08 (patch)
treec470ced10bd37e25633a0e99f18eb3470edc7073 /drivers/spi/spi-gpio.c
parentspi: gpio: Remove stale documentation part (diff)
downloadkernel-25fac20edd09b60651eabcc57c187b1277f43d08.tar.gz
kernel-25fac20edd09b60651eabcc57c187b1277f43d08.zip
spi: gpio: Support a single always-selected device
The generic SPI code, the SPI GPIO driver functions support a single always-connected device cases. The only impediment is that board instantiation prevents that from happening. Update spi_gpio_probe_pdata() checks to support the mentioned hardware setup. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'drivers/spi/spi-gpio.c')
-rw-r--r--drivers/spi/spi-gpio.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 80a1aed42951..405deb6677c1 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -313,15 +313,14 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev,
struct spi_gpio *spi_gpio = spi_controller_get_devdata(host);
int i;
- if (!pdata || !pdata->num_chipselect)
+ if (!pdata)
return -ENODEV;
- /*
- * The host needs to think there is a chipselect even if not
- * connected
- */
- host->num_chipselect = pdata->num_chipselect ?: 1;
+ /* It's just one always-selected device, fine to continue */
+ if (!pdata->num_chipselect)
+ return 0;
+ host->num_chipselect = pdata->num_chipselect;
spi_gpio->cs_gpios = devm_kcalloc(dev, host->num_chipselect,
sizeof(*spi_gpio->cs_gpios),
GFP_KERNEL);