diff mbox series

demo: migrate uclass to livetree

Message ID 20210920175831.1.I218b17a86b820ee611e9dd643c1fb40e2b480257@changeid
State Accepted
Commit 455f2d15bfcf42a002d7d3a38c9c6b2dfe9f518c
Delegated to: Tom Rini
Headers show
Series demo: migrate uclass to livetree | expand

Commit Message

Patrick Delaunay Sept. 20, 2021, 3:58 p.m. UTC
Use dev_ function to read the sides and colour to support a live tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 drivers/demo/demo-uclass.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Simon Glass Sept. 21, 2021, 1:11 a.m. UTC | #1
On Mon, 20 Sept 2021 at 09:58, Patrick Delaunay
<patrick.delaunay@foss.st.com> wrote:
>
> Use dev_ function to read the sides and colour to support a live tree.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
>
>  drivers/demo/demo-uclass.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Oct. 5, 2021, 10:02 p.m. UTC | #2
On Mon, Sep 20, 2021 at 05:58:33PM +0200, Patrick Delaunay wrote:

> Use dev_ function to read the sides and colour to support a live tree.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/demo/demo-uclass.c b/drivers/demo/demo-uclass.c
index 815f8de645..09f9a47d4d 100644
--- a/drivers/demo/demo-uclass.c
+++ b/drivers/demo/demo-uclass.c
@@ -10,15 +10,11 @@ 
 #include <dm.h>
 #include <dm-demo.h>
 #include <errno.h>
-#include <fdtdec.h>
 #include <log.h>
 #include <malloc.h>
-#include <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/list.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 UCLASS_DRIVER(demo) = {
 	.name		= "demo",
 	.id		= UCLASS_DEMO,
@@ -67,10 +63,9 @@  int demo_set_light(struct udevice *dev, int light)
 int demo_parse_dt(struct udevice *dev)
 {
 	struct dm_demo_pdata *pdata = dev_get_plat(dev);
-	int dn = dev_of_offset(dev);
 
-	pdata->sides = fdtdec_get_int(gd->fdt_blob, dn, "sides", 0);
-	pdata->colour = fdt_getprop(gd->fdt_blob, dn, "colour", NULL);
+	pdata->sides = dev_read_s32_default(dev, "sides", 0);
+	pdata->colour = dev_read_string(dev, "colour");
 	if (!pdata->sides || !pdata->colour) {
 		debug("%s: Invalid device tree data\n", __func__);
 		return -EINVAL;