From patchwork Fri Feb 28 21:05:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 237003 List-Id: U-Boot discussion From: seanga2 at gmail.com (Sean Anderson) Date: Fri, 28 Feb 2020 16:05:34 -0500 Subject: [PATCH v5 16/33] gpio: dw: Add a trailing underscore to generated name In-Reply-To: <20200228210552.615672-1-seanga2@gmail.com> References: <20200228210552.615672-1-seanga2@gmail.com> Message-ID: <20200228210552.615672-17-seanga2@gmail.com> Previously, if there was no bank-name property, it was easy to have confusing gpio names like "gpio1 at 08", instead of "gpio1 at 0_8". This patch follows the example of the sifive gpio driver. Signed-off-by: Sean Anderson --- Changes in v5: - New drivers/gpio/dwapb_gpio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c index 56dcad36f0..09abab5c39 100644 --- a/drivers/gpio/dwapb_gpio.c +++ b/drivers/gpio/dwapb_gpio.c @@ -184,7 +184,15 @@ static int gpio_dwapb_bind(struct udevice *dev) * Fall back to node name. This means accessing pins * via bank name won't work. */ - plat->name = ofnode_get_name(node); + char name[32]; + + snprintf(name, sizeof(name), "%s_", + ofnode_get_name(node)); + plat->name = strdup(name); + if (!plat->name) { + kfree(plat); + return -ENOMEM; + } } ret = device_bind_ofnode(dev, dev->driver, plat->name,