public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/6] led: Move OF "label" property parsing to core
@ 2022-04-03 23:18 Marek Vasut
  2022-04-03 23:18 ` [PATCH 2/6] led: bcm6328: Drop duplicate OF "label" property parsing Marek Vasut
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Marek Vasut @ 2022-04-03 23:18 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Alex Nemirovsky, Patrick Delaunay, Philippe Reynes,
	Sean Anderson, Simon Glass, Steven Lawrance

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.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Philippe Reynes <philippe.reynes@softathome.com>
Cc: Sean Anderson <seanga2@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Steven Lawrance <steven.lawrance@softathome.com>
---
 drivers/led/led-uclass.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c
index 7e298dbb06f..2f4aa18fb10 100644
--- a/drivers/led/led-uclass.c
+++ b/drivers/led/led-uclass.c
@@ -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,
 };
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-04-15 12:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-03 23:18 [PATCH 1/6] led: Move OF "label" property parsing to core Marek Vasut
2022-04-03 23:18 ` [PATCH 2/6] led: bcm6328: Drop duplicate OF "label" property parsing Marek Vasut
2022-04-15 12:07   ` Tom Rini
2022-04-03 23:18 ` [PATCH 3/6] led: bcm6358: " Marek Vasut
2022-04-15 12:07   ` Tom Rini
2022-04-03 23:18 ` [PATCH 4/6] led: bcm6858: " Marek Vasut
2022-04-15 12:07   ` Tom Rini
2022-04-03 23:18 ` [PATCH 5/6] led: cortina: " Marek Vasut
2022-04-15 12:07   ` Tom Rini
2022-04-03 23:18 ` [PATCH 6/6] led: gpio: " Marek Vasut
2022-04-15 12:07   ` Tom Rini
2022-04-14 14:14 ` [PATCH 1/2] led: bcm6753: " Tom Rini
2022-04-14 14:15   ` [PATCH 2/2] led: pwm: " Tom Rini
2022-04-15 12:08     ` Tom Rini
2022-04-15 12:07   ` [PATCH 1/2] led: bcm6753: " Tom Rini
2022-04-15 12:07 ` [PATCH 1/6] led: Move OF "label" property parsing to core Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox