From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] firmware: altera-serial: simplify handling of optional gpio
Date: Mon, 26 Sep 2016 11:11:37 +0200 [thread overview]
Message-ID: <20160926091137.24719-2-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20160926091137.24719-1-u.kleine-koenig@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/firmware/altera_serial.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/firmware/altera_serial.c b/drivers/firmware/altera_serial.c
index 5486d9ec63e9..ddee991ed073 100644
--- a/drivers/firmware/altera_serial.c
+++ b/drivers/firmware/altera_serial.c
@@ -221,15 +221,13 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
int ret;
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");
this->nstat_gpio = -1;
- } else {
- this->nstat_gpio = of_get_named_gpio(n, name, 0);
- if (this->nstat_gpio < 0) {
- ret = this->nstat_gpio;
- goto out;
- }
+ } else if (this->nstat_gpio < 0) {
+ ret = this->nstat_gpio;
+ goto out;
}
name = "confd-gpios";
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-09-26 9:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 9:11 [PATCH 1/2] firmware: altera-serial: Make the driver match the dt binding documentation Uwe Kleine-König
2016-09-26 9:11 ` Uwe Kleine-König [this message]
2016-09-26 9:37 ` Uwe Kleine-König
2016-09-27 6:10 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160926091137.24719-2-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox