led: Move OF "label" property parsing to core
PATCH 1/6 led: Move OF "label" property parsing to core
Every driver in drivers/led/ currently does some form of "label" OF property parsing in its bind() callback. Move this label parsing to LED core, since this "label" OF property is a generic property. This permits code deduplication in subseuqent patches.
--- drivers/led/led-uclass.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/led/led-uclass.c +12 -0
@@ -95,8 +95,20 @@ int led_default_state(void)return ret; } +static int led_post_bind (struct udevice *dev) +{ +struct led_uc_plat *uc_plat =dev_get_uclass_plat (dev); + + uc_plat->label =dev_read_string (dev,"label" ); +if (!uc_plat->label) + uc_plat->label =ofnode_get_name (dev_ofnode (dev)); + +return 0 ; +} +UCLASS_DRIVER (led) = { .id =UCLASS_LED , .name ="led" , .per_device_plat_auto =sizeof (struct led_uc_plat ), + .post_bind = led_post_bind, };
Signature · 1 line
2.35.1
PATCH 2/6 led: bcm6328: Drop duplicate OF "label" property parsing
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
--- drivers/led/led_bcm6328.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/led/led_bcm6328.c +0 -12
@@ -204,26 +204,14 @@ static int bcm6328_led_bind(struct udevice *parent)ofnode node;dev_for_each_subnode (node, parent) { -struct led_uc_plat *uc_plat;struct udevice *dev; -const char *label;int ret; - label =ofnode_read_string (node,"label" ); -if (!label) { -debug ("%s: node %s has no label\n" , __func__, -ofnode_get_name (node)); -return -EINVAL ; - } - ret =device_bind_driver_to_node (parent,"bcm6328-led" ,ofnode_get_name (node), node, &dev);if (ret)return ret; - - uc_plat =dev_get_uclass_plat (dev); - uc_plat->label = label; }return 0 ;
Signature · 1 line
2.35.1
Re: [PATCH 2/6] led: bcm6328: Drop duplicate OF "label" property parsing
Quoted 10 lines · Marek Vasut
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
Signed-off-by Marek Vasut <[email protected]>Cc Alex Nemirovsky <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Philippe Reynes <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 3/6 led: bcm6358: Drop duplicate OF "label" property parsing
In reply to Marek VasutThe OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
--- drivers/led/led_bcm6358.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/led/led_bcm6358.c +0 -12
@@ -174,26 +174,14 @@ static int bcm6358_led_bind(struct udevice *parent)ofnode node;dev_for_each_subnode (node, parent) { -struct led_uc_plat *uc_plat;struct udevice *dev; -const char *label;int ret; - label =ofnode_read_string (node,"label" ); -if (!label) { -debug ("%s: node %s has no label\n" , __func__, -ofnode_get_name (node)); -return -EINVAL ; - } - ret =device_bind_driver_to_node (parent,"bcm6358-led" ,ofnode_get_name (node), node, &dev);if (ret)return ret; - - uc_plat =dev_get_uclass_plat (dev); - uc_plat->label = label; }return 0 ;
Signature · 1 line
2.35.1
Re: [PATCH 3/6] led: bcm6358: Drop duplicate OF "label" property parsing
Quoted 10 lines · Marek Vasut
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
Signed-off-by Marek Vasut <[email protected]>Cc Alex Nemirovsky <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Philippe Reynes <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 4/6 led: bcm6858: Drop duplicate OF "label" property parsing
In reply to Marek VasutThe OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
--- drivers/led/led_bcm6858.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/led/led_bcm6858.c +0 -12
@@ -211,26 +211,14 @@ static int bcm6858_led_bind(struct udevice *parent)ofnode node;dev_for_each_subnode (node, parent) { -struct led_uc_plat *uc_plat;struct udevice *dev; -const char *label;int ret; - label =ofnode_read_string (node,"label" ); -if (!label) { -debug ("%s: node %s has no label\n" , __func__, -ofnode_get_name (node)); -return -EINVAL ; - } - ret =device_bind_driver_to_node (parent,"bcm6858-led" ,ofnode_get_name (node), node, &dev);if (ret)return ret; - - uc_plat =dev_get_uclass_plat (dev); - uc_plat->label = label; }return 0 ;
Signature · 1 line
2.35.1
Re: [PATCH 4/6] led: bcm6858: Drop duplicate OF "label" property parsing
Quoted 10 lines · Marek Vasut
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
Signed-off-by Marek Vasut <[email protected]>Cc Alex Nemirovsky <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Philippe Reynes <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 5/6 led: cortina: Drop duplicate OF "label" property parsing
In reply to Marek VasutThe OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
--- drivers/led/led_cortina.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/led/led_cortina.c +0 -11
@@ -256,25 +256,14 @@ static int cortina_led_bind(struct udevice *parent)ofnode node;dev_for_each_subnode (node, parent) { -struct led_uc_plat *uc_plat;struct udevice *dev; -const char *label;int ret; - label =ofnode_read_string (node,"label" ); -if (!label) { -debug ("%s: node %s has no label\n" , __func__, -ofnode_get_name (node)); -return -EINVAL ; - } - ret =device_bind_driver_to_node (parent,"ca-leds" ,ofnode_get_name (node), node, &dev);if (ret)return ret; - uc_plat =dev_get_uclass_plat (dev); - uc_plat->label = label; }return 0 ;
Signature · 1 line
2.35.1
Re: [PATCH 5/6] led: cortina: Drop duplicate OF "label" property parsing
Quoted 10 lines · Marek Vasut
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
Signed-off-by Marek Vasut <[email protected]>Cc Alex Nemirovsky <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Philippe Reynes <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 6/6 led: gpio: Drop duplicate OF "label" property parsing
In reply to Marek VasutThe OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
--- drivers/led/led_gpio.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/led/led_gpio.c +0 -8
@@ -95,19 +95,11 @@ static int led_gpio_bind(struct udevice *parent)int ret;dev_for_each_subnode (node, parent) { -struct led_uc_plat *uc_plat; -const char *label; - - label =ofnode_read_string (node,"label" ); -if (!label) - label =ofnode_get_name (node); ret =device_bind_driver_to_node (parent,"gpio_led" ,ofnode_get_name (node), node, &dev);if (ret)return ret; - uc_plat =dev_get_uclass_plat (dev); - uc_plat->label = label; }return 0 ;
Signature · 1 line
2.35.1
Re: [PATCH 6/6] led: gpio: Drop duplicate OF "label" property parsing
Quoted 10 lines · Marek Vasut
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
Signed-off-by Marek Vasut <[email protected]>Cc Alex Nemirovsky <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Philippe Reynes <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 1/2 led: bcm6753: Drop duplicate OF "label" property parsing
In reply to Marek VasutThe OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
--- drivers/led/led_bcm6753.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/led/led_bcm6753.c +0 -12
@@ -229,26 +229,14 @@ static int bcm6753_led_bind(struct udevice *parent)ofnode node;dev_for_each_subnode (node, parent) { -struct led_uc_plat *uc_plat;struct udevice *dev; -const char *label;int ret; - label =ofnode_read_string (node,"label" ); -if (!label) { -debug ("%s: node %s has no label\n" , __func__, -ofnode_get_name (node)); -return -EINVAL ; - } - ret =device_bind_driver_to_node (parent,"bcm6753-led" ,ofnode_get_name (node), node, &dev);if (ret)return ret; - - uc_plat =dev_get_uclass_plat (dev); - uc_plat->label = label; }return 0 ;
Signature · 1 line
2.25.1
PATCH 2/2 led: pwm: Drop duplicate OF "label" property parsing
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
--- drivers/led/led_pwm.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/led/led_pwm.c +0 -10
@@ -151,21 +151,11 @@ static int led_pwm_bind(struct udevice *parent)int ret;dev_for_each_subnode (node, parent) { -struct led_uc_plat *uc_plat; -const char *label; - - label =ofnode_read_string (node,"label" ); -if (!label) - label =ofnode_get_name (node); - ret =device_bind_driver_to_node (parent,LEDS_PWM_DRIVER_NAME ,ofnode_get_name (node), node, &dev);if (ret)return ret; - - uc_plat =dev_get_uclass_plat (dev); - uc_plat->label = label; }return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH 2/2] led: pwm: Drop duplicate OF "label" property parsing
Quoted 4 lines · Tom Rini
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Re: [PATCH 1/2] led: bcm6753: Drop duplicate OF "label" property parsing
In reply to Tom RiniQuoted 4 lines · Tom Rini
The OF "label" property parsing is now handled in LED core, drop the duplicate implementation from this driver.
Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Quoted 5 lines · Marek Vasut
Every driver in
drivers/led/currently does some form of "label" OF property parsing in itsbind()callback. Move this label parsing to LED core, since this "label" OF property is a generic property. This permits code deduplication in subseuqent patches.
Quoted 7 lines
Signed-off-by Marek Vasut <[email protected]>Cc Alex Nemirovsky <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Philippe Reynes <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom