From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>,
Alex Nemirovsky <alex.nemirovsky@cortina-access.com>,
Patrick Delaunay <patrick.delaunay@foss.st.com>,
Philippe Reynes <philippe.reynes@softathome.com>,
Sean Anderson <seanga2@gmail.com>, Simon Glass <sjg@chromium.org>,
Steven Lawrance <steven.lawrance@softathome.com>
Subject: [PATCH 1/6] led: Move OF "label" property parsing to core
Date: Mon, 4 Apr 2022 01:18:02 +0200 [thread overview]
Message-ID: <20220403231807.693506-1-marex@denx.de> (raw)
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
next reply other threads:[~2022-04-03 23:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-03 23:18 Marek Vasut [this message]
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
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=20220403231807.693506-1-marex@denx.de \
--to=marex@denx.de \
--cc=alex.nemirovsky@cortina-access.com \
--cc=patrick.delaunay@foss.st.com \
--cc=philippe.reynes@softathome.com \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=steven.lawrance@softathome.com \
--cc=u-boot@lists.denx.de \
/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