Commit 0d638a07 authored by Rob Herring's avatar Rob Herring

of: Convert to using %pOF instead of full_name

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent b4032ff9
...@@ -559,7 +559,7 @@ static u64 __of_translate_address(struct device_node *dev, ...@@ -559,7 +559,7 @@ static u64 __of_translate_address(struct device_node *dev,
int na, ns, pna, pns; int na, ns, pna, pns;
u64 result = OF_BAD_ADDR; u64 result = OF_BAD_ADDR;
pr_debug("** translation for device %s **\n", of_node_full_name(dev)); pr_debug("** translation for device %pOF **\n", dev);
/* Increase refcount at current level */ /* Increase refcount at current level */
of_node_get(dev); of_node_get(dev);
...@@ -573,13 +573,13 @@ static u64 __of_translate_address(struct device_node *dev, ...@@ -573,13 +573,13 @@ static u64 __of_translate_address(struct device_node *dev,
/* Count address cells & copy address locally */ /* Count address cells & copy address locally */
bus->count_cells(dev, &na, &ns); bus->count_cells(dev, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) { if (!OF_CHECK_COUNTS(na, ns)) {
pr_debug("Bad cell count for %s\n", of_node_full_name(dev)); pr_debug("Bad cell count for %pOF\n", dev);
goto bail; goto bail;
} }
memcpy(addr, in_addr, na * 4); memcpy(addr, in_addr, na * 4);
pr_debug("bus is %s (na=%d, ns=%d) on %s\n", pr_debug("bus is %s (na=%d, ns=%d) on %pOF\n",
bus->name, na, ns, of_node_full_name(parent)); bus->name, na, ns, parent);
of_dump_addr("translating address:", addr, na); of_dump_addr("translating address:", addr, na);
/* Translate */ /* Translate */
...@@ -600,13 +600,12 @@ static u64 __of_translate_address(struct device_node *dev, ...@@ -600,13 +600,12 @@ static u64 __of_translate_address(struct device_node *dev,
pbus = of_match_bus(parent); pbus = of_match_bus(parent);
pbus->count_cells(dev, &pna, &pns); pbus->count_cells(dev, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) { if (!OF_CHECK_COUNTS(pna, pns)) {
pr_err("Bad cell count for %s\n", pr_err("Bad cell count for %pOF\n", dev);
of_node_full_name(dev));
break; break;
} }
pr_debug("parent bus is %s (na=%d, ns=%d) on %s\n", pr_debug("parent bus is %s (na=%d, ns=%d) on %pOF\n",
pbus->name, pna, pns, of_node_full_name(parent)); pbus->name, pna, pns, parent);
/* Apply bus translation */ /* Apply bus translation */
if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop)) if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop))
...@@ -855,7 +854,7 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz ...@@ -855,7 +854,7 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
} }
if (!ranges) { if (!ranges) {
pr_debug("no dma-ranges found for node(%s)\n", np->full_name); pr_debug("no dma-ranges found for node(%pOF)\n", np);
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} }
...@@ -872,8 +871,8 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz ...@@ -872,8 +871,8 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
dmaaddr = of_read_number(ranges, naddr); dmaaddr = of_read_number(ranges, naddr);
*paddr = of_translate_dma_address(np, ranges); *paddr = of_translate_dma_address(np, ranges);
if (*paddr == OF_BAD_ADDR) { if (*paddr == OF_BAD_ADDR) {
pr_err("translation of DMA address(%pad) to CPU address failed node(%s)\n", pr_err("translation of DMA address(%pad) to CPU address failed node(%pOF)\n",
dma_addr, np->full_name); dma_addr, np);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
......
...@@ -160,7 +160,7 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp) ...@@ -160,7 +160,7 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp)
pp->attr.read = of_node_property_read; pp->attr.read = of_node_property_read;
rc = sysfs_create_bin_file(&np->kobj, &pp->attr); rc = sysfs_create_bin_file(&np->kobj, &pp->attr);
WARN(rc, "error adding attribute %s to node %s\n", pp->name, np->full_name); WARN(rc, "error adding attribute %s to node %pOF\n", pp->name, np);
return rc; return rc;
} }
...@@ -1122,7 +1122,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle); ...@@ -1122,7 +1122,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) void of_print_phandle_args(const char *msg, const struct of_phandle_args *args)
{ {
int i; int i;
printk("%s %s", msg, of_node_full_name(args->np)); printk("%s %pOF", msg, args->np);
for (i = 0; i < args->args_count; i++) { for (i = 0; i < args->args_count; i++) {
const char delim = i ? ',' : ':'; const char delim = i ? ',' : ':';
...@@ -1184,17 +1184,17 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it) ...@@ -1184,17 +1184,17 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)
if (it->cells_name) { if (it->cells_name) {
if (!it->node) { if (!it->node) {
pr_err("%s: could not find phandle\n", pr_err("%pOF: could not find phandle\n",
it->parent->full_name); it->parent);
goto err; goto err;
} }
if (of_property_read_u32(it->node, it->cells_name, if (of_property_read_u32(it->node, it->cells_name,
&count)) { &count)) {
pr_err("%s: could not get %s for %s\n", pr_err("%pOF: could not get %s for %pOF\n",
it->parent->full_name, it->parent,
it->cells_name, it->cells_name,
it->node->full_name); it->node);
goto err; goto err;
} }
} else { } else {
...@@ -1206,8 +1206,8 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it) ...@@ -1206,8 +1206,8 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)
* property data length * property data length
*/ */
if (it->cur + count > it->list_end) { if (it->cur + count > it->list_end) {
pr_err("%s: arguments longer than property\n", pr_err("%pOF: arguments longer than property\n",
it->parent->full_name); it->parent);
goto err; goto err;
} }
} }
...@@ -1639,8 +1639,8 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np, ...@@ -1639,8 +1639,8 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np,
strncpy(ap->stem, stem, stem_len); strncpy(ap->stem, stem, stem_len);
ap->stem[stem_len] = 0; ap->stem[stem_len] = 0;
list_add_tail(&ap->link, &aliases_lookup); list_add_tail(&ap->link, &aliases_lookup);
pr_debug("adding DT alias:%s: stem=%s id=%i node=%s\n", pr_debug("adding DT alias:%s: stem=%s id=%i node=%pOF\n",
ap->alias, ap->stem, ap->id, of_node_full_name(np)); ap->alias, ap->stem, ap->id, np);
} }
/** /**
......
...@@ -294,7 +294,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -294,7 +294,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
return; return;
add_uevent_var(env, "OF_NAME=%s", dev->of_node->name); add_uevent_var(env, "OF_NAME=%s", dev->of_node->name);
add_uevent_var(env, "OF_FULLNAME=%s", dev->of_node->full_name); add_uevent_var(env, "OF_FULLNAME=%pOF", dev->of_node);
if (dev->of_node->type && strcmp("<NULL>", dev->of_node->type) != 0) if (dev->of_node->type && strcmp("<NULL>", dev->of_node->type) != 0)
add_uevent_var(env, "OF_TYPE=%s", dev->of_node->type); add_uevent_var(env, "OF_TYPE=%s", dev->of_node->type);
......
...@@ -98,14 +98,14 @@ int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p) ...@@ -98,14 +98,14 @@ int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p)
switch (action) { switch (action) {
case OF_RECONFIG_ATTACH_NODE: case OF_RECONFIG_ATTACH_NODE:
case OF_RECONFIG_DETACH_NODE: case OF_RECONFIG_DETACH_NODE:
pr_debug("notify %-15s %s\n", action_names[action], pr_debug("notify %-15s %pOF\n", action_names[action],
pr->dn->full_name); pr->dn);
break; break;
case OF_RECONFIG_ADD_PROPERTY: case OF_RECONFIG_ADD_PROPERTY:
case OF_RECONFIG_REMOVE_PROPERTY: case OF_RECONFIG_REMOVE_PROPERTY:
case OF_RECONFIG_UPDATE_PROPERTY: case OF_RECONFIG_UPDATE_PROPERTY:
pr_debug("notify %-15s %s:%s\n", action_names[action], pr_debug("notify %-15s %pOF:%s\n", action_names[action],
pr->dn->full_name, pr->prop->name); pr->dn, pr->prop->name);
break; break;
} }
...@@ -328,11 +328,10 @@ void of_node_release(struct kobject *kobj) ...@@ -328,11 +328,10 @@ void of_node_release(struct kobject *kobj)
/* We should never be releasing nodes that haven't been detached. */ /* We should never be releasing nodes that haven't been detached. */
if (!of_node_check_flag(node, OF_DETACHED)) { if (!of_node_check_flag(node, OF_DETACHED)) {
pr_err("ERROR: Bad of_node_put() on %s\n", node->full_name); pr_err("ERROR: Bad of_node_put() on %pOF\n", node);
dump_stack(); dump_stack();
return; return;
} }
if (!of_node_check_flag(node, OF_DYNAMIC)) if (!of_node_check_flag(node, OF_DYNAMIC))
return; return;
...@@ -462,13 +461,13 @@ static void __of_changeset_entry_dump(struct of_changeset_entry *ce) ...@@ -462,13 +461,13 @@ static void __of_changeset_entry_dump(struct of_changeset_entry *ce)
case OF_RECONFIG_ADD_PROPERTY: case OF_RECONFIG_ADD_PROPERTY:
case OF_RECONFIG_REMOVE_PROPERTY: case OF_RECONFIG_REMOVE_PROPERTY:
case OF_RECONFIG_UPDATE_PROPERTY: case OF_RECONFIG_UPDATE_PROPERTY:
pr_debug("cset<%p> %-15s %s/%s\n", ce, action_names[ce->action], pr_debug("cset<%p> %-15s %pOF/%s\n", ce, action_names[ce->action],
ce->np->full_name, ce->prop->name); ce->np, ce->prop->name);
break; break;
case OF_RECONFIG_ATTACH_NODE: case OF_RECONFIG_ATTACH_NODE:
case OF_RECONFIG_DETACH_NODE: case OF_RECONFIG_DETACH_NODE:
pr_debug("cset<%p> %-15s %s\n", ce, action_names[ce->action], pr_debug("cset<%p> %-15s %pOF\n", ce, action_names[ce->action],
ce->np->full_name); ce->np);
break; break;
} }
} }
...@@ -539,7 +538,7 @@ static void __of_changeset_entry_notify(struct of_changeset_entry *ce, bool reve ...@@ -539,7 +538,7 @@ static void __of_changeset_entry_notify(struct of_changeset_entry *ce, bool reve
} }
if (ret) if (ret)
pr_err("changeset notifier error @%s\n", ce->np->full_name); pr_err("changeset notifier error @%pOF\n", ce->np);
} }
static int __of_changeset_entry_apply(struct of_changeset_entry *ce) static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
...@@ -570,8 +569,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce) ...@@ -570,8 +569,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
ret = __of_add_property(ce->np, ce->prop); ret = __of_add_property(ce->np, ce->prop);
if (ret) { if (ret) {
pr_err("changeset: add_property failed @%s/%s\n", pr_err("changeset: add_property failed @%pOF/%s\n",
ce->np->full_name, ce->np,
ce->prop->name); ce->prop->name);
break; break;
} }
...@@ -579,8 +578,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce) ...@@ -579,8 +578,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
case OF_RECONFIG_REMOVE_PROPERTY: case OF_RECONFIG_REMOVE_PROPERTY:
ret = __of_remove_property(ce->np, ce->prop); ret = __of_remove_property(ce->np, ce->prop);
if (ret) { if (ret) {
pr_err("changeset: remove_property failed @%s/%s\n", pr_err("changeset: remove_property failed @%pOF/%s\n",
ce->np->full_name, ce->np,
ce->prop->name); ce->prop->name);
break; break;
} }
...@@ -598,8 +597,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce) ...@@ -598,8 +597,8 @@ static int __of_changeset_entry_apply(struct of_changeset_entry *ce)
ret = __of_update_property(ce->np, ce->prop, &old_prop); ret = __of_update_property(ce->np, ce->prop, &old_prop);
if (ret) { if (ret) {
pr_err("changeset: update_property failed @%s/%s\n", pr_err("changeset: update_property failed @%pOF/%s\n",
ce->np->full_name, ce->np,
ce->prop->name); ce->prop->name);
break; break;
} }
......
...@@ -131,7 +131,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) ...@@ -131,7 +131,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
goto fail; goto fail;
} }
pr_debug("of_irq_parse_raw: ipar=%s, size=%d\n", of_node_full_name(ipar), intsize); pr_debug("of_irq_parse_raw: ipar=%pOF, size=%d\n", ipar, intsize);
if (out_irq->args_count != intsize) if (out_irq->args_count != intsize)
goto fail; goto fail;
...@@ -269,7 +269,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) ...@@ -269,7 +269,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
skiplevel: skiplevel:
/* Iterate again with new parent */ /* Iterate again with new parent */
out_irq->np = newpar; out_irq->np = newpar;
pr_debug(" -> new parent: %s\n", of_node_full_name(newpar)); pr_debug(" -> new parent: %pOF\n", newpar);
of_node_put(ipar); of_node_put(ipar);
ipar = newpar; ipar = newpar;
newpar = NULL; newpar = NULL;
...@@ -301,7 +301,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar ...@@ -301,7 +301,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
u32 intsize, intlen; u32 intsize, intlen;
int i, res; int i, res;
pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); pr_debug("of_irq_parse_one: dev=%pOF, index=%d\n", device, index);
/* OldWorld mac stuff is "special", handle out of line */ /* OldWorld mac stuff is "special", handle out of line */
if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
...@@ -555,8 +555,8 @@ void __init of_irq_init(const struct of_device_id *matches) ...@@ -555,8 +555,8 @@ void __init of_irq_init(const struct of_device_id *matches)
of_node_set_flag(desc->dev, OF_POPULATED); of_node_set_flag(desc->dev, OF_POPULATED);
pr_debug("of_irq_init: init %s (%p), parent %p\n", pr_debug("of_irq_init: init %pOF (%p), parent %p\n",
desc->dev->full_name, desc->dev,
desc->dev, desc->interrupt_parent); desc->dev, desc->interrupt_parent);
ret = desc->irq_init_cb(desc->dev, ret = desc->irq_init_cb(desc->dev,
desc->interrupt_parent); desc->interrupt_parent);
......
...@@ -166,8 +166,8 @@ static bool of_mdiobus_child_is_phy(struct device_node *child) ...@@ -166,8 +166,8 @@ static bool of_mdiobus_child_is_phy(struct device_node *child)
if (of_match_node(whitelist_phys, child)) { if (of_match_node(whitelist_phys, child)) {
pr_warn(FW_WARN pr_warn(FW_WARN
"%s: Whitelisted compatible string. Please remove\n", "%pOF: Whitelisted compatible string. Please remove\n",
child->full_name); child);
return true; return true;
} }
......
...@@ -204,15 +204,15 @@ int of_pci_get_host_bridge_resources(struct device_node *dev, ...@@ -204,15 +204,15 @@ int of_pci_get_host_bridge_resources(struct device_node *dev,
if (!bus_range) if (!bus_range)
return -ENOMEM; return -ENOMEM;
pr_info("host bridge %s ranges:\n", dev->full_name); pr_info("host bridge %pOF ranges:\n", dev);
err = of_pci_parse_bus_range(dev, bus_range); err = of_pci_parse_bus_range(dev, bus_range);
if (err) { if (err) {
bus_range->start = busno; bus_range->start = busno;
bus_range->end = bus_max; bus_range->end = bus_max;
bus_range->flags = IORESOURCE_BUS; bus_range->flags = IORESOURCE_BUS;
pr_info(" No bus range found for %s, using %pR\n", pr_info(" No bus range found for %pOF, using %pR\n",
dev->full_name, bus_range); dev, bus_range);
} else { } else {
if (bus_range->end > bus_range->start + bus_max) if (bus_range->end > bus_range->start + bus_max)
bus_range->end = bus_range->start + bus_max; bus_range->end = bus_range->start + bus_max;
...@@ -258,14 +258,14 @@ int of_pci_get_host_bridge_resources(struct device_node *dev, ...@@ -258,14 +258,14 @@ int of_pci_get_host_bridge_resources(struct device_node *dev,
if (resource_type(res) == IORESOURCE_IO) { if (resource_type(res) == IORESOURCE_IO) {
if (!io_base) { if (!io_base) {
pr_err("I/O range found for %s. Please provide an io_base pointer to save CPU base address\n", pr_err("I/O range found for %pOF. Please provide an io_base pointer to save CPU base address\n",
dev->full_name); dev);
err = -EINVAL; err = -EINVAL;
goto conversion_failed; goto conversion_failed;
} }
if (*io_base != (resource_size_t)OF_BAD_ADDR) if (*io_base != (resource_size_t)OF_BAD_ADDR)
pr_warn("More than one I/O resource converted for %s. CPU base address for old range lost!\n", pr_warn("More than one I/O resource converted for %pOF. CPU base address for old range lost!\n",
dev->full_name); dev);
*io_base = range.cpu_addr; *io_base = range.cpu_addr;
} }
...@@ -325,7 +325,7 @@ int of_pci_map_rid(struct device_node *np, u32 rid, ...@@ -325,7 +325,7 @@ int of_pci_map_rid(struct device_node *np, u32 rid,
} }
if (!map_len || map_len % (4 * sizeof(*map))) { if (!map_len || map_len % (4 * sizeof(*map))) {
pr_err("%s: Error: Bad %s length: %d\n", np->full_name, pr_err("%pOF: Error: Bad %s length: %d\n", np,
map_name, map_len); map_name, map_len);
return -EINVAL; return -EINVAL;
} }
...@@ -349,8 +349,8 @@ int of_pci_map_rid(struct device_node *np, u32 rid, ...@@ -349,8 +349,8 @@ int of_pci_map_rid(struct device_node *np, u32 rid,
u32 rid_len = be32_to_cpup(map + 3); u32 rid_len = be32_to_cpup(map + 3);
if (rid_base & ~map_mask) { if (rid_base & ~map_mask) {
pr_err("%s: Invalid %s translation - %s-mask (0x%x) ignores rid-base (0x%x)\n", pr_err("%pOF: Invalid %s translation - %s-mask (0x%x) ignores rid-base (0x%x)\n",
np->full_name, map_name, map_name, np, map_name, map_name,
map_mask, rid_base); map_mask, rid_base);
return -EFAULT; return -EFAULT;
} }
...@@ -375,14 +375,13 @@ int of_pci_map_rid(struct device_node *np, u32 rid, ...@@ -375,14 +375,13 @@ int of_pci_map_rid(struct device_node *np, u32 rid,
if (id_out) if (id_out)
*id_out = masked_rid - rid_base + out_base; *id_out = masked_rid - rid_base + out_base;
pr_debug("%s: %s, using mask %08x, rid-base: %08x, out-base: %08x, length: %08x, rid: %08x -> %08x\n", pr_debug("%pOF: %s, using mask %08x, rid-base: %08x, out-base: %08x, length: %08x, rid: %08x -> %08x\n",
np->full_name, map_name, map_mask, rid_base, out_base, np, map_name, map_mask, rid_base, out_base,
rid_len, rid, *id_out); rid_len, rid, *id_out);
return 0; return 0;
} }
pr_err("%s: Invalid %s translation - no match for rid 0x%x on %s\n", pr_err("%pOF: Invalid %s translation - no match for rid 0x%x on %pOF\n",
np->full_name, map_name, rid, np, map_name, rid, target && *target ? *target : NULL);
target && *target ? (*target)->full_name : "any target");
return -EFAULT; return -EFAULT;
} }
...@@ -141,7 +141,7 @@ static int of_overlay_apply_single_device_node(struct of_overlay *ov, ...@@ -141,7 +141,7 @@ static int of_overlay_apply_single_device_node(struct of_overlay *ov,
of_node_put(tchild); of_node_put(tchild);
} else { } else {
/* create empty tree as a target */ /* create empty tree as a target */
tchild = __of_node_dup(child, "%s/%s", target->full_name, cname); tchild = __of_node_dup(child, "%pOF/%s", target, cname);
if (!tchild) if (!tchild)
return -ENOMEM; return -ENOMEM;
...@@ -177,8 +177,8 @@ static int of_overlay_apply_one(struct of_overlay *ov, ...@@ -177,8 +177,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,
for_each_property_of_node(overlay, prop) { for_each_property_of_node(overlay, prop) {
ret = of_overlay_apply_single_property(ov, target, prop); ret = of_overlay_apply_single_property(ov, target, prop);
if (ret) { if (ret) {
pr_err("Failed to apply prop @%s/%s\n", pr_err("Failed to apply prop @%pOF/%s\n",
target->full_name, prop->name); target, prop->name);
return ret; return ret;
} }
} }
...@@ -186,8 +186,8 @@ static int of_overlay_apply_one(struct of_overlay *ov, ...@@ -186,8 +186,8 @@ static int of_overlay_apply_one(struct of_overlay *ov,
for_each_child_of_node(overlay, child) { for_each_child_of_node(overlay, child) {
ret = of_overlay_apply_single_device_node(ov, target, child); ret = of_overlay_apply_single_device_node(ov, target, child);
if (ret != 0) { if (ret != 0) {
pr_err("Failed to apply single node @%s/%s\n", pr_err("Failed to apply single node @%pOF/%s\n",
target->full_name, child->name); target, child->name);
of_node_put(child); of_node_put(child);
return ret; return ret;
} }
...@@ -215,7 +215,7 @@ static int of_overlay_apply(struct of_overlay *ov) ...@@ -215,7 +215,7 @@ static int of_overlay_apply(struct of_overlay *ov)
err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay); err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay);
if (err != 0) { if (err != 0) {
pr_err("apply failed '%s'\n", ovinfo->target->full_name); pr_err("apply failed '%pOF'\n", ovinfo->target);
return err; return err;
} }
} }
...@@ -400,8 +400,8 @@ int of_overlay_create(struct device_node *tree) ...@@ -400,8 +400,8 @@ int of_overlay_create(struct device_node *tree)
/* build the overlay info structures */ /* build the overlay info structures */
err = of_build_overlay_info(ov, tree); err = of_build_overlay_info(ov, tree);
if (err) { if (err) {
pr_err("of_build_overlay_info() failed for tree@%s\n", pr_err("of_build_overlay_info() failed for tree@%pOF\n",
tree->full_name); tree);
goto err_free_idr; goto err_free_idr;
} }
...@@ -480,9 +480,8 @@ static int overlay_is_topmost(struct of_overlay *ov, struct device_node *dn) ...@@ -480,9 +480,8 @@ static int overlay_is_topmost(struct of_overlay *ov, struct device_node *dn)
/* check against each subtree affected by this overlay */ /* check against each subtree affected by this overlay */
list_for_each_entry(ce, &ovt->cset.entries, node) { list_for_each_entry(ce, &ovt->cset.entries, node) {
if (overlay_subtree_check(ce->np, dn)) { if (overlay_subtree_check(ce->np, dn)) {
pr_err("%s: #%d clashes #%d @%s\n", pr_err("%s: #%d clashes #%d @%pOF\n",
__func__, ov->id, ovt->id, __func__, ov->id, ovt->id, dn);
dn->full_name);
return 0; return 0;
} }
} }
......
...@@ -228,7 +228,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, ...@@ -228,7 +228,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
const void *prop; const void *prop;
int i, ret; int i, ret;
pr_debug("Creating amba device %s\n", node->full_name); pr_debug("Creating amba device %pOF\n", node);
if (!of_device_is_available(node) || if (!of_device_is_available(node) ||
of_node_test_and_set_flag(node, OF_POPULATED)) of_node_test_and_set_flag(node, OF_POPULATED))
...@@ -259,15 +259,15 @@ static struct amba_device *of_amba_device_create(struct device_node *node, ...@@ -259,15 +259,15 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
ret = of_address_to_resource(node, 0, &dev->res); ret = of_address_to_resource(node, 0, &dev->res);
if (ret) { if (ret) {
pr_err("amba: of_address_to_resource() failed (%d) for %s\n", pr_err("amba: of_address_to_resource() failed (%d) for %pOF\n",
ret, node->full_name); ret, node);
goto err_free; goto err_free;
} }
ret = amba_device_add(dev, &iomem_resource); ret = amba_device_add(dev, &iomem_resource);
if (ret) { if (ret) {
pr_err("amba_device_add() failed (%d) for %s\n", pr_err("amba_device_add() failed (%d) for %pOF\n",
ret, node->full_name); ret, node);
goto err_free; goto err_free;
} }
...@@ -310,7 +310,7 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l ...@@ -310,7 +310,7 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
if (!of_address_to_resource(np, 0, &res)) if (!of_address_to_resource(np, 0, &res))
if (res.start != auxdata->phys_addr) if (res.start != auxdata->phys_addr)
continue; continue;
pr_debug("%s: devname=%s\n", np->full_name, auxdata->name); pr_debug("%pOF: devname=%s\n", np, auxdata->name);
return auxdata; return auxdata;
} }
...@@ -323,7 +323,7 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l ...@@ -323,7 +323,7 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
if (!of_device_is_compatible(np, auxdata->compatible)) if (!of_device_is_compatible(np, auxdata->compatible))
continue; continue;
if (!auxdata->phys_addr && !auxdata->name) { if (!auxdata->phys_addr && !auxdata->name) {
pr_debug("%s: compatible match\n", np->full_name); pr_debug("%pOF: compatible match\n", np);
return auxdata; return auxdata;
} }
} }
...@@ -356,14 +356,14 @@ static int of_platform_bus_create(struct device_node *bus, ...@@ -356,14 +356,14 @@ static int of_platform_bus_create(struct device_node *bus,
/* Make sure it has a compatible property */ /* Make sure it has a compatible property */
if (strict && (!of_get_property(bus, "compatible", NULL))) { if (strict && (!of_get_property(bus, "compatible", NULL))) {
pr_debug("%s() - skipping %s, no compatible prop\n", pr_debug("%s() - skipping %pOF, no compatible prop\n",
__func__, bus->full_name); __func__, bus);
return 0; return 0;
} }
if (of_node_check_flag(bus, OF_POPULATED_BUS)) { if (of_node_check_flag(bus, OF_POPULATED_BUS)) {
pr_debug("%s() - skipping %s, already populated\n", pr_debug("%s() - skipping %pOF, already populated\n",
__func__, bus->full_name); __func__, bus);
return 0; return 0;
} }
...@@ -387,7 +387,7 @@ static int of_platform_bus_create(struct device_node *bus, ...@@ -387,7 +387,7 @@ static int of_platform_bus_create(struct device_node *bus,
return 0; return 0;
for_each_child_of_node(bus, child) { for_each_child_of_node(bus, child) {
pr_debug(" create child: %s\n", child->full_name); pr_debug(" create child: %pOF\n", child);
rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
if (rc) { if (rc) {
of_node_put(child); of_node_put(child);
...@@ -419,7 +419,7 @@ int of_platform_bus_probe(struct device_node *root, ...@@ -419,7 +419,7 @@ int of_platform_bus_probe(struct device_node *root,
return -EINVAL; return -EINVAL;
pr_debug("%s()\n", __func__); pr_debug("%s()\n", __func__);
pr_debug(" starting at: %s\n", root->full_name); pr_debug(" starting at: %pOF\n", root);
/* Do a self check of bus type, if there's a match, create children */ /* Do a self check of bus type, if there's a match, create children */
if (of_match_node(matches, root)) { if (of_match_node(matches, root)) {
...@@ -471,7 +471,7 @@ int of_platform_populate(struct device_node *root, ...@@ -471,7 +471,7 @@ int of_platform_populate(struct device_node *root,
return -EINVAL; return -EINVAL;
pr_debug("%s()\n", __func__); pr_debug("%s()\n", __func__);
pr_debug(" starting at: %s\n", root->full_name); pr_debug(" starting at: %pOF\n", root);
for_each_child_of_node(root, child) { for_each_child_of_node(root, child) {
rc = of_platform_bus_create(child, matches, lookup, parent, true); rc = of_platform_bus_create(child, matches, lookup, parent, true);
...@@ -660,8 +660,8 @@ static int of_platform_notify(struct notifier_block *nb, ...@@ -660,8 +660,8 @@ static int of_platform_notify(struct notifier_block *nb,
of_dev_put(pdev_parent); of_dev_put(pdev_parent);
if (pdev == NULL) { if (pdev == NULL) {
pr_err("%s: failed to create for '%s'\n", pr_err("%s: failed to create for '%pOF'\n",
__func__, rd->dn->full_name); __func__, rd->dn);
/* of_platform_device_create tosses the error code */ /* of_platform_device_create tosses the error code */
return notifier_from_errno(-EINVAL); return notifier_from_errno(-EINVAL);
} }
......
...@@ -55,8 +55,8 @@ int of_property_count_elems_of_size(const struct device_node *np, ...@@ -55,8 +55,8 @@ int of_property_count_elems_of_size(const struct device_node *np,
return -ENODATA; return -ENODATA;
if (prop->length % elem_size != 0) { if (prop->length % elem_size != 0) {
pr_err("size of %s in node %s is not a multiple of %d\n", pr_err("size of %s in node %pOF is not a multiple of %d\n",
propname, np->full_name, elem_size); propname, np, elem_size);
return -EINVAL; return -EINVAL;
} }
...@@ -537,8 +537,8 @@ int of_graph_parse_endpoint(const struct device_node *node, ...@@ -537,8 +537,8 @@ int of_graph_parse_endpoint(const struct device_node *node,
{ {
struct device_node *port_node = of_get_parent(node); struct device_node *port_node = of_get_parent(node);
WARN_ONCE(!port_node, "%s(): endpoint %s has no parent node\n", WARN_ONCE(!port_node, "%s(): endpoint %pOF has no parent node\n",
__func__, node->full_name); __func__, node);
memset(endpoint, 0, sizeof(*endpoint)); memset(endpoint, 0, sizeof(*endpoint));
...@@ -621,14 +621,13 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, ...@@ -621,14 +621,13 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
of_node_put(node); of_node_put(node);
if (!port) { if (!port) {
pr_err("graph: no port node found in %s\n", pr_err("graph: no port node found in %pOF\n", parent);
parent->full_name);
return NULL; return NULL;
} }
} else { } else {
port = of_get_parent(prev); port = of_get_parent(prev);
if (WARN_ONCE(!port, "%s(): endpoint %s has no parent node\n", if (WARN_ONCE(!port, "%s(): endpoint %pOF has no parent node\n",
__func__, prev->full_name)) __func__, prev))
return NULL; return NULL;
} }
...@@ -784,8 +783,8 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node, ...@@ -784,8 +783,8 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node,
endpoint_node = of_graph_get_endpoint_by_regs(node, port, endpoint); endpoint_node = of_graph_get_endpoint_by_regs(node, port, endpoint);
if (!endpoint_node) { if (!endpoint_node) {
pr_debug("no valid endpoint (%d, %d) for node %s\n", pr_debug("no valid endpoint (%d, %d) for node %pOF\n",
port, endpoint, node->full_name); port, endpoint, node);
return NULL; return NULL;
} }
......
...@@ -46,46 +46,54 @@ static struct unittest_results { ...@@ -46,46 +46,54 @@ static struct unittest_results {
static void __init of_unittest_find_node_by_name(void) static void __init of_unittest_find_node_by_name(void)
{ {
struct device_node *np; struct device_node *np;
const char *options; const char *options, *name;
np = of_find_node_by_path("/testcase-data"); np = of_find_node_by_path("/testcase-data");
unittest(np && !strcmp("/testcase-data", np->full_name), name = kasprintf(GFP_KERNEL, "%pOF", np);
unittest(np && !strcmp("/testcase-data", name),
"find /testcase-data failed\n"); "find /testcase-data failed\n");
of_node_put(np); of_node_put(np);
kfree(name);
/* Test if trailing '/' works */ /* Test if trailing '/' works */
np = of_find_node_by_path("/testcase-data/"); np = of_find_node_by_path("/testcase-data/");
unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); unittest(!np, "trailing '/' on /testcase-data/ should fail\n");
np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), name = kasprintf(GFP_KERNEL, "%pOF", np);
unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name),
"find /testcase-data/phandle-tests/consumer-a failed\n"); "find /testcase-data/phandle-tests/consumer-a failed\n");
of_node_put(np); of_node_put(np);
kfree(name);
np = of_find_node_by_path("testcase-alias"); np = of_find_node_by_path("testcase-alias");
unittest(np && !strcmp("/testcase-data", np->full_name), name = kasprintf(GFP_KERNEL, "%pOF", np);
unittest(np && !strcmp("/testcase-data", name),
"find testcase-alias failed\n"); "find testcase-alias failed\n");
of_node_put(np); of_node_put(np);
kfree(name);
/* Test if trailing '/' works on aliases */ /* Test if trailing '/' works on aliases */
np = of_find_node_by_path("testcase-alias/"); np = of_find_node_by_path("testcase-alias/");
unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); unittest(!np, "trailing '/' on testcase-alias/ should fail\n");
np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), name = kasprintf(GFP_KERNEL, "%pOF", np);
unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name),
"find testcase-alias/phandle-tests/consumer-a failed\n"); "find testcase-alias/phandle-tests/consumer-a failed\n");
of_node_put(np); of_node_put(np);
kfree(name);
np = of_find_node_by_path("/testcase-data/missing-path"); np = of_find_node_by_path("/testcase-data/missing-path");
unittest(!np, "non-existent path returned node %s\n", np->full_name); unittest(!np, "non-existent path returned node %pOF\n", np);
of_node_put(np); of_node_put(np);
np = of_find_node_by_path("missing-alias"); np = of_find_node_by_path("missing-alias");
unittest(!np, "non-existent alias returned node %s\n", np->full_name); unittest(!np, "non-existent alias returned node %pOF\n", np);
of_node_put(np); of_node_put(np);
np = of_find_node_by_path("testcase-alias/missing-path"); np = of_find_node_by_path("testcase-alias/missing-path");
unittest(!np, "non-existent alias with relative path returned node %s\n", np->full_name); unittest(!np, "non-existent alias with relative path returned node %pOF\n", np);
of_node_put(np); of_node_put(np);
np = of_find_node_opts_by_path("/testcase-data:testoption", &options); np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
...@@ -315,8 +323,8 @@ static void __init of_unittest_check_phandles(void) ...@@ -315,8 +323,8 @@ static void __init of_unittest_check_phandles(void)
hash_for_each_possible(phandle_ht, nh, node, np->phandle) { hash_for_each_possible(phandle_ht, nh, node, np->phandle) {
if (nh->np->phandle == np->phandle) { if (nh->np->phandle == np->phandle) {
pr_info("Duplicate phandle! %i used by %s and %s\n", pr_info("Duplicate phandle! %i used by %pOF and %pOF\n",
np->phandle, nh->np->full_name, np->full_name); np->phandle, nh->np, np);
dup_count++; dup_count++;
break; break;
} }
...@@ -406,8 +414,8 @@ static void __init of_unittest_parse_phandle_with_args(void) ...@@ -406,8 +414,8 @@ static void __init of_unittest_parse_phandle_with_args(void)
passed = false; passed = false;
} }
unittest(passed, "index %i - data error on node %s rc=%i\n", unittest(passed, "index %i - data error on node %pOF rc=%i\n",
i, args.np->full_name, rc); i, args.np, rc);
} }
/* Check for missing list property */ /* Check for missing list property */
...@@ -590,7 +598,7 @@ static void __init of_unittest_changeset(void) ...@@ -590,7 +598,7 @@ static void __init of_unittest_changeset(void)
/* Make sure node names are constructed correctly */ /* Make sure node names are constructed correctly */
unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")),
"'%s' not added\n", n21->full_name); "'%pOF' not added\n", n21);
of_node_put(np); of_node_put(np);
unittest(!of_changeset_revert(&chgset), "revert failed\n"); unittest(!of_changeset_revert(&chgset), "revert failed\n");
...@@ -621,8 +629,8 @@ static void __init of_unittest_parse_interrupts(void) ...@@ -621,8 +629,8 @@ static void __init of_unittest_parse_interrupts(void)
passed &= (args.args_count == 1); passed &= (args.args_count == 1);
passed &= (args.args[0] == (i + 1)); passed &= (args.args[0] == (i + 1));
unittest(passed, "index %i - data error on node %s rc=%i\n", unittest(passed, "index %i - data error on node %pOF rc=%i\n",
i, args.np->full_name, rc); i, args.np, rc);
} }
of_node_put(np); of_node_put(np);
...@@ -667,8 +675,8 @@ static void __init of_unittest_parse_interrupts(void) ...@@ -667,8 +675,8 @@ static void __init of_unittest_parse_interrupts(void)
default: default:
passed = false; passed = false;
} }
unittest(passed, "index %i - data error on node %s rc=%i\n", unittest(passed, "index %i - data error on node %pOF rc=%i\n",
i, args.np->full_name, rc); i, args.np, rc);
} }
of_node_put(np); of_node_put(np);
} }
...@@ -737,8 +745,8 @@ static void __init of_unittest_parse_interrupts_extended(void) ...@@ -737,8 +745,8 @@ static void __init of_unittest_parse_interrupts_extended(void)
passed = false; passed = false;
} }
unittest(passed, "index %i - data error on node %s rc=%i\n", unittest(passed, "index %i - data error on node %pOF rc=%i\n",
i, args.np->full_name, rc); i, args.np, rc);
} }
of_node_put(np); of_node_put(np);
} }
...@@ -917,8 +925,11 @@ static int attach_node_and_children(struct device_node *np) ...@@ -917,8 +925,11 @@ static int attach_node_and_children(struct device_node *np)
{ {
struct device_node *next, *dup, *child; struct device_node *next, *dup, *child;
unsigned long flags; unsigned long flags;
const char *full_name;
dup = of_find_node_by_path(np->full_name); full_name = kasprintf(GFP_KERNEL, "%pOF", np);
dup = of_find_node_by_path(full_name);
kfree(full_name);
if (dup) { if (dup) {
update_node_properties(np, dup); update_node_properties(np, dup);
return 0; return 0;
...@@ -1023,7 +1034,7 @@ static int unittest_probe(struct platform_device *pdev) ...@@ -1023,7 +1034,7 @@ static int unittest_probe(struct platform_device *pdev)
} }
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
of_platform_populate(np, NULL, NULL, &pdev->dev); of_platform_populate(np, NULL, NULL, &pdev->dev);
...@@ -1035,7 +1046,7 @@ static int unittest_remove(struct platform_device *pdev) ...@@ -1035,7 +1046,7 @@ static int unittest_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
return 0; return 0;
} }
...@@ -1649,7 +1660,7 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev) ...@@ -1649,7 +1660,7 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev)
} }
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL); std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL);
if (!std) { if (!std) {
...@@ -1687,7 +1698,7 @@ static int unittest_i2c_bus_remove(struct platform_device *pdev) ...@@ -1687,7 +1698,7 @@ static int unittest_i2c_bus_remove(struct platform_device *pdev)
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
struct unittest_i2c_bus_data *std = platform_get_drvdata(pdev); struct unittest_i2c_bus_data *std = platform_get_drvdata(pdev);
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
i2c_del_adapter(&std->adap); i2c_del_adapter(&std->adap);
return 0; return 0;
...@@ -1718,7 +1729,7 @@ static int unittest_i2c_dev_probe(struct i2c_client *client, ...@@ -1718,7 +1729,7 @@ static int unittest_i2c_dev_probe(struct i2c_client *client,
return -EINVAL; return -EINVAL;
} }
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
return 0; return 0;
}; };
...@@ -1728,7 +1739,7 @@ static int unittest_i2c_dev_remove(struct i2c_client *client) ...@@ -1728,7 +1739,7 @@ static int unittest_i2c_dev_remove(struct i2c_client *client)
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct device_node *np = client->dev.of_node; struct device_node *np = client->dev.of_node;
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
return 0; return 0;
} }
...@@ -1763,7 +1774,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client, ...@@ -1763,7 +1774,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client,
struct i2c_mux_core *muxc; struct i2c_mux_core *muxc;
u32 reg, max_reg; u32 reg, max_reg;
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
if (!np) { if (!np) {
dev_err(dev, "No OF node\n"); dev_err(dev, "No OF node\n");
...@@ -1808,7 +1819,7 @@ static int unittest_i2c_mux_remove(struct i2c_client *client) ...@@ -1808,7 +1819,7 @@ static int unittest_i2c_mux_remove(struct i2c_client *client)
struct device_node *np = client->dev.of_node; struct device_node *np = client->dev.of_node;
struct i2c_mux_core *muxc = i2c_get_clientdata(client); struct i2c_mux_core *muxc = i2c_get_clientdata(client);
dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
i2c_mux_del_adapters(muxc); i2c_mux_del_adapters(muxc);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment