Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'sparc-OF-name-and-device_type-rework'

Rob Herring says:

====================
sparc: OF name and device_type rework

All other platforms have been converted to only store the local node name
in device_node.full_name except Sparc. Sparc was complicated by having a
path_component_name in addition to full_name and name. By switching
full_name to just the local node name, path_component_name becomes
redundant and can be removed.

The rest of the series converts the sparc code to use printf specifiers
and helper functions to access node name and device_type instead of
directly accessing device_node full_name, name and type pointers.

I've tested this series under qemu.

v2:
- Add patch using of_node_name_eq for openpromfs
- Add patch converting some resource names to full_name
- Also drop full path on !Sparc PDT node name construction
- Add a few missed %pOFn conversions
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+194 -238
+4 -4
arch/sparc/include/asm/floppy_64.h
··· 528 528 529 529 static int __init ebus_fdthree_p(struct device_node *dp) 530 530 { 531 - if (!strcmp(dp->name, "fdthree")) 531 + if (of_node_name_eq(dp, "fdthree")) 532 532 return 1; 533 - if (!strcmp(dp->name, "floppy")) { 533 + if (of_node_name_eq(dp, "floppy")) { 534 534 const char *compat; 535 535 536 536 compat = of_get_property(dp, "compatible", NULL); ··· 555 555 op = NULL; 556 556 557 557 for_each_node_by_name(dp, "SUNW,fdtwo") { 558 - if (strcmp(dp->parent->name, "sbus")) 558 + if (!of_node_name_eq(dp->parent, "sbus")) 559 559 continue; 560 560 op = of_find_device_by_node(dp); 561 561 if (op) ··· 656 656 */ 657 657 config = 0; 658 658 for (dp = ebus_dp->child; dp; dp = dp->sibling) { 659 - if (!strcmp(dp->name, "ecpp")) { 659 + if (of_node_name_eq(dp, "ecpp")) { 660 660 struct platform_device *ecpp_op; 661 661 662 662 ecpp_op = of_find_device_by_node(dp);
-1
arch/sparc/include/asm/leon.h
··· 225 225 irq_flow_handler_t flow_handler, 226 226 const char *name, int do_ack); 227 227 void leon_init_timers(void); 228 - void leon_trans_init(struct device_node *dp); 229 228 void leon_node_init(struct device_node *dp, struct device_node ***nextp); 230 229 void init_leon(void); 231 230 void poke_leonsparc(void);
+1 -1
arch/sparc/include/asm/parport.h
··· 117 117 int slot, err; 118 118 119 119 parent = op->dev.of_node->parent; 120 - if (!strcmp(parent->name, "dma")) { 120 + if (of_node_name_eq(parent, "dma")) { 121 121 p = parport_pc_probe_port(base, base + 0x400, 122 122 op->archdata.irqs[0], PARPORT_DMA_NOFIFO, 123 123 op->dev.parent->parent, 0);
+5 -6
arch/sparc/kernel/auxio_64.c
··· 108 108 struct device_node *dp = dev->dev.of_node; 109 109 unsigned long size; 110 110 111 - if (!strcmp(dp->parent->name, "ebus")) { 111 + if (of_node_name_eq(dp->parent, "ebus")) { 112 112 auxio_devtype = AUXIO_TYPE_EBUS; 113 113 size = sizeof(u32); 114 - } else if (!strcmp(dp->parent->name, "sbus")) { 114 + } else if (of_node_name_eq(dp->parent, "sbus")) { 115 115 auxio_devtype = AUXIO_TYPE_SBUS; 116 116 size = 1; 117 117 } else { 118 - printk("auxio: Unknown parent bus type [%s]\n", 119 - dp->parent->name); 118 + printk("auxio: Unknown parent bus type [%pOFn]\n", 119 + dp->parent); 120 120 return -ENODEV; 121 121 } 122 122 auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio"); 123 123 if (!auxio_register) 124 124 return -ENODEV; 125 125 126 - printk(KERN_INFO "AUXIO: Found device at %s\n", 127 - dp->full_name); 126 + printk(KERN_INFO "AUXIO: Found device at %pOF\n", dp); 128 127 129 128 if (auxio_devtype == AUXIO_TYPE_EBUS) 130 129 auxio_set_led(AUXIO_LED_ON);
+1 -1
arch/sparc/kernel/central.c
··· 168 168 goto out; 169 169 } 170 170 171 - if (!strcmp(op->dev.of_node->parent->name, "central")) 171 + if (of_node_name_eq(op->dev.of_node->parent, "central")) 172 172 p->central = true; 173 173 174 174 p->pregs = of_ioremap(&op->resource[0], 0,
+4 -4
arch/sparc/kernel/chmc.c
··· 464 464 465 465 mc_list_add(&p->list); 466 466 467 - printk(KERN_INFO PFX "UltraSPARC-IIIi memory controller at %s\n", 468 - op->dev.of_node->full_name); 467 + printk(KERN_INFO PFX "UltraSPARC-IIIi memory controller at %pOF\n", 468 + op->dev.of_node); 469 469 470 470 dev_set_drvdata(&op->dev, p); 471 471 ··· 747 747 748 748 mc_list_add(&p->list); 749 749 750 - printk(KERN_INFO PFX "UltraSPARC-III memory controller at %s [%s]\n", 751 - dp->full_name, 750 + printk(KERN_INFO PFX "UltraSPARC-III memory controller at %pOF [%s]\n", 751 + dp, 752 752 (p->layout_size ? "ACTIVE" : "INACTIVE")); 753 753 754 754 dev_set_drvdata(&op->dev, p);
+1 -1
arch/sparc/kernel/ioport.c
··· 302 302 if (sbus_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0) 303 303 goto err_noiommu; 304 304 305 - res->name = op->dev.of_node->name; 305 + res->name = op->dev.of_node->full_name; 306 306 307 307 return (void *)(unsigned long)res->start; 308 308
+1 -1
arch/sparc/kernel/irq_64.c
··· 915 915 dp = of_find_node_by_path("/"); 916 916 dp = dp->child; 917 917 while (dp) { 918 - if (!strcmp(dp->name, "counter-timer")) 918 + if (of_node_name_eq(dp, "counter-timer")) 919 919 break; 920 920 dp = dp->sibling; 921 921 }
-14
arch/sparc/kernel/leon_kernel.c
··· 484 484 { 485 485 } 486 486 487 - void __init leon_trans_init(struct device_node *dp) 488 - { 489 - if (strcmp(dp->type, "cpu") == 0 && strcmp(dp->name, "<NULL>") == 0) { 490 - struct property *p; 491 - p = of_find_property(dp, "mid", (void *)0); 492 - if (p) { 493 - int mid; 494 - dp->name = prom_early_alloc(5 + 1); 495 - memcpy(&mid, p->value, p->length); 496 - sprintf((char *)dp->name, "cpu%.2d", mid); 497 - } 498 - } 499 - } 500 - 501 487 #ifdef CONFIG_SMP 502 488 void leon_clear_profile_irq(int cpu) 503 489 {
+10 -11
arch/sparc/kernel/of_device_32.c
··· 22 22 23 23 static int of_bus_pci_match(struct device_node *np) 24 24 { 25 - if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) { 25 + if (of_node_is_type(np, "pci") || of_node_is_type(np, "pciex")) { 26 26 /* Do not do PCI specific frobbing if the 27 27 * PCI bridge lacks a ranges property. We 28 28 * want to pass it through up to the next ··· 107 107 108 108 static int of_bus_ambapp_match(struct device_node *np) 109 109 { 110 - return !strcmp(np->type, "ambapp"); 110 + return of_node_is_type(np, "ambapp"); 111 111 } 112 112 113 113 static void of_bus_ambapp_count_cells(struct device_node *child, ··· 232 232 * But, we should still pass the translation work up 233 233 * to the SBUS itself. 234 234 */ 235 - if (!strcmp(pp->name, "dma") || 236 - !strcmp(pp->name, "espdma") || 237 - !strcmp(pp->name, "ledma") || 238 - !strcmp(pp->name, "lebuffer")) 235 + if (of_node_name_eq(pp, "dma") || 236 + of_node_name_eq(pp, "espdma") || 237 + of_node_name_eq(pp, "ledma") || 238 + of_node_name_eq(pp, "lebuffer")) 239 239 return 0; 240 240 241 241 return 1; ··· 324 324 memset(r, 0, sizeof(*r)); 325 325 326 326 if (of_resource_verbose) 327 - printk("%s reg[%d] -> %llx\n", 328 - op->dev.of_node->full_name, index, 327 + printk("%pOF reg[%d] -> %llx\n", 328 + op->dev.of_node, index, 329 329 result); 330 330 331 331 if (result != OF_BAD_ADDR) { ··· 333 333 r->end = result + size - 1; 334 334 r->flags = flags | ((result >> 32ULL) & 0xffUL); 335 335 } 336 - r->name = op->dev.of_node->name; 336 + r->name = op->dev.of_node->full_name; 337 337 } 338 338 } 339 339 ··· 386 386 op->dev.dma_mask = &op->dev.coherent_dma_mask; 387 387 388 388 if (of_device_register(op)) { 389 - printk("%s: Could not register of device.\n", 390 - dp->full_name); 389 + printk("%pOF: Could not register of device.\n", dp); 391 390 kfree(op); 392 391 op = NULL; 393 392 }
+28 -30
arch/sparc/kernel/of_device_64.c
··· 46 46 47 47 static int of_bus_pci_match(struct device_node *np) 48 48 { 49 - if (!strcmp(np->name, "pci")) { 49 + if (of_node_name_eq(np, "pci")) { 50 50 const char *model = of_get_property(np, "model", NULL); 51 51 52 52 if (model && !strcmp(model, "SUNW,simba")) ··· 77 77 /* Treat PCI busses lacking ranges property just like 78 78 * simba. 79 79 */ 80 - if (!strcmp(np->name, "pci")) { 80 + if (of_node_name_eq(np, "pci")) { 81 81 if (!of_find_property(np, "ranges", NULL)) 82 82 return 1; 83 83 } ··· 170 170 */ 171 171 static int of_bus_fhc_match(struct device_node *np) 172 172 { 173 - return !strcmp(np->name, "fhc") || 174 - !strcmp(np->name, "central"); 173 + return of_node_name_eq(np, "fhc") || 174 + of_node_name_eq(np, "central"); 175 175 } 176 176 177 177 #define of_bus_fhc_count_cells of_bus_sbus_count_cells ··· 295 295 * But, we should still pass the translation work up 296 296 * to the SBUS itself. 297 297 */ 298 - if (!strcmp(pp->name, "dma") || 299 - !strcmp(pp->name, "espdma") || 300 - !strcmp(pp->name, "ledma") || 301 - !strcmp(pp->name, "lebuffer")) 298 + if (of_node_name_eq(pp, "dma") || 299 + of_node_name_eq(pp, "espdma") || 300 + of_node_name_eq(pp, "ledma") || 301 + of_node_name_eq(pp, "lebuffer")) 302 302 return 0; 303 303 304 304 /* Similarly for all PCI bridges, if we get this far 305 305 * it lacks a ranges property, and this will include 306 306 * cases like Simba. 307 307 */ 308 - if (!strcmp(pp->name, "pci")) 308 + if (of_node_name_eq(pp, "pci")) 309 309 return 0; 310 310 311 311 return 1; ··· 341 341 342 342 /* Prevent overrunning the op->resources[] array. */ 343 343 if (num_reg > PROMREG_MAX) { 344 - printk(KERN_WARNING "%s: Too many regs (%d), " 344 + printk(KERN_WARNING "%pOF: Too many regs (%d), " 345 345 "limiting to %d.\n", 346 - op->dev.of_node->full_name, num_reg, PROMREG_MAX); 346 + op->dev.of_node, num_reg, PROMREG_MAX); 347 347 num_reg = PROMREG_MAX; 348 348 } 349 349 ··· 401 401 memset(r, 0, sizeof(*r)); 402 402 403 403 if (of_resource_verbose) 404 - printk("%s reg[%d] -> %llx\n", 405 - op->dev.of_node->full_name, index, 404 + printk("%pOF reg[%d] -> %llx\n", 405 + op->dev.of_node, index, 406 406 result); 407 407 408 408 if (result != OF_BAD_ADDR) { ··· 413 413 r->end = result + size - 1; 414 414 r->flags = flags; 415 415 } 416 - r->name = op->dev.of_node->name; 416 + r->name = op->dev.of_node->full_name; 417 417 } 418 418 } 419 419 ··· 548 548 dp->irq_trans->data); 549 549 550 550 if (of_irq_verbose) 551 - printk("%s: direct translate %x --> %x\n", 552 - dp->full_name, orig_irq, irq); 551 + printk("%pOF: direct translate %x --> %x\n", 552 + dp, orig_irq, irq); 553 553 554 554 goto out; 555 555 } ··· 579 579 &irq); 580 580 581 581 if (of_irq_verbose) 582 - printk("%s: Apply [%s:%x] imap --> [%s:%x]\n", 583 - op->dev.of_node->full_name, 584 - pp->full_name, this_orig_irq, 585 - of_node_full_name(iret), irq); 582 + printk("%pOF: Apply [%pOF:%x] imap --> [%pOF:%x]\n", 583 + op->dev.of_node, 584 + pp, this_orig_irq, iret, irq); 586 585 587 586 if (!iret) 588 587 break; ··· 591 592 break; 592 593 } 593 594 } else { 594 - if (!strcmp(pp->name, "pci")) { 595 + if (of_node_name_eq(pp, "pci")) { 595 596 unsigned int this_orig_irq = irq; 596 597 597 598 irq = pci_irq_swizzle(dp, pp, irq); 598 599 if (of_irq_verbose) 599 - printk("%s: PCI swizzle [%s] " 600 + printk("%pOF: PCI swizzle [%pOF] " 600 601 "%x --> %x\n", 601 - op->dev.of_node->full_name, 602 - pp->full_name, this_orig_irq, 602 + op->dev.of_node, 603 + pp, this_orig_irq, 603 604 irq); 604 605 605 606 } ··· 618 619 irq = ip->irq_trans->irq_build(op->dev.of_node, irq, 619 620 ip->irq_trans->data); 620 621 if (of_irq_verbose) 621 - printk("%s: Apply IRQ trans [%s] %x --> %x\n", 622 - op->dev.of_node->full_name, ip->full_name, orig_irq, irq); 622 + printk("%pOF: Apply IRQ trans [%pOF] %x --> %x\n", 623 + op->dev.of_node, ip, orig_irq, irq); 623 624 624 625 out: 625 626 nid = of_node_to_nid(dp); ··· 655 656 656 657 /* Prevent overrunning the op->irqs[] array. */ 657 658 if (op->archdata.num_irqs > PROMINTR_MAX) { 658 - printk(KERN_WARNING "%s: Too many irqs (%d), " 659 + printk(KERN_WARNING "%pOF: Too many irqs (%d), " 659 660 "limiting to %d.\n", 660 - dp->full_name, op->archdata.num_irqs, PROMINTR_MAX); 661 + dp, op->archdata.num_irqs, PROMINTR_MAX); 661 662 op->archdata.num_irqs = PROMINTR_MAX; 662 663 } 663 664 memcpy(op->archdata.irqs, irq, op->archdata.num_irqs * 4); ··· 679 680 op->dev.dma_mask = &op->dev.coherent_dma_mask; 680 681 681 682 if (of_device_register(op)) { 682 - printk("%s: Could not register of device.\n", 683 - dp->full_name); 683 + printk("%pOF: Could not register of device.\n", dp); 684 684 kfree(op); 685 685 op = NULL; 686 686 }
+2 -2
arch/sparc/kernel/of_device_common.c
··· 151 151 struct device_node *dp = np; 152 152 153 153 while (dp) { 154 - if (!strcmp(dp->name, "sbus") || 155 - !strcmp(dp->name, "sbi")) 154 + if (of_node_name_eq(dp, "sbus") || 155 + of_node_name_eq(dp, "sbi")) 156 156 return 1; 157 157 158 158 /* Have a look at use_1to1_mapping(). We're trying
+19 -25
arch/sparc/kernel/pci.c
··· 267 267 struct dev_archdata *sd; 268 268 struct platform_device *op; 269 269 struct pci_dev *dev; 270 - const char *type; 271 270 u32 class; 272 271 273 272 dev = pci_alloc_dev(bus); ··· 282 283 sd->stc = &pbm->stc; 283 284 sd->numa_node = pbm->numa_node; 284 285 285 - if (!strcmp(node->name, "ebus")) 286 + if (of_node_name_eq(node, "ebus")) 286 287 of_propagate_archdata(op); 287 - 288 - type = of_get_property(node, "device_type", NULL); 289 - if (type == NULL) 290 - type = ""; 291 288 292 289 if (ofpci_verbose) 293 290 pci_info(bus," create device, devfn: %x, type: %s\n", 294 - devfn, type); 291 + devfn, of_node_get_device_type(node)); 295 292 296 293 dev->sysdata = node; 297 294 dev->dev.parent = bus->bridge; ··· 331 336 dev->error_state = pci_channel_io_normal; 332 337 dev->dma_mask = 0xffffffff; 333 338 334 - if (!strcmp(node->name, "pci")) { 339 + if (of_node_name_eq(node, "pci")) { 335 340 /* a PCI-PCI bridge */ 336 341 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 337 342 dev->rom_base_reg = PCI_ROM_ADDRESS1; 338 - } else if (!strcmp(type, "cardbus")) { 343 + } else if (of_node_is_type(node, "cardbus")) { 339 344 dev->hdr_type = PCI_HEADER_TYPE_CARDBUS; 340 345 } else { 341 346 dev->hdr_type = PCI_HEADER_TYPE_NORMAL; ··· 426 431 u64 size; 427 432 428 433 if (ofpci_verbose) 429 - pci_info(dev, "of_scan_pci_bridge(%s)\n", node->full_name); 434 + pci_info(dev, "of_scan_pci_bridge(%pOF)\n", node); 430 435 431 436 /* parse bus-range property */ 432 437 busrange = of_get_property(node, "bus-range", &len); 433 438 if (busrange == NULL || len != 8) { 434 - pci_info(dev, "Can't get bus-range for PCI-PCI bridge %s\n", 435 - node->full_name); 439 + pci_info(dev, "Can't get bus-range for PCI-PCI bridge %pOF\n", 440 + node); 436 441 return; 437 442 } 438 443 ··· 450 455 451 456 bus = pci_add_new_bus(dev->bus, dev, busrange[0]); 452 457 if (!bus) { 453 - pci_err(dev, "Failed to create pci bus for %s\n", 454 - node->full_name); 458 + pci_err(dev, "Failed to create pci bus for %pOF\n", 459 + node); 455 460 return; 456 461 } 457 462 ··· 507 512 res = bus->resource[0]; 508 513 if (res->flags) { 509 514 pci_err(dev, "ignoring extra I/O range" 510 - " for bridge %s\n", node->full_name); 515 + " for bridge %pOF\n", node); 511 516 continue; 512 517 } 513 518 } else { 514 519 if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { 515 520 pci_err(dev, "too many memory ranges" 516 - " for bridge %s\n", node->full_name); 521 + " for bridge %pOF\n", node); 517 522 continue; 518 523 } 519 524 res = bus->resource[i]; ··· 549 554 struct pci_dev *dev; 550 555 551 556 if (ofpci_verbose) 552 - pci_info(bus, "scan_bus[%s] bus no %d\n", 553 - node->full_name, bus->number); 557 + pci_info(bus, "scan_bus[%pOF] bus no %d\n", 558 + node, bus->number); 554 559 555 560 child = NULL; 556 561 prev_devfn = -1; 557 562 while ((child = of_get_next_child(node, child)) != NULL) { 558 563 if (ofpci_verbose) 559 - pci_info(bus, " * %s\n", child->full_name); 564 + pci_info(bus, " * %pOF\n", child); 560 565 reg = of_get_property(child, "reg", &reglen); 561 566 if (reg == NULL || reglen < 20) 562 567 continue; ··· 593 598 pdev = to_pci_dev(dev); 594 599 dp = pdev->dev.of_node; 595 600 596 - return snprintf (buf, PAGE_SIZE, "%s\n", dp->full_name); 601 + return snprintf (buf, PAGE_SIZE, "%pOF\n", dp); 597 602 } 598 603 599 604 static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_pciobppath_attr, NULL); ··· 693 698 struct device_node *node = pbm->op->dev.of_node; 694 699 struct pci_bus *bus; 695 700 696 - printk("PCI: Scanning PBM %s\n", node->full_name); 701 + printk("PCI: Scanning PBM %pOF\n", node); 697 702 698 703 pci_add_resource_offset(&resources, &pbm->io_space, 699 704 pbm->io_offset); ··· 709 714 bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops, 710 715 pbm, &resources); 711 716 if (!bus) { 712 - printk(KERN_ERR "Failed to create bus for %s\n", 713 - node->full_name); 717 + printk(KERN_ERR "Failed to create bus for %pOF\n", node); 714 718 pci_free_resource_list(&resources); 715 719 return NULL; 716 720 } ··· 1105 1111 sp = prop->names; 1106 1112 1107 1113 if (ofpci_verbose) 1108 - pci_info(bus, "Making slots for [%s] mask[0x%02x]\n", 1109 - node->full_name, mask); 1114 + pci_info(bus, "Making slots for [%pOF] mask[0x%02x]\n", 1115 + node, mask); 1110 1116 1111 1117 i = 0; 1112 1118 while (mask) {
+1 -1
arch/sparc/kernel/pci_sabre.c
··· 475 475 * different ways, inconsistently. 476 476 */ 477 477 for_each_node_by_type(cpu_dp, "cpu") { 478 - if (!strcmp(cpu_dp->name, "SUNW,UltraSPARC-IIe")) 478 + if (of_node_name_eq(cpu_dp, "SUNW,UltraSPARC-IIe")) 479 479 hummingbird_p = 1; 480 480 } 481 481 }
+2 -2
arch/sparc/kernel/power.c
··· 41 41 42 42 power_reg = of_ioremap(res, 0, 0x4, "power"); 43 43 44 - printk(KERN_INFO "%s: Control reg at %llx\n", 45 - op->dev.of_node->name, res->start); 44 + printk(KERN_INFO "%pOFn: Control reg at %llx\n", 45 + op->dev.of_node, res->start); 46 46 47 47 if (has_button_interrupt(irq, op->dev.of_node)) { 48 48 if (request_irq(irq,
+1 -1
arch/sparc/kernel/process_32.c
··· 110 110 void machine_power_off(void) 111 111 { 112 112 if (auxio_power_register && 113 - (strcmp(of_console_device->type, "serial") || scons_pwroff)) { 113 + (!of_node_is_type(of_console_device, "serial") || scons_pwroff)) { 114 114 u8 power_register = sbus_readb(auxio_power_register); 115 115 power_register |= AUXIO_POWER_OFF; 116 116 sbus_writeb(power_register, auxio_power_register);
+22 -22
arch/sparc/kernel/prom_32.c
··· 60 60 */ 61 61 static void __init sparc32_path_component(struct device_node *dp, char *tmp_buf) 62 62 { 63 + const char *name = of_get_property(dp, "name", NULL); 63 64 struct linux_prom_registers *regs; 64 65 struct property *rprop; 65 66 ··· 70 69 71 70 regs = rprop->value; 72 71 sprintf(tmp_buf, "%s@%x,%x", 73 - dp->name, 72 + name, 74 73 regs->which_io, regs->phys_addr); 75 74 } 76 75 77 76 /* "name@slot,offset" */ 78 77 static void __init sbus_path_component(struct device_node *dp, char *tmp_buf) 79 78 { 79 + const char *name = of_get_property(dp, "name", NULL); 80 80 struct linux_prom_registers *regs; 81 81 struct property *prop; 82 82 ··· 87 85 88 86 regs = prop->value; 89 87 sprintf(tmp_buf, "%s@%x,%x", 90 - dp->name, 88 + name, 91 89 regs->which_io, 92 90 regs->phys_addr); 93 91 } ··· 95 93 /* "name@devnum[,func]" */ 96 94 static void __init pci_path_component(struct device_node *dp, char *tmp_buf) 97 95 { 96 + const char *name = of_get_property(dp, "name", NULL); 98 97 struct linux_prom_pci_registers *regs; 99 98 struct property *prop; 100 99 unsigned int devfn; ··· 108 105 devfn = (regs->phys_hi >> 8) & 0xff; 109 106 if (devfn & 0x07) { 110 107 sprintf(tmp_buf, "%s@%x,%x", 111 - dp->name, 108 + name, 112 109 devfn >> 3, 113 110 devfn & 0x07); 114 111 } else { 115 112 sprintf(tmp_buf, "%s@%x", 116 - dp->name, 113 + name, 117 114 devfn >> 3); 118 115 } 119 116 } ··· 121 118 /* "name@addrhi,addrlo" */ 122 119 static void __init ebus_path_component(struct device_node *dp, char *tmp_buf) 123 120 { 121 + const char *name = of_get_property(dp, "name", NULL); 124 122 struct linux_prom_registers *regs; 125 123 struct property *prop; 126 124 ··· 132 128 regs = prop->value; 133 129 134 130 sprintf(tmp_buf, "%s@%x,%x", 135 - dp->name, 131 + name, 136 132 regs->which_io, regs->phys_addr); 137 133 } 138 134 139 135 /* "name:vendor:device@irq,addrlo" */ 140 136 static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf) 141 137 { 138 + const char *name = of_get_property(dp, "name", NULL); 142 139 struct amba_prom_registers *regs; 143 140 unsigned int *intr, *device, *vendor, reg0; 144 141 struct property *prop; ··· 173 168 device = prop->value; 174 169 175 170 sprintf(tmp_buf, "%s:%d:%d@%x,%x", 176 - dp->name, *vendor, *device, 171 + name, *vendor, *device, 177 172 *intr, reg0); 178 173 } 179 174 ··· 182 177 struct device_node *parent = dp->parent; 183 178 184 179 if (parent != NULL) { 185 - if (!strcmp(parent->type, "pci") || 186 - !strcmp(parent->type, "pciex")) 180 + if (of_node_is_type(parent, "pci") || 181 + of_node_is_type(parent, "pciex")) 187 182 return pci_path_component(dp, tmp_buf); 188 - if (!strcmp(parent->type, "sbus")) 183 + if (of_node_is_type(parent, "sbus")) 189 184 return sbus_path_component(dp, tmp_buf); 190 - if (!strcmp(parent->type, "ebus")) 185 + if (of_node_is_type(parent, "ebus")) 191 186 return ebus_path_component(dp, tmp_buf); 192 - if (!strcmp(parent->type, "ambapp")) 187 + if (of_node_is_type(parent, "ambapp")) 193 188 return ambapp_path_component(dp, tmp_buf); 194 189 195 190 /* "isa" is handled with platform naming */ ··· 201 196 202 197 char * __init build_path_component(struct device_node *dp) 203 198 { 199 + const char *name = of_get_property(dp, "name", NULL); 204 200 char tmp_buf[64], *n; 205 201 206 202 tmp_buf[0] = '\0'; 207 203 __build_path_component(dp, tmp_buf); 208 204 if (tmp_buf[0] == '\0') 209 - strcpy(tmp_buf, dp->name); 205 + strcpy(tmp_buf, name); 210 206 211 207 n = prom_early_alloc(strlen(tmp_buf) + 1); 212 208 strcpy(n, tmp_buf); ··· 261 255 } 262 256 of_console_device = dp; 263 257 264 - strcpy(of_console_path, dp->full_name); 258 + sprintf(of_console_path, "%pOF", dp); 265 259 if (!strcmp(type, "serial")) { 266 260 strcat(of_console_path, 267 261 (skip ? ":b" : ":a")); ··· 284 278 prom_halt(); 285 279 } 286 280 dp = of_find_node_by_phandle(node); 287 - type = of_get_property(dp, "device_type", NULL); 288 281 289 - if (!type) { 290 - prom_printf("Console stdout lacks " 291 - "device_type property.\n"); 292 - prom_halt(); 293 - } 294 - 295 - if (strcmp(type, "display") && strcmp(type, "serial")) { 282 + if (!of_node_is_type(dp, "display") && 283 + !of_node_is_type(dp, "serial")) { 296 284 prom_printf("Console device_type is neither display " 297 285 "nor serial.\n"); 298 286 prom_halt(); ··· 295 295 of_console_device = dp; 296 296 297 297 if (prom_vers == PROM_V2) { 298 - strcpy(of_console_path, dp->full_name); 298 + sprintf(of_console_path, "%pOF", dp); 299 299 switch (*romvec->pv_stdout) { 300 300 case PROMDEV_TTYA: 301 301 strcat(of_console_path, ":a");
+40 -35
arch/sparc/kernel/prom_64.c
··· 72 72 */ 73 73 static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf) 74 74 { 75 + const char *name = of_get_property(dp, "name", NULL); 75 76 struct linux_prom64_registers *regs; 76 77 struct property *rprop; 77 78 u32 high_bits, low_bits, type; ··· 84 83 regs = rprop->value; 85 84 if (!of_node_is_root(dp->parent)) { 86 85 sprintf(tmp_buf, "%s@%x,%x", 87 - dp->name, 86 + name, 88 87 (unsigned int) (regs->phys_addr >> 32UL), 89 88 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 90 89 return; ··· 99 98 100 99 if (low_bits) 101 100 sprintf(tmp_buf, "%s@%s%x,%x", 102 - dp->name, prefix, 101 + name, prefix, 103 102 high_bits, low_bits); 104 103 else 105 104 sprintf(tmp_buf, "%s@%s%x", 106 - dp->name, 105 + name, 107 106 prefix, 108 107 high_bits); 109 108 } else if (type == 12) { 110 109 sprintf(tmp_buf, "%s@%x", 111 - dp->name, high_bits); 110 + name, high_bits); 112 111 } 113 112 } 114 113 115 114 static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf) 116 115 { 116 + const char *name = of_get_property(dp, "name", NULL); 117 117 struct linux_prom64_registers *regs; 118 118 struct property *prop; 119 119 ··· 125 123 regs = prop->value; 126 124 if (!of_node_is_root(dp->parent)) { 127 125 sprintf(tmp_buf, "%s@%x,%x", 128 - dp->name, 126 + name, 129 127 (unsigned int) (regs->phys_addr >> 32UL), 130 128 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 131 129 return; ··· 141 139 mask = 0x7fffff; 142 140 143 141 sprintf(tmp_buf, "%s@%x,%x", 144 - dp->name, 142 + name, 145 143 *(u32 *)prop->value, 146 144 (unsigned int) (regs->phys_addr & mask)); 147 145 } ··· 150 148 /* "name@slot,offset" */ 151 149 static void __init sbus_path_component(struct device_node *dp, char *tmp_buf) 152 150 { 151 + const char *name = of_get_property(dp, "name", NULL); 153 152 struct linux_prom_registers *regs; 154 153 struct property *prop; 155 154 ··· 160 157 161 158 regs = prop->value; 162 159 sprintf(tmp_buf, "%s@%x,%x", 163 - dp->name, 160 + name, 164 161 regs->which_io, 165 162 regs->phys_addr); 166 163 } ··· 168 165 /* "name@devnum[,func]" */ 169 166 static void __init pci_path_component(struct device_node *dp, char *tmp_buf) 170 167 { 168 + const char *name = of_get_property(dp, "name", NULL); 171 169 struct linux_prom_pci_registers *regs; 172 170 struct property *prop; 173 171 unsigned int devfn; ··· 181 177 devfn = (regs->phys_hi >> 8) & 0xff; 182 178 if (devfn & 0x07) { 183 179 sprintf(tmp_buf, "%s@%x,%x", 184 - dp->name, 180 + name, 185 181 devfn >> 3, 186 182 devfn & 0x07); 187 183 } else { 188 184 sprintf(tmp_buf, "%s@%x", 189 - dp->name, 185 + name, 190 186 devfn >> 3); 191 187 } 192 188 } ··· 194 190 /* "name@UPA_PORTID,offset" */ 195 191 static void __init upa_path_component(struct device_node *dp, char *tmp_buf) 196 192 { 193 + const char *name = of_get_property(dp, "name", NULL); 197 194 struct linux_prom64_registers *regs; 198 195 struct property *prop; 199 196 ··· 209 204 return; 210 205 211 206 sprintf(tmp_buf, "%s@%x,%x", 212 - dp->name, 207 + name, 213 208 *(u32 *) prop->value, 214 209 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 215 210 } ··· 217 212 /* "name@reg" */ 218 213 static void __init vdev_path_component(struct device_node *dp, char *tmp_buf) 219 214 { 215 + const char *name = of_get_property(dp, "name", NULL); 220 216 struct property *prop; 221 217 u32 *regs; 222 218 ··· 227 221 228 222 regs = prop->value; 229 223 230 - sprintf(tmp_buf, "%s@%x", dp->name, *regs); 224 + sprintf(tmp_buf, "%s@%x", name, *regs); 231 225 } 232 226 233 227 /* "name@addrhi,addrlo" */ 234 228 static void __init ebus_path_component(struct device_node *dp, char *tmp_buf) 235 229 { 230 + const char *name = of_get_property(dp, "name", NULL); 236 231 struct linux_prom64_registers *regs; 237 232 struct property *prop; 238 233 ··· 244 237 regs = prop->value; 245 238 246 239 sprintf(tmp_buf, "%s@%x,%x", 247 - dp->name, 240 + name, 248 241 (unsigned int) (regs->phys_addr >> 32UL), 249 242 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 250 243 } ··· 252 245 /* "name@bus,addr" */ 253 246 static void __init i2c_path_component(struct device_node *dp, char *tmp_buf) 254 247 { 248 + const char *name = of_get_property(dp, "name", NULL); 255 249 struct property *prop; 256 250 u32 *regs; 257 251 ··· 266 258 * property of the i2c bus node etc. etc. 267 259 */ 268 260 sprintf(tmp_buf, "%s@%x,%x", 269 - dp->name, regs[0], regs[1]); 261 + name, regs[0], regs[1]); 270 262 } 271 263 272 264 /* "name@reg0[,reg1]" */ 273 265 static void __init usb_path_component(struct device_node *dp, char *tmp_buf) 274 266 { 267 + const char *name = of_get_property(dp, "name", NULL); 275 268 struct property *prop; 276 269 u32 *regs; 277 270 ··· 284 275 285 276 if (prop->length == sizeof(u32) || regs[1] == 1) { 286 277 sprintf(tmp_buf, "%s@%x", 287 - dp->name, regs[0]); 278 + name, regs[0]); 288 279 } else { 289 280 sprintf(tmp_buf, "%s@%x,%x", 290 - dp->name, regs[0], regs[1]); 281 + name, regs[0], regs[1]); 291 282 } 292 283 } 293 284 294 285 /* "name@reg0reg1[,reg2reg3]" */ 295 286 static void __init ieee1394_path_component(struct device_node *dp, char *tmp_buf) 296 287 { 288 + const char *name = of_get_property(dp, "name", NULL); 297 289 struct property *prop; 298 290 u32 *regs; 299 291 ··· 306 296 307 297 if (regs[2] || regs[3]) { 308 298 sprintf(tmp_buf, "%s@%08x%08x,%04x%08x", 309 - dp->name, regs[0], regs[1], regs[2], regs[3]); 299 + name, regs[0], regs[1], regs[2], regs[3]); 310 300 } else { 311 301 sprintf(tmp_buf, "%s@%08x%08x", 312 - dp->name, regs[0], regs[1]); 302 + name, regs[0], regs[1]); 313 303 } 314 304 } 315 305 ··· 318 308 struct device_node *parent = dp->parent; 319 309 320 310 if (parent != NULL) { 321 - if (!strcmp(parent->type, "pci") || 322 - !strcmp(parent->type, "pciex")) { 311 + if (of_node_is_type(parent, "pci") || 312 + of_node_is_type(parent, "pciex")) { 323 313 pci_path_component(dp, tmp_buf); 324 314 return; 325 315 } 326 - if (!strcmp(parent->type, "sbus")) { 316 + if (of_node_is_type(parent, "sbus")) { 327 317 sbus_path_component(dp, tmp_buf); 328 318 return; 329 319 } 330 - if (!strcmp(parent->type, "upa")) { 320 + if (of_node_is_type(parent, "upa")) { 331 321 upa_path_component(dp, tmp_buf); 332 322 return; 333 323 } 334 - if (!strcmp(parent->type, "ebus")) { 324 + if (of_node_is_type(parent, "ebus")) { 335 325 ebus_path_component(dp, tmp_buf); 336 326 return; 337 327 } 338 - if (!strcmp(parent->name, "usb") || 339 - !strcmp(parent->name, "hub")) { 328 + if (of_node_name_eq(parent, "usb") || 329 + of_node_name_eq(parent, "hub")) { 340 330 usb_path_component(dp, tmp_buf); 341 331 return; 342 332 } 343 - if (!strcmp(parent->type, "i2c")) { 333 + if (of_node_is_type(parent, "i2c")) { 344 334 i2c_path_component(dp, tmp_buf); 345 335 return; 346 336 } 347 - if (!strcmp(parent->type, "firewire")) { 337 + if (of_node_is_type(parent, "firewire")) { 348 338 ieee1394_path_component(dp, tmp_buf); 349 339 return; 350 340 } 351 - if (!strcmp(parent->type, "virtual-devices")) { 341 + if (of_node_is_type(parent, "virtual-devices")) { 352 342 vdev_path_component(dp, tmp_buf); 353 343 return; 354 344 } ··· 366 356 367 357 char * __init build_path_component(struct device_node *dp) 368 358 { 359 + const char *name = of_get_property(dp, "name", NULL); 369 360 char tmp_buf[64], *n; 370 361 371 362 tmp_buf[0] = '\0'; 372 363 __build_path_component(dp, tmp_buf); 373 364 if (tmp_buf[0] == '\0') 374 - strcpy(tmp_buf, dp->name); 365 + strcpy(tmp_buf, name); 375 366 376 367 n = prom_early_alloc(strlen(tmp_buf) + 1); 377 368 strcpy(n, tmp_buf); ··· 605 594 { 606 595 char *msg = "OF stdout device is: %s\n"; 607 596 struct device_node *dp; 608 - const char *type; 609 597 phandle node; 610 598 611 599 of_console_path = prom_early_alloc(256); ··· 627 617 } 628 618 629 619 dp = of_find_node_by_phandle(node); 630 - type = of_get_property(dp, "device_type", NULL); 631 - if (!type) { 632 - prom_printf("Console stdout lacks device_type property.\n"); 633 - prom_halt(); 634 - } 635 620 636 - if (strcmp(type, "display") && strcmp(type, "serial")) { 621 + if (!of_node_is_type(dp, "display") && !of_node_is_type(dp, "serial")) { 637 622 prom_printf("Console device_type is neither display " 638 623 "nor serial.\n"); 639 624 prom_halt();
+10 -10
arch/sparc/kernel/prom_irqtrans.c
··· 193 193 * the DMA synchronization handling 194 194 */ 195 195 while (parent) { 196 - if (!strcmp(parent->type, "pci")) 196 + if (of_node_is_type(parent, "pci")) 197 197 break; 198 198 parent = parent->parent; 199 199 } ··· 725 725 unsigned long imap, iclr; 726 726 u32 tmp; 727 727 728 - if (!strcmp(dp->name, "eeprom")) { 728 + if (of_node_name_eq(dp, "eeprom")) { 729 729 res = &central_op->resource[5]; 730 - } else if (!strcmp(dp->name, "zs")) { 730 + } else if (of_node_name_eq(dp, "zs")) { 731 731 res = &central_op->resource[4]; 732 - } else if (!strcmp(dp->name, "clock-board")) { 732 + } else if (of_node_name_eq(dp, "clock-board")) { 733 733 res = &central_op->resource[3]; 734 734 } else { 735 735 return ino; ··· 824 824 } 825 825 #endif 826 826 #ifdef CONFIG_SBUS 827 - if (!strcmp(dp->name, "sbus") || 828 - !strcmp(dp->name, "sbi")) { 827 + if (of_node_name_eq(dp, "sbus") || 828 + of_node_name_eq(dp, "sbi")) { 829 829 sbus_irq_trans_init(dp); 830 830 return; 831 831 } 832 832 #endif 833 - if (!strcmp(dp->name, "fhc") && 834 - !strcmp(dp->parent->name, "central")) { 833 + if (of_node_name_eq(dp, "fhc") && 834 + of_node_name_eq(dp->parent, "central")) { 835 835 central_irq_trans_init(dp); 836 836 return; 837 837 } 838 - if (!strcmp(dp->name, "virtual-devices") || 839 - !strcmp(dp->name, "niu")) { 838 + if (of_node_name_eq(dp, "virtual-devices") || 839 + of_node_name_eq(dp, "niu")) { 840 840 sun4v_vdev_irq_trans_init(dp); 841 841 return; 842 842 }
+2 -1
arch/sparc/kernel/reboot.c
··· 7 7 #include <linux/reboot.h> 8 8 #include <linux/export.h> 9 9 #include <linux/pm.h> 10 + #include <linux/of.h> 10 11 11 12 #include <asm/oplib.h> 12 13 #include <asm/prom.h> ··· 26 25 27 26 void machine_power_off(void) 28 27 { 29 - if (strcmp(of_console_device->type, "serial") || scons_pwroff) 28 + if (!of_node_is_type(of_console_device, "serial") || scons_pwroff) 30 29 prom_halt_power_off(); 31 30 32 31 prom_halt();
+2 -2
arch/sparc/kernel/sbus.c
··· 67 67 68 68 regs = of_get_property(op->dev.of_node, "reg", NULL); 69 69 if (!regs) { 70 - printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n", 71 - op->dev.of_node->full_name); 70 + printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %pOF\n", 71 + op->dev.of_node); 72 72 return; 73 73 } 74 74 slot = regs->which_io;
+7 -7
arch/sparc/kernel/sun4d_irq.c
··· 335 335 336 336 irq = real_irq; 337 337 while (bus) { 338 - if (!strcmp(bus->name, "sbi")) { 338 + if (of_node_name_eq(bus, "sbi")) { 339 339 bus_connection = "io-unit"; 340 340 break; 341 341 } 342 342 343 - if (!strcmp(bus->name, "bootbus")) { 343 + if (of_node_name_eq(bus, "bootbus")) { 344 344 bus_connection = "cpu-unit"; 345 345 break; 346 346 } ··· 360 360 * If Bus nodes parent is not io-unit/cpu-unit or the io-unit/cpu-unit 361 361 * lacks a "board#" property, something is very wrong. 362 362 */ 363 - if (!bus->parent || strcmp(bus->parent->name, bus_connection)) { 364 - printk(KERN_ERR "%s: Error, parent is not %s.\n", 365 - bus->full_name, bus_connection); 363 + if (!of_node_name_eq(bus->parent, bus_connection)) { 364 + printk(KERN_ERR "%pOF: Error, parent is not %s.\n", 365 + bus, bus_connection); 366 366 goto err_out; 367 367 } 368 368 board_parent = bus->parent; 369 369 board = of_getintprop_default(board_parent, "board#", -1); 370 370 if (board == -1) { 371 - printk(KERN_ERR "%s: Error, lacks board# property.\n", 372 - board_parent->full_name); 371 + printk(KERN_ERR "%pOF: Error, lacks board# property.\n", 372 + board_parent); 373 373 goto err_out; 374 374 } 375 375
+8 -8
arch/sparc/kernel/time_64.c
··· 445 445 { 446 446 struct resource *r; 447 447 448 - printk(KERN_INFO "%s: RTC regs at 0x%llx\n", 449 - op->dev.of_node->full_name, op->resource[0].start); 448 + printk(KERN_INFO "%pOF: RTC regs at 0x%llx\n", 449 + op->dev.of_node, op->resource[0].start); 450 450 451 451 /* The CMOS RTC driver only accepts IORESOURCE_IO, so cons 452 452 * up a fake resource so that the probe works for all cases. ··· 501 501 static int bq4802_probe(struct platform_device *op) 502 502 { 503 503 504 - printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 505 - op->dev.of_node->full_name, op->resource[0].start); 504 + printk(KERN_INFO "%pOF: BQ4802 regs at 0x%llx\n", 505 + op->dev.of_node, op->resource[0].start); 506 506 507 507 rtc_bq4802_device.resource = &op->resource[0]; 508 508 return platform_device_register(&rtc_bq4802_device); ··· 561 561 /* On an Enterprise system there can be multiple mostek clocks. 562 562 * We should only match the one that is on the central FHC bus. 563 563 */ 564 - if (!strcmp(dp->parent->name, "fhc") && 565 - strcmp(dp->parent->parent->name, "central") != 0) 564 + if (of_node_name_eq(dp->parent, "fhc") && 565 + !of_node_name_eq(dp->parent->parent, "central")) 566 566 return -ENODEV; 567 567 568 - printk(KERN_INFO "%s: Mostek regs at 0x%llx\n", 569 - dp->full_name, op->resource[0].start); 568 + printk(KERN_INFO "%pOF: Mostek regs at 0x%llx\n", 569 + dp, op->resource[0].start); 570 570 571 571 m48t59_rtc.resource = &op->resource[0]; 572 572 return platform_device_register(&m48t59_rtc);
+3 -6
arch/sparc/kernel/vio.c
··· 193 193 vdev = to_vio_dev(dev); 194 194 dp = vdev->dp; 195 195 196 - return snprintf (buf, PAGE_SIZE, "%s\n", dp->full_name); 196 + return snprintf (buf, PAGE_SIZE, "%pOF\n", dp); 197 197 } 198 198 199 199 static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, ··· 366 366 if (parent == NULL) { 367 367 dp = cdev_node; 368 368 } else if (to_vio_dev(parent) == root_vdev) { 369 - dp = of_get_next_child(cdev_node, NULL); 370 - while (dp) { 371 - if (!strcmp(dp->type, type)) 369 + for_each_child_of_node(cdev_node, dp) { 370 + if (of_node_is_type(dp, type)) 372 371 break; 373 - 374 - dp = of_get_next_child(cdev_node, dp); 375 372 } 376 373 } else { 377 374 dp = to_vio_dev(parent)->dp;
+14 -36
drivers/of/pdt.c
··· 32 32 33 33 static char * __init of_pdt_build_full_name(struct device_node *dp) 34 34 { 35 - int len, ourlen, plen; 36 - char *n; 37 - 38 - dp->path_component_name = build_path_component(dp); 39 - 40 - plen = strlen(dp->parent->full_name); 41 - ourlen = strlen(dp->path_component_name); 42 - len = ourlen + plen + 2; 43 - 44 - n = prom_early_alloc(len); 45 - strcpy(n, dp->parent->full_name); 46 - if (!of_node_is_root(dp->parent)) { 47 - strcpy(n + plen, "/"); 48 - plen++; 49 - } 50 - strcpy(n + plen, dp->path_component_name); 51 - 52 - return n; 35 + return build_path_component(dp); 53 36 } 54 37 55 38 #else /* CONFIG_SPARC */ ··· 43 60 static char * __init of_pdt_build_full_name(struct device_node *dp) 44 61 { 45 62 static int failsafe_id = 0; /* for generating unique names on failure */ 63 + const char *name; 64 + char path[256]; 46 65 char *buf; 47 66 int len; 48 67 49 - if (of_pdt_prom_ops->pkg2path(dp->phandle, NULL, 0, &len)) 50 - goto failsafe; 68 + if (!of_pdt_prom_ops->pkg2path(dp->phandle, path, sizeof(path), &len)) { 69 + name = kbasename(path); 70 + buf = prom_early_alloc(strlen(name) + 1); 71 + strcpy(buf, name); 72 + return buf; 73 + } 51 74 52 - buf = prom_early_alloc(len + 1); 53 - if (of_pdt_prom_ops->pkg2path(dp->phandle, buf, len, &len)) 54 - goto failsafe; 55 - return buf; 56 - 57 - failsafe: 58 - buf = prom_early_alloc(strlen(dp->parent->full_name) + 59 - strlen(dp->name) + 16); 60 - sprintf(buf, "%s/%s@unknown%i", 61 - of_node_is_root(dp->parent) ? "" : dp->parent->full_name, 62 - dp->name, failsafe_id++); 75 + name = of_get_property(dp, "name", &len); 76 + buf = prom_early_alloc(len + 16); 77 + sprintf(buf, "%s@unknown%i", name, failsafe_id++); 63 78 pr_err("%s: pkg2path failed; assigning %s\n", __func__, buf); 64 79 return buf; 65 80 } ··· 162 181 163 182 dp->properties = of_pdt_build_prop_list(node); 164 183 184 + dp->full_name = of_pdt_build_full_name(dp); 185 + 165 186 irq_trans_init(dp); 166 187 167 188 return dp; ··· 187 204 ret = dp; 188 205 prev_sibling = dp; 189 206 190 - dp->full_name = of_pdt_build_full_name(dp); 191 - 192 207 dp->child = of_pdt_build_tree(dp, of_pdt_prom_ops->getchild(node)); 193 208 194 209 if (of_pdt_build_more) ··· 209 228 of_pdt_prom_ops = ops; 210 229 211 230 of_root = of_pdt_create_node(root_node, NULL); 212 - #if defined(CONFIG_SPARC) 213 - of_root->path_component_name = ""; 214 - #endif 215 231 of_root->full_name = "/"; 216 232 217 233 of_root->child = of_pdt_build_tree(of_root,
+6 -5
fs/openpromfs/inode.c
··· 199 199 200 200 child = dp->child; 201 201 while (child) { 202 - int n = strlen(child->path_component_name); 202 + const char *node_name = kbasename(child->full_name); 203 + int n = strlen(node_name); 203 204 204 205 if (len == n && 205 - !strncmp(child->path_component_name, name, len)) { 206 + !strncmp(node_name, name, len)) { 206 207 ent_type = op_inode_node; 207 208 ent_data.node = child; 208 209 ino = child->unique_id; ··· 246 245 set_nlink(inode, 2); 247 246 break; 248 247 case op_inode_prop: 249 - if (!strcmp(dp->name, "options") && (len == 17) && 248 + if (of_node_name_eq(dp, "options") && (len == 17) && 250 249 !strncmp (name, "security-password", 17)) 251 250 inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR; 252 251 else ··· 294 293 } 295 294 while (child) { 296 295 if (!dir_emit(ctx, 297 - child->path_component_name, 298 - strlen(child->path_component_name), 296 + kbasename(child->full_name), 297 + strlen(kbasename(child->full_name)), 299 298 child->unique_id, DT_DIR)) 300 299 goto out; 301 300
-1
include/linux/of.h
··· 66 66 unsigned long _flags; 67 67 void *data; 68 68 #if defined(CONFIG_SPARC) 69 - const char *path_component_name; 70 69 unsigned int unique_id; 71 70 struct of_irq_controller *irq_trans; 72 71 #endif