Skip to content

Commit

Permalink
fpga: altera-ps-spi: Fix getting of optional confd gpio
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
reid-p authored and mfischer committed Aug 19, 2019
1 parent 5f9e832 commit dec43da
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/fpga/altera-ps-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static int altera_ps_write_complete(struct fpga_manager *mgr,
return -EIO;
}

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

conf->confd = devm_gpiod_get(&spi->dev, "confd", GPIOD_IN);
conf->confd = devm_gpiod_get_optional(&spi->dev, "confd", GPIOD_IN);
if (IS_ERR(conf->confd)) {
dev_warn(&spi->dev, "Not using confd gpio: %ld\n",
PTR_ERR(conf->confd));
dev_err(&spi->dev, "Failed to get confd gpio: %ld\n",
PTR_ERR(conf->confd));
return PTR_ERR(conf->confd);
} else if (!conf->confd) {
dev_warn(&spi->dev, "Not using confd gpio");
}

/* Register manager with unique name */
Expand Down

0 comments on commit dec43da

Please sign in to comment.