diff mbox series

[v2,08/10] led: gpio: Default to using node name if label is absent

Message ID 20200608012651.1525906-9-seanga2@gmail.com
State Superseded
Headers show
Series riscv: Add FPIOA and GPIO support for Kendryte K210 | expand

Commit Message

Sean Anderson June 8, 2020, 1:26 a.m. UTC
This more closely mirrors Linux's behaviour, and will make it easier to
transition to using function+color in the future.

Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---
This patch was previously submitted as part of
https://patchwork.ozlabs.org/project/uboot/list/?series=161576

(no changes since v1)

 drivers/led/led_gpio.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Simon Glass June 17, 2020, 3:11 a.m. UTC | #1
On Sun, 7 Jun 2020 at 19:27, Sean Anderson <seanga2 at gmail.com> wrote:
>
> This more closely mirrors Linux's behaviour, and will make it easier to
> transition to using function+color in the future.
>
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
> This patch was previously submitted as part of
> https://patchwork.ozlabs.org/project/uboot/list/?series=161576
>
> (no changes since v1)
>
>  drivers/led/led_gpio.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

Is there no test for this?
Sean Anderson June 17, 2020, 3:18 a.m. UTC | #2
On 6/16/20 11:11 PM, Simon Glass wrote:
> On Sun, 7 Jun 2020 at 19:27, Sean Anderson <seanga2 at gmail.com> wrote:
>>
>> This more closely mirrors Linux's behaviour, and will make it easier to
>> transition to using function+color in the future.
>>
>> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
>> ---
>> This patch was previously submitted as part of
>> https://patchwork.ozlabs.org/project/uboot/list/?series=161576
>>
>> (no changes since v1)
>>
>>  drivers/led/led_gpio.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> 
> Is there no test for this?
> 

There is not; I can add one in the next revision if you'd like. We
probably just need to delete a label from the test device tree.

--Sean
Simon Glass June 17, 2020, 2:07 p.m. UTC | #3
Hi Sean,

On Tue, 16 Jun 2020 at 21:18, Sean Anderson <seanga2 at gmail.com> wrote:
>
>
> On 6/16/20 11:11 PM, Simon Glass wrote:
> > On Sun, 7 Jun 2020 at 19:27, Sean Anderson <seanga2 at gmail.com> wrote:
> >>
> >> This more closely mirrors Linux's behaviour, and will make it easier to
> >> transition to using function+color in the future.
> >>
> >> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> >> ---
> >> This patch was previously submitted as part of
> >> https://patchwork.ozlabs.org/project/uboot/list/?series=161576
> >>
> >> (no changes since v1)
> >>
> >>  drivers/led/led_gpio.c | 7 ++-----
> >>  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> > Is there no test for this?
> >
>
> There is not; I can add one in the next revision if you'd like. We
> probably just need to delete a label from the test device tree.
>

Yes please.

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c
index ef9b61ee62..2cdb0269f4 100644
--- a/drivers/led/led_gpio.c
+++ b/drivers/led/led_gpio.c
@@ -99,11 +99,8 @@  static int led_gpio_bind(struct udevice *parent)
 		const char *label;
 
 		label = ofnode_read_string(node, "label");
-		if (!label) {
-			debug("%s: node %s has no label\n", __func__,
-			      ofnode_get_name(node));
-			return -EINVAL;
-		}
+		if (!label)
+			label = ofnode_get_name(node);
 		ret = device_bind_driver_to_node(parent, "gpio_led",
 						 ofnode_get_name(node),
 						 node, &dev);