struct device_node has its own resources and a pointer to associated device_d. With recent platform related OF code, we can convert the only user of it and remove those pointers from struct device_node. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx> --- Cc: barebox@xxxxxxxxxxxxxxxxxxx --- drivers/of/base.c | 8 ++++---- drivers/of/gpio.c | 6 +++++- include/of.h | 3 --- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 9d63127..0244281 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1594,6 +1594,7 @@ void of_free(struct device_node *node) { struct device_node *n, *nt; struct property *p, *pt; + struct device_d *dev; if (!node) return; @@ -1610,10 +1611,9 @@ void of_free(struct device_node *node) list_del(&node->list); } - if (node->device) - node->device->device_node = NULL; - else - free(node->resource); + dev = of_find_device_by_node(node); + if (dev) + dev->device_node = NULL; free(node->name); free(node->full_name); diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c index 41e91ec..7f6d99c 100644 --- a/drivers/of/gpio.c +++ b/drivers/of/gpio.c @@ -10,6 +10,10 @@ int of_get_named_gpio(struct device_node *np, { int ret; struct of_phandle_args out_args; + struct device_d *dev = of_find_device_by_node(np); + + if (!dev) + return -EINVAL; ret = of_parse_phandle_with_args(np, propname, "#gpio-cells", index, &out_args); @@ -18,7 +22,7 @@ int of_get_named_gpio(struct device_node *np, return -EINVAL; } - ret = gpio_get_num(out_args.np->device, out_args.args[0]); + ret = gpio_get_num(dev, out_args.args[0]); if (ret < 0) return ret; diff --git a/include/of.h b/include/of.h index f1f555f..0298189 100644 --- a/include/of.h +++ b/include/of.h @@ -30,9 +30,6 @@ struct device_node { struct list_head children; struct list_head parent_list; struct list_head list; - struct resource *resource; - int num_resource; - struct device_d *device; struct list_head phandles; phandle phandle; }; -- 1.7.2.5 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox