Commit b9ef7b4b authored by Rob Herring's avatar Rob Herring Committed by Michael Ellerman

powerpc: 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.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 0bdba867
...@@ -210,15 +210,15 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler) ...@@ -210,15 +210,15 @@ static void node_irq_request(const char *compat, irq_handler_t errirq_handler)
for_each_compatible_node(np, NULL, compat) { for_each_compatible_node(np, NULL, compat) {
irq = irq_of_parse_and_map(np, 0); irq = irq_of_parse_and_map(np, 0);
if (irq == NO_IRQ) { if (irq == NO_IRQ) {
pr_err("device tree node %s is missing a interrupt", pr_err("device tree node %pOFn is missing a interrupt",
np->name); np);
return; return;
} }
rc = request_irq(irq, errirq_handler, 0, np->name, np); rc = request_irq(irq, errirq_handler, 0, np->name, np);
if (rc) { if (rc) {
pr_err("fsp_of_probe: request_irq failed: np=%s rc=%d", pr_err("fsp_of_probe: request_irq failed: np=%pOF rc=%d",
np->full_name, rc); np, rc);
return; return;
} }
} }
......
...@@ -282,8 +282,8 @@ static int __init of_enumerate_spus(int (*fn)(void *data)) ...@@ -282,8 +282,8 @@ static int __init of_enumerate_spus(int (*fn)(void *data))
for_each_node_by_type(node, "spe") { for_each_node_by_type(node, "spe") {
ret = fn(node); ret = fn(node);
if (ret) { if (ret) {
printk(KERN_WARNING "%s: Error initializing %s\n", printk(KERN_WARNING "%s: Error initializing %pOFn\n",
__func__, node->name); __func__, node);
of_node_put(node); of_node_put(node);
break; break;
} }
......
...@@ -112,7 +112,7 @@ static void __iomem *wii_ioremap_hw_regs(char *name, char *compatible) ...@@ -112,7 +112,7 @@ static void __iomem *wii_ioremap_hw_regs(char *name, char *compatible)
} }
error = of_address_to_resource(np, 0, &res); error = of_address_to_resource(np, 0, &res);
if (error) { if (error) {
pr_err("no valid reg found for %s\n", np->name); pr_err("no valid reg found for %pOFn\n", np);
goto out_put; goto out_put;
} }
......
...@@ -199,7 +199,7 @@ void __init opal_powercap_init(void) ...@@ -199,7 +199,7 @@ void __init opal_powercap_init(void)
} }
j = 0; j = 0;
pcaps[i].pg.name = node->name; pcaps[i].pg.name = kasprintf(GFP_KERNEL, "%pOFn", node);
if (has_min) { if (has_min) {
powercap_add_attr(min, "powercap-min", powercap_add_attr(min, "powercap-min",
&pcaps[i].pattrs[j]); &pcaps[i].pattrs[j]);
...@@ -237,6 +237,7 @@ void __init opal_powercap_init(void) ...@@ -237,6 +237,7 @@ void __init opal_powercap_init(void)
while (--i >= 0) { while (--i >= 0) {
kfree(pcaps[i].pattrs); kfree(pcaps[i].pattrs);
kfree(pcaps[i].pg.attrs); kfree(pcaps[i].pg.attrs);
kfree(pcaps[i].pg.name);
} }
kobject_put(powercap_kobj); kobject_put(powercap_kobj);
out_pcaps: out_pcaps:
......
...@@ -214,9 +214,9 @@ void __init opal_sensor_groups_init(void) ...@@ -214,9 +214,9 @@ void __init opal_sensor_groups_init(void)
} }
if (!of_property_read_u32(node, "ibm,chip-id", &chipid)) if (!of_property_read_u32(node, "ibm,chip-id", &chipid))
sprintf(sgs[i].name, "%s%d", node->name, chipid); sprintf(sgs[i].name, "%pOFn%d", node, chipid);
else else
sprintf(sgs[i].name, "%s", node->name); sprintf(sgs[i].name, "%pOFn", node);
sgs[i].sg.name = sgs[i].name; sgs[i].sg.name = sgs[i].name;
if (add_attr_group(ops, len, &sgs[i], sgid)) { if (add_attr_group(ops, len, &sgs[i], sgid)) {
......
...@@ -194,7 +194,7 @@ void __init opal_sys_param_init(void) ...@@ -194,7 +194,7 @@ void __init opal_sys_param_init(void)
count = of_property_count_strings(sysparam, "param-name"); count = of_property_count_strings(sysparam, "param-name");
if (count < 0) { if (count < 0) {
pr_err("SYSPARAM: No string found of property param-name in " pr_err("SYSPARAM: No string found of property param-name in "
"the node %s\n", sysparam->name); "the node %pOFn\n", sysparam);
goto out_param_buf; goto out_param_buf;
} }
......
...@@ -287,7 +287,7 @@ static int pseries_add_processor(struct device_node *np) ...@@ -287,7 +287,7 @@ static int pseries_add_processor(struct device_node *np)
if (cpumask_empty(tmp)) { if (cpumask_empty(tmp)) {
printk(KERN_ERR "Unable to find space in cpu_present_mask for" printk(KERN_ERR "Unable to find space in cpu_present_mask for"
" processor %s with %d thread(s)\n", np->name, " processor %pOFn with %d thread(s)\n", np,
nthreads); nthreads);
goto out_unlock; goto out_unlock;
} }
...@@ -481,8 +481,8 @@ static ssize_t dlpar_cpu_add(u32 drc_index) ...@@ -481,8 +481,8 @@ static ssize_t dlpar_cpu_add(u32 drc_index)
if (rc) { if (rc) {
saved_rc = rc; saved_rc = rc;
pr_warn("Failed to attach node %s, rc: %d, drc index: %x\n", pr_warn("Failed to attach node %pOFn, rc: %d, drc index: %x\n",
dn->name, rc, drc_index); dn, rc, drc_index);
rc = dlpar_release_drc(drc_index); rc = dlpar_release_drc(drc_index);
if (!rc) if (!rc)
...@@ -494,8 +494,8 @@ static ssize_t dlpar_cpu_add(u32 drc_index) ...@@ -494,8 +494,8 @@ static ssize_t dlpar_cpu_add(u32 drc_index)
rc = dlpar_online_cpu(dn); rc = dlpar_online_cpu(dn);
if (rc) { if (rc) {
saved_rc = rc; saved_rc = rc;
pr_warn("Failed to online cpu %s, rc: %d, drc index: %x\n", pr_warn("Failed to online cpu %pOFn, rc: %d, drc index: %x\n",
dn->name, rc, drc_index); dn, rc, drc_index);
rc = dlpar_detach_node(dn); rc = dlpar_detach_node(dn);
if (!rc) if (!rc)
...@@ -504,7 +504,7 @@ static ssize_t dlpar_cpu_add(u32 drc_index) ...@@ -504,7 +504,7 @@ static ssize_t dlpar_cpu_add(u32 drc_index)
return saved_rc; return saved_rc;
} }
pr_debug("Successfully added CPU %s, drc index: %x\n", dn->name, pr_debug("Successfully added CPU %pOFn, drc index: %x\n", dn,
drc_index); drc_index);
return rc; return rc;
} }
...@@ -570,19 +570,19 @@ static ssize_t dlpar_cpu_remove(struct device_node *dn, u32 drc_index) ...@@ -570,19 +570,19 @@ static ssize_t dlpar_cpu_remove(struct device_node *dn, u32 drc_index)
{ {
int rc; int rc;
pr_debug("Attempting to remove CPU %s, drc index: %x\n", pr_debug("Attempting to remove CPU %pOFn, drc index: %x\n",
dn->name, drc_index); dn, drc_index);
rc = dlpar_offline_cpu(dn); rc = dlpar_offline_cpu(dn);
if (rc) { if (rc) {
pr_warn("Failed to offline CPU %s, rc: %d\n", dn->name, rc); pr_warn("Failed to offline CPU %pOFn, rc: %d\n", dn, rc);
return -EINVAL; return -EINVAL;
} }
rc = dlpar_release_drc(drc_index); rc = dlpar_release_drc(drc_index);
if (rc) { if (rc) {
pr_warn("Failed to release drc (%x) for CPU %s, rc: %d\n", pr_warn("Failed to release drc (%x) for CPU %pOFn, rc: %d\n",
drc_index, dn->name, rc); drc_index, dn, rc);
dlpar_online_cpu(dn); dlpar_online_cpu(dn);
return rc; return rc;
} }
...@@ -591,7 +591,7 @@ static ssize_t dlpar_cpu_remove(struct device_node *dn, u32 drc_index) ...@@ -591,7 +591,7 @@ static ssize_t dlpar_cpu_remove(struct device_node *dn, u32 drc_index)
if (rc) { if (rc) {
int saved_rc = rc; int saved_rc = rc;
pr_warn("Failed to detach CPU %s, rc: %d", dn->name, rc); pr_warn("Failed to detach CPU %pOFn, rc: %d", dn, rc);
rc = dlpar_acquire_drc(drc_index); rc = dlpar_acquire_drc(drc_index);
if (!rc) if (!rc)
...@@ -662,8 +662,8 @@ static int find_dlpar_cpus_to_remove(u32 *cpu_drcs, int cpus_to_remove) ...@@ -662,8 +662,8 @@ static int find_dlpar_cpus_to_remove(u32 *cpu_drcs, int cpus_to_remove)
rc = of_property_read_u32(dn, "ibm,my-drc-index", rc = of_property_read_u32(dn, "ibm,my-drc-index",
&cpu_drcs[cpus_found - 1]); &cpu_drcs[cpus_found - 1]);
if (rc) { if (rc) {
pr_warn("Error occurred getting drc-index for %s\n", pr_warn("Error occurred getting drc-index for %pOFn\n",
dn->name); dn);
of_node_put(dn); of_node_put(dn);
return -1; return -1;
} }
......
...@@ -404,7 +404,7 @@ static ssize_t name_show(struct device *dev, ...@@ -404,7 +404,7 @@ static ssize_t name_show(struct device *dev,
struct platform_device *ofdev; struct platform_device *ofdev;
ofdev = to_platform_device(dev); ofdev = to_platform_device(dev);
return sprintf(buf, "%s\n", ofdev->dev.of_node->name); return sprintf(buf, "%pOFn\n", ofdev->dev.of_node);
} }
static DEVICE_ATTR_RO(name); static DEVICE_ATTR_RO(name);
......
...@@ -1349,7 +1349,6 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) ...@@ -1349,7 +1349,6 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
struct device_node *parent_node; struct device_node *parent_node;
const __be32 *prop; const __be32 *prop;
enum vio_dev_family family; enum vio_dev_family family;
const char *of_node_name = of_node->name ? of_node->name : "<unknown>";
/* /*
* Determine if this node is a under the /vdevice node or under the * Determine if this node is a under the /vdevice node or under the
...@@ -1362,24 +1361,24 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) ...@@ -1362,24 +1361,24 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
else if (!strcmp(parent_node->type, "vdevice")) else if (!strcmp(parent_node->type, "vdevice"))
family = VDEVICE; family = VDEVICE;
else { else {
pr_warn("%s: parent(%pOF) of %s not recognized.\n", pr_warn("%s: parent(%pOF) of %pOFn not recognized.\n",
__func__, __func__,
parent_node, parent_node,
of_node_name); of_node);
of_node_put(parent_node); of_node_put(parent_node);
return NULL; return NULL;
} }
of_node_put(parent_node); of_node_put(parent_node);
} else { } else {
pr_warn("%s: could not determine the parent of node %s.\n", pr_warn("%s: could not determine the parent of node %pOFn.\n",
__func__, of_node_name); __func__, of_node);
return NULL; return NULL;
} }
if (family == PFO) { if (family == PFO) {
if (of_get_property(of_node, "interrupt-controller", NULL)) { if (of_get_property(of_node, "interrupt-controller", NULL)) {
pr_debug("%s: Skipping the interrupt controller %s.\n", pr_debug("%s: Skipping the interrupt controller %pOFn.\n",
__func__, of_node_name); __func__, of_node);
return NULL; return NULL;
} }
} }
...@@ -1399,15 +1398,15 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) ...@@ -1399,15 +1398,15 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
if (of_node->type != NULL) if (of_node->type != NULL)
viodev->type = of_node->type; viodev->type = of_node->type;
else { else {
pr_warn("%s: node %s is missing the 'device_type' " pr_warn("%s: node %pOFn is missing the 'device_type' "
"property.\n", __func__, of_node_name); "property.\n", __func__, of_node);
goto out; goto out;
} }
prop = of_get_property(of_node, "reg", NULL); prop = of_get_property(of_node, "reg", NULL);
if (prop == NULL) { if (prop == NULL) {
pr_warn("%s: node %s missing 'reg'\n", pr_warn("%s: node %pOFn missing 'reg'\n",
__func__, of_node_name); __func__, of_node);
goto out; goto out;
} }
unit_address = of_read_number(prop, 1); unit_address = of_read_number(prop, 1);
...@@ -1422,8 +1421,8 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node) ...@@ -1422,8 +1421,8 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
if (prop != NULL) if (prop != NULL)
viodev->resource_id = of_read_number(prop, 1); viodev->resource_id = of_read_number(prop, 1);
dev_set_name(&viodev->dev, "%s", of_node_name); dev_set_name(&viodev->dev, "%pOFn", of_node);
viodev->type = of_node_name; viodev->type = dev_name(&viodev->dev);
viodev->irq = 0; viodev->irq = 0;
} }
...@@ -1694,7 +1693,7 @@ struct vio_dev *vio_find_node(struct device_node *vnode) ...@@ -1694,7 +1693,7 @@ struct vio_dev *vio_find_node(struct device_node *vnode)
snprintf(kobj_name, sizeof(kobj_name), "%x", snprintf(kobj_name, sizeof(kobj_name), "%x",
(uint32_t)of_read_number(prop, 1)); (uint32_t)of_read_number(prop, 1));
} else if (!strcmp(dev_type, "ibm,platform-facilities")) } else if (!strcmp(dev_type, "ibm,platform-facilities"))
snprintf(kobj_name, sizeof(kobj_name), "%s", vnode->name); snprintf(kobj_name, sizeof(kobj_name), "%pOFn", vnode);
else else
return NULL; return NULL;
......
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