Skip to content

Commit 0bdba86

Browse files
robherringmpe
authored andcommitted
macintosh: 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. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent c417596 commit 0bdba86

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

drivers/macintosh/macio_asic.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,10 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
360360
struct macio_dev *in_bay,
361361
struct resource *parent_res)
362362
{
363+
char name[MAX_NODE_NAME_SIZE + 1];
363364
struct macio_dev *dev;
364365
const u32 *reg;
365-
366+
366367
if (np == NULL)
367368
return NULL;
368369

@@ -402,6 +403,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
402403
#endif
403404

404405
/* MacIO itself has a different reg, we use it's PCI base */
406+
snprintf(name, sizeof(name), "%pOFn", np);
405407
if (np == chip->of_node) {
406408
dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s",
407409
chip->lbus.index,
@@ -410,12 +412,12 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
410412
#else
411413
0, /* NuBus may want to do something better here */
412414
#endif
413-
MAX_NODE_NAME_SIZE, np->name);
415+
MAX_NODE_NAME_SIZE, name);
414416
} else {
415417
reg = of_get_property(np, "reg", NULL);
416418
dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s",
417419
chip->lbus.index,
418-
reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);
420+
reg ? *reg : 0, MAX_NODE_NAME_SIZE, name);
419421
}
420422

421423
/* Setup interrupts & resources */

drivers/macintosh/macio_sysfs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ static ssize_t devspec_show(struct device *dev,
5858
static DEVICE_ATTR_RO(modalias);
5959
static DEVICE_ATTR_RO(devspec);
6060

61-
macio_config_of_attr (name, "%s\n");
61+
static ssize_t name_show(struct device *dev,
62+
struct device_attribute *attr, char *buf)
63+
{
64+
return sprintf(buf, "%pOFn\n", dev->of_node);
65+
}
66+
static DEVICE_ATTR_RO(name);
67+
6268
macio_config_of_attr (type, "%s\n");
6369

6470
static struct attribute *macio_dev_attrs[] = {

drivers/macintosh/windfarm_smu_controls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static int __init smu_controls_init(void)
277277
fct = smu_fan_create(fan, 0);
278278
if (fct == NULL) {
279279
printk(KERN_WARNING "windfarm: Failed to create SMU "
280-
"RPM fan %s\n", fan->name);
280+
"RPM fan %pOFn\n", fan);
281281
continue;
282282
}
283283
list_add(&fct->link, &smu_fans);
@@ -296,7 +296,7 @@ static int __init smu_controls_init(void)
296296
fct = smu_fan_create(fan, 1);
297297
if (fct == NULL) {
298298
printk(KERN_WARNING "windfarm: Failed to create SMU "
299-
"PWM fan %s\n", fan->name);
299+
"PWM fan %pOFn\n", fan);
300300
continue;
301301
}
302302
list_add(&fct->link, &smu_fans);

0 commit comments

Comments
 (0)