demo: migrate uclass to livetree
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>
This commit is contained in:
parent
e2170c29ee
commit
455f2d15bf
1 changed files with 2 additions and 7 deletions
|
@ -10,15 +10,11 @@
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <dm-demo.h>
|
#include <dm-demo.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fdtdec.h>
|
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <asm/global_data.h>
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
|
||||||
|
|
||||||
UCLASS_DRIVER(demo) = {
|
UCLASS_DRIVER(demo) = {
|
||||||
.name = "demo",
|
.name = "demo",
|
||||||
.id = UCLASS_DEMO,
|
.id = UCLASS_DEMO,
|
||||||
|
@ -67,10 +63,9 @@ int demo_set_light(struct udevice *dev, int light)
|
||||||
int demo_parse_dt(struct udevice *dev)
|
int demo_parse_dt(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct dm_demo_pdata *pdata = dev_get_plat(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->sides = dev_read_s32_default(dev, "sides", 0);
|
||||||
pdata->colour = fdt_getprop(gd->fdt_blob, dn, "colour", NULL);
|
pdata->colour = dev_read_string(dev, "colour");
|
||||||
if (!pdata->sides || !pdata->colour) {
|
if (!pdata->sides || !pdata->colour) {
|
||||||
debug("%s: Invalid device tree data\n", __func__);
|
debug("%s: Invalid device tree data\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in a new issue