9
0
Fork 0

firmware: altera-serial: simplify handling of optional gpio

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Uwe Kleine-König 2016-09-26 11:11:37 +02:00 committed by Sascha Hauer
parent eb2b96d68a
commit a1e19c94d1
1 changed files with 5 additions and 7 deletions

View File

@ -221,15 +221,13 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
int ret; int ret;
name = "nstat-gpios"; name = "nstat-gpios";
if (!of_get_property(n, name, NULL)) { this->nstat_gpio = of_get_named_gpio(n, name, 0);
if (this->nstat_gpio == -ENOENT) {
dev_info(dev, "nstat-gpio is not specified, assuming it is not connected\n"); dev_info(dev, "nstat-gpio is not specified, assuming it is not connected\n");
this->nstat_gpio = -1; this->nstat_gpio = -1;
} else { } else if (this->nstat_gpio < 0) {
this->nstat_gpio = of_get_named_gpio(n, name, 0); ret = this->nstat_gpio;
if (this->nstat_gpio < 0) { goto out;
ret = this->nstat_gpio;
goto out;
}
} }
name = "confd-gpios"; name = "confd-gpios";