Skip to content

Commit dec43da

Browse files
reid-pmfischer
authored andcommitted
fpga: altera-ps-spi: Fix getting of optional confd gpio
Currently the driver does not handle EPROBE_DEFER for the confd gpio. Use devm_gpiod_get_optional() instead of devm_gpiod_get() and return error codes from altera_ps_probe(). Fixes: 5692fae ("fpga manager: Add altera-ps-spi driver for Altera FPGAs") Signed-off-by: Phil Reid <[email protected]> Signed-off-by: Moritz Fischer <[email protected]>
1 parent 5f9e832 commit dec43da

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/fpga/altera-ps-spi.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static int altera_ps_write_complete(struct fpga_manager *mgr,
210210
return -EIO;
211211
}
212212

213-
if (!IS_ERR(conf->confd)) {
213+
if (conf->confd) {
214214
if (!gpiod_get_raw_value_cansleep(conf->confd)) {
215215
dev_err(&mgr->dev, "CONF_DONE is inactive!\n");
216216
return -EIO;
@@ -289,10 +289,13 @@ static int altera_ps_probe(struct spi_device *spi)
289289
return PTR_ERR(conf->status);
290290
}
291291

292-
conf->confd = devm_gpiod_get(&spi->dev, "confd", GPIOD_IN);
292+
conf->confd = devm_gpiod_get_optional(&spi->dev, "confd", GPIOD_IN);
293293
if (IS_ERR(conf->confd)) {
294-
dev_warn(&spi->dev, "Not using confd gpio: %ld\n",
295-
PTR_ERR(conf->confd));
294+
dev_err(&spi->dev, "Failed to get confd gpio: %ld\n",
295+
PTR_ERR(conf->confd));
296+
return PTR_ERR(conf->confd);
297+
} else if (!conf->confd) {
298+
dev_warn(&spi->dev, "Not using confd gpio");
296299
}
297300

298301
/* Register manager with unique name */

0 commit comments

Comments
 (0)