From fac307f3e0f8cf5276f58b82610881bbcea1b6a6 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Thu, 21 Jan 2016 13:49:48 +0100 Subject: of: fill in new type field on node creation The backport of the extcon subsystem also brought a new field in the of node structure. Set it correctly or code using it will think the node comes from ACPI, not from a device-tree. Fixes gpio-leds which otherwise would not find the gpios from the device tree. Signed-off-by: Max Krummenacher Acked-by: Marcel Ziswiler --- drivers/of/fdt.c | 6 ++++++ drivers/of/pdt.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 96ad1ab7f9d6..3531a43d7d3e 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -202,6 +202,12 @@ static void * unflatten_dt_node(struct boot_param_header *blob, __alignof__(struct device_node)); if (allnextpp) { char *fn; + + /* of_node_init(np); throws runtime errors + * 'tried to init an initialized object' + * thus only set the type here. Sideeffect from backporting extcon */ + np->fwnode.type = FWNODE_OF; + np->full_name = fn = ((char *)np) + sizeof(*np); if (new_format) { /* rebuild full path for new format */ diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c index e64fa3d3da5f..38de38601429 100644 --- a/drivers/of/pdt.c +++ b/drivers/of/pdt.c @@ -176,6 +176,11 @@ static struct device_node * __init of_pdt_create_node(phandle node, return NULL; dp = prom_early_alloc(sizeof(*dp)); + /* of_node_init(np); likely will throw runtime errors + * 'tried to init an initialized object' + * thus only set the type here. Sideeffect from backporting extcon */ + np->fwnode.type = FWNODE_OF; + of_pdt_incr_unique_id(dp); dp->parent = parent; -- cgit v1.2.3