Skip to content

Commit 25fac20

Browse files
andy-shevbroonie
authored andcommitted
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]>
1 parent c108905 commit 25fac20

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/spi/spi-gpio.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,14 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev,
313313
struct spi_gpio *spi_gpio = spi_controller_get_devdata(host);
314314
int i;
315315

316-
if (!pdata || !pdata->num_chipselect)
316+
if (!pdata)
317317
return -ENODEV;
318318

319-
/*
320-
* The host needs to think there is a chipselect even if not
321-
* connected
322-
*/
323-
host->num_chipselect = pdata->num_chipselect ?: 1;
319+
/* It's just one always-selected device, fine to continue */
320+
if (!pdata->num_chipselect)
321+
return 0;
324322

323+
host->num_chipselect = pdata->num_chipselect;
325324
spi_gpio->cs_gpios = devm_kcalloc(dev, host->num_chipselect,
326325
sizeof(*spi_gpio->cs_gpios),
327326
GFP_KERNEL);

0 commit comments

Comments
 (0)