Adjust this function to us an ofnode instead of an offset, so it can be
used with livetree. This involves updating all callers.
Signed-off-by: Simon Glass
---
Changes in v3: None
Changes in v2: None
drivers/clk/at91/pmc.c | 2 +-
drivers/core/lists.c | 15 ++-
drivers/cpu/cpu-uclass.c | 6 +++---
drivers/i2c/muxes/i2c-mux-uclass.c | 11 ---
drivers/led/led_bcm6328.c | 2 +-
drivers/led/led_bcm6358.c | 2 +-
drivers/led/led_gpio.c | 13 +
drivers/misc/tegra186_bpmp.c | 6 +++---
drivers/misc/tegra_car.c | 4 ++--
drivers/net/keystone_net.c | 6 +++---
drivers/pinctrl/pinctrl-uclass.c | 15 ++-
drivers/usb/musb-new/ti-musb.c | 2 +-
include/dm.h | 2 ++
include/dm/lists.h | 2 +-
14 files changed, 39 insertions(+), 49 deletions(-)
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index c552c75562..f4ec5fcb5e 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -79,7 +79,7 @@ int at91_clk_sub_device_bind(struct udevice *dev, const char
*drv_name)
if (!name)
return -EINVAL;
ret = device_bind_driver_to_node(dev, drv_name, name,
-offset, NULL);
+ offset_to_ofnode(offset), NULL);
if (ret)
return ret;
}
diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index facf276474..b79f26dbe6 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -74,11 +74,12 @@ int lists_bind_drivers(struct udevice *parent, bool
pre_reloc_only)
int device_bind_driver(struct udevice *parent, const char *drv_name,
const char *dev_name, struct udevice **devp)
{
- return device_bind_driver_to_node(parent, drv_name, dev_name, -1, devp);
+ return device_bind_driver_to_node(parent, drv_name, dev_name,
+ ofnode_null(), devp);
}
int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
- const char *dev_name, int node,
+ const char *dev_name, ofnode node,
struct udevice **devp)
{
struct driver *drv;
@@ -89,14 +90,10 @@ int device_bind_driver_to_node(struct udevice *parent,
const char *drv_name,
debug("Cannot find driver '%s'\n", drv_name);
return -ENOENT;
}
- ret = device_bind(parent, drv, dev_name, NULL, node, devp);
- if (ret) {
- debug("Cannot create device named '%s' (err=%d)\n",
- dev_name, ret);
- return ret;
- }
+ ret = device_bind_with_driver_data(parent, drv, dev_name, 0 /* data */,
+ node, devp);
- return 0;
+ return ret;
}
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c
index c57ac16b3a..73e4853939 100644
--- a/drivers/cpu/cpu-uclass.c
+++ b/drivers/cpu/cpu-uclass.c
@@ -63,11 +63,11 @@ U_BOOT_DRIVER(cpu_bus) = {
static int uclass_cpu_init(struct uclass *uc)
{
struct udevice *dev;
- int node;
+ ofnode node;
int ret;
- node = fdt_path_offset(gd->fdt_blob, "/cpus");
- if (node < 0)
+ node = ofnode_path("/cpus");
+ if (!ofnode_valid(node))
return 0;
ret = device_bind_driver_to_node(dm_root(), "cpu_bus", "cpus", node,
diff --git a/drivers/i2c/muxes/i2c-mux-uclass.c
b/drivers/i2c/muxes/i2c-mux-uclass.c
index d243b8e32d..187e8a7c91 100644
--- a/drivers/i2c/muxes/i2c-mux-uclass.c
+++ b/drivers/i2c/muxes/i2c-mux-uclass.c
@@ -51,24 +51,21 @@ static int i2c_mux_child_post_bind(struct udevice *dev)
/* Find the I2C buses selected by this mux */
static int i2c_mux_post_bind(struct udevice *mux)
{
- const void *blob = gd->fdt_blob;
+ ofnode node;
int ret;
- int offset;
debug("%s: %s\n", __func__, mux->name);
/*
* There is no compatible string in the sub-nodes, so we must manually
* bind these
*/
- for (offset = fdt_first_subnode(blob, dev_of_offset(mux));
-offset > 0;
-offset = fdt_next_subnode(blob, offset)) {
+ dev_for_each_subnode(node, mux) {
struct udevice *dev;
const char *name;
- name = fdt_get_name(blob, offset, NULL);
+ name = ofnode_get_name(node);
ret = device_bind_driver_to_node(mux, "i2c_mux_bus_drv", name,
-offset, );
+node, );
debug(" - bind ret=%d, %s\n", ret, dev ?