diff options
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/dynamic.c | 3 | ||||
-rw-r--r-- | drivers/of/fdt.c | 8 | ||||
-rw-r--r-- | drivers/of/kobj.c | 3 | ||||
-rw-r--r-- | drivers/of/of_reserved_mem.c | 10 | ||||
-rw-r--r-- | drivers/of/platform.c | 2 | ||||
-rw-r--r-- | drivers/of/property.c | 20 |
6 files changed, 27 insertions, 19 deletions
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 08fd823edac9..fe64430b438a 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -286,7 +286,6 @@ int of_detach_node(struct device_node *np) { struct of_reconfig_data rd; unsigned long flags; - int rc = 0; memset(&rd, 0, sizeof(rd)); rd.dn = np; @@ -301,7 +300,7 @@ int of_detach_node(struct device_node *np) of_reconfig_notify(OF_RECONFIG_DETACH_NODE, &rd); - return rc; + return 0; } EXPORT_SYMBOL_GPL(of_detach_node); diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 2cdf64d2456f..4602e467ca8b 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -471,7 +471,7 @@ void *initial_boot_params __ro_after_init; static u32 of_fdt_crc32; /** - * res_mem_reserve_reg() - reserve all memory described in 'reg' property + * __reserved_mem_reserve_reg() - reserve all memory described in 'reg' property */ static int __init __reserved_mem_reserve_reg(unsigned long node, const char *uname) @@ -643,8 +643,6 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, offset = fdt_next_node(blob, offset, &depth)) { pathp = fdt_get_name(blob, offset, NULL); - if (*pathp == '/') - pathp = kbasename(pathp); rc = it(offset, pathp, depth, data); } return rc; @@ -671,8 +669,6 @@ int __init of_scan_flat_dt_subnodes(unsigned long parent, int rc; pathp = fdt_get_name(blob, node, NULL); - if (*pathp == '/') - pathp = kbasename(pathp); rc = it(node, pathp, data); if (rc) return rc; @@ -1078,7 +1074,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, #endif #endif /* CONFIG_CMDLINE */ - pr_debug("Command line is: %s\n", (char*)data); + pr_debug("Command line is: %s\n", (char *)data); rng_seed = of_get_flat_dt_prop(node, "rng-seed", &l); if (rng_seed && l > 0) { diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c index c72eef988041..a32e60b024b8 100644 --- a/drivers/of/kobj.c +++ b/drivers/of/kobj.c @@ -134,8 +134,6 @@ int __of_attach_node_sysfs(struct device_node *np) if (!name) return -ENOMEM; - of_node_get(np); - rc = kobject_add(&np->kobj, parent, "%s", name); kfree(name); if (rc) @@ -144,6 +142,7 @@ int __of_attach_node_sysfs(struct device_node *np) for_each_property_of_node(np, pp) __of_add_property_sysfs(np, pp); + of_node_get(np); return 0; } diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index f61e8739502a..6877080c8af9 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -46,7 +46,7 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, } /** - * res_mem_save_node() - save fdt node for second pass initialization + * fdt_reserved_mem_save_node() - save fdt node for second pass initialization */ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, phys_addr_t base, phys_addr_t size) @@ -68,8 +68,8 @@ void __init fdt_reserved_mem_save_node(unsigned long node, const char *uname, } /** - * res_mem_alloc_size() - allocate reserved memory described by 'size', 'align' - * and 'alloc-ranges' properties + * __reserved_mem_alloc_size() - allocate reserved memory described by + * 'size', 'align' and 'alloc-ranges' properties. */ static int __init __reserved_mem_alloc_size(unsigned long node, const char *uname, phys_addr_t *res_base, phys_addr_t *res_size) @@ -165,7 +165,7 @@ static const struct of_device_id __rmem_of_table_sentinel __used __section(__reservedmem_of_table_end); /** - * res_mem_init_node() - call region specific reserved memory init code + * __reserved_mem_init_node() - call region specific reserved memory init code */ static int __init __reserved_mem_init_node(struct reserved_mem *rmem) { @@ -232,7 +232,7 @@ static void __init __rmem_check_for_overlap(void) } /** - * fdt_init_reserved_mem - allocate and init all saved reserved memory regions + * fdt_init_reserved_mem() - allocate and init all saved reserved memory regions */ void __init fdt_init_reserved_mem(void) { diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 3371e4a06248..3627fee60215 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -291,7 +291,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, #endif /* CONFIG_ARM_AMBA */ /** - * of_devname_lookup() - Given a device node, lookup the preferred Linux name + * of_dev_lookup() - Given a device node, lookup the preferred Linux name */ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *lookup, struct device_node *np) diff --git a/drivers/of/property.c b/drivers/of/property.c index b4916dcc9e72..1f2086f4e7ce 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1045,8 +1045,20 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, * Find the device node that contains the supplier phandle. It may be * @sup_np or it may be an ancestor of @sup_np. */ - while (sup_np && !of_find_property(sup_np, "compatible", NULL)) + while (sup_np) { + + /* Don't allow linking to a disabled supplier */ + if (!of_device_is_available(sup_np)) { + of_node_put(sup_np); + sup_np = NULL; + } + + if (of_find_property(sup_np, "compatible", NULL)) + break; + sup_np = of_get_next_parent(sup_np); + } + if (!sup_np) { dev_dbg(dev, "Not linking to %pOFP - No device\n", tmp_np); return -ENODEV; @@ -1074,7 +1086,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np, return -EAGAIN; } if (!device_link_add(dev, sup_dev, dl_flags)) - ret = -EAGAIN; + ret = -EINVAL; put_device(sup_dev); return ret; } @@ -1206,6 +1218,7 @@ DEFINE_SIMPLE_PROP(interrupt_parent, "interrupt-parent", NULL) DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells") DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells") DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells") +DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") DEFINE_SUFFIX_PROP(gpios, "-gpios", "#gpio-cells") @@ -1230,6 +1243,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_dmas, }, { .parse_prop = parse_power_domains, }, { .parse_prop = parse_hwlocks, }, + { .parse_prop = parse_extcon, }, { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, @@ -1296,7 +1310,7 @@ static int of_link_to_suppliers(struct device *dev, if (of_link_property(dev, con_np, p->name)) ret = -ENODEV; - for_each_child_of_node(con_np, child) + for_each_available_child_of_node(con_np, child) if (of_link_to_suppliers(dev, child) && !ret) ret = -EAGAIN; |