of: Convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
Rob Herring 2018-08-27 20:00:19 -05:00
parent 6901378c79
commit a613b26a50
6 changed files with 23 additions and 22 deletions

View File

@ -219,7 +219,8 @@ static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len
return -ENODEV; return -ENODEV;
/* Name & Type */ /* Name & Type */
csize = snprintf(str, len, "of:N%sT%s", dev->of_node->name, /* %p eats all alphanum characters, so %c must be used here */
csize = snprintf(str, len, "of:N%pOFn%c%s", dev->of_node, 'T',
dev->of_node->type); dev->of_node->type);
tsize = csize; tsize = csize;
len -= csize; len -= csize;
@ -298,7 +299,7 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
if ((!dev) || (!dev->of_node)) if ((!dev) || (!dev->of_node))
return; return;
add_uevent_var(env, "OF_NAME=%s", dev->of_node->name); add_uevent_var(env, "OF_NAME=%pOFn", dev->of_node);
add_uevent_var(env, "OF_FULLNAME=%pOF", dev->of_node); 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);

View File

@ -97,8 +97,8 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,
return rc; return rc;
} }
dev_dbg(&mdio->dev, "registered phy %s at address %i\n", dev_dbg(&mdio->dev, "registered phy %pOFn at address %i\n",
child->name, addr); child, addr);
return 0; return 0;
} }
@ -127,8 +127,8 @@ static int of_mdiobus_register_device(struct mii_bus *mdio,
return rc; return rc;
} }
dev_dbg(&mdio->dev, "registered mdio device %s at address %i\n", dev_dbg(&mdio->dev, "registered mdio device %pOFn at address %i\n",
child->name, addr); child, addr);
return 0; return 0;
} }
@ -263,8 +263,8 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
continue; continue;
/* be noisy to encourage people to set reg property */ /* be noisy to encourage people to set reg property */
dev_info(&mdio->dev, "scan phy %s at address %i\n", dev_info(&mdio->dev, "scan phy %pOFn at address %i\n",
child->name, addr); child, addr);
if (of_mdiobus_child_is_phy(child)) { if (of_mdiobus_child_is_phy(child)) {
rc = of_mdiobus_register_phy(mdio, child, addr); rc = of_mdiobus_register_phy(mdio, child, addr);

View File

@ -163,8 +163,8 @@ int of_node_to_nid(struct device_node *device)
np = of_get_next_parent(np); np = of_get_next_parent(np);
} }
if (np && r) if (np && r)
pr_warn("Invalid \"numa-node-id\" property in node %s\n", pr_warn("Invalid \"numa-node-id\" property in node %pOFn\n",
np->name); np);
of_node_put(np); of_node_put(np);
/* /*

View File

@ -425,8 +425,8 @@ static int build_changeset_next_level(struct overlay_changeset *ovcs,
for_each_child_of_node(overlay_node, child) { for_each_child_of_node(overlay_node, child) {
ret = add_changeset_node(ovcs, target_node, child); ret = add_changeset_node(ovcs, target_node, child);
if (ret) { if (ret) {
pr_debug("Failed to apply node @%pOF/%s, err=%d\n", pr_debug("Failed to apply node @%pOF/%pOFn, err=%d\n",
target_node, child->name, ret); target_node, child, ret);
of_node_put(child); of_node_put(child);
return ret; return ret;
} }

View File

@ -91,8 +91,8 @@ static void of_device_make_bus_id(struct device *dev)
*/ */
reg = of_get_property(node, "reg", NULL); reg = of_get_property(node, "reg", NULL);
if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) { if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) {
dev_set_name(dev, dev_name(dev) ? "%llx.%s:%s" : "%llx.%s", dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn",
(unsigned long long)addr, node->name, (unsigned long long)addr, node,
dev_name(dev)); dev_name(dev));
return; return;
} }
@ -142,8 +142,8 @@ struct platform_device *of_device_alloc(struct device_node *np,
WARN_ON(rc); WARN_ON(rc);
} }
if (of_irq_to_resource_table(np, res, num_irq) != num_irq) if (of_irq_to_resource_table(np, res, num_irq) != num_irq)
pr_debug("not all legacy IRQ resources mapped for %s\n", pr_debug("not all legacy IRQ resources mapped for %pOFn\n",
np->name); np);
} }
dev->dev.of_node = of_node_get(np); dev->dev.of_node = of_node_get(np);

View File

@ -212,8 +212,8 @@ static int __init of_unittest_check_node_linkage(struct device_node *np)
for_each_child_of_node(np, child) { for_each_child_of_node(np, child) {
if (child->parent != np) { if (child->parent != np) {
pr_err("Child node %s links to wrong parent %s\n", pr_err("Child node %pOFn links to wrong parent %pOFn\n",
child->name, np->name); child, np);
rc = -EINVAL; rc = -EINVAL;
goto put_child; goto put_child;
} }
@ -1040,16 +1040,16 @@ static void __init of_unittest_platform_populate(void)
for_each_child_of_node(np, child) { for_each_child_of_node(np, child) {
for_each_child_of_node(child, grandchild) for_each_child_of_node(child, grandchild)
unittest(of_find_device_by_node(grandchild), unittest(of_find_device_by_node(grandchild),
"Could not create device for node '%s'\n", "Could not create device for node '%pOFn'\n",
grandchild->name); grandchild);
} }
of_platform_depopulate(&test_bus->dev); of_platform_depopulate(&test_bus->dev);
for_each_child_of_node(np, child) { for_each_child_of_node(np, child) {
for_each_child_of_node(child, grandchild) for_each_child_of_node(child, grandchild)
unittest(!of_find_device_by_node(grandchild), unittest(!of_find_device_by_node(grandchild),
"device didn't get destroyed '%s'\n", "device didn't get destroyed '%pOFn'\n",
grandchild->name); grandchild);
} }
platform_device_unregister(test_bus); platform_device_unregister(test_bus);