sparc: Use of_node_name_eq for node name comparisons
Convert string compares of DT node names to use of_node_name_eq helper instead. This removes direct access to the node name pointer. Cc: "David S. Miller" <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ead1c2bded
commit
29c990dfc7
@@ -528,9 +528,9 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
|
|||||||
|
|
||||||
static int __init ebus_fdthree_p(struct device_node *dp)
|
static int __init ebus_fdthree_p(struct device_node *dp)
|
||||||
{
|
{
|
||||||
if (!strcmp(dp->name, "fdthree"))
|
if (of_node_name_eq(dp, "fdthree"))
|
||||||
return 1;
|
return 1;
|
||||||
if (!strcmp(dp->name, "floppy")) {
|
if (of_node_name_eq(dp, "floppy")) {
|
||||||
const char *compat;
|
const char *compat;
|
||||||
|
|
||||||
compat = of_get_property(dp, "compatible", NULL);
|
compat = of_get_property(dp, "compatible", NULL);
|
||||||
@@ -555,7 +555,7 @@ static unsigned long __init sun_floppy_init(void)
|
|||||||
op = NULL;
|
op = NULL;
|
||||||
|
|
||||||
for_each_node_by_name(dp, "SUNW,fdtwo") {
|
for_each_node_by_name(dp, "SUNW,fdtwo") {
|
||||||
if (strcmp(dp->parent->name, "sbus"))
|
if (!of_node_name_eq(dp->parent, "sbus"))
|
||||||
continue;
|
continue;
|
||||||
op = of_find_device_by_node(dp);
|
op = of_find_device_by_node(dp);
|
||||||
if (op)
|
if (op)
|
||||||
@@ -656,7 +656,7 @@ static unsigned long __init sun_floppy_init(void)
|
|||||||
*/
|
*/
|
||||||
config = 0;
|
config = 0;
|
||||||
for (dp = ebus_dp->child; dp; dp = dp->sibling) {
|
for (dp = ebus_dp->child; dp; dp = dp->sibling) {
|
||||||
if (!strcmp(dp->name, "ecpp")) {
|
if (of_node_name_eq(dp, "ecpp")) {
|
||||||
struct platform_device *ecpp_op;
|
struct platform_device *ecpp_op;
|
||||||
|
|
||||||
ecpp_op = of_find_device_by_node(dp);
|
ecpp_op = of_find_device_by_node(dp);
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ static int ecpp_probe(struct platform_device *op)
|
|||||||
int slot, err;
|
int slot, err;
|
||||||
|
|
||||||
parent = op->dev.of_node->parent;
|
parent = op->dev.of_node->parent;
|
||||||
if (!strcmp(parent->name, "dma")) {
|
if (of_node_name_eq(parent, "dma")) {
|
||||||
p = parport_pc_probe_port(base, base + 0x400,
|
p = parport_pc_probe_port(base, base + 0x400,
|
||||||
op->archdata.irqs[0], PARPORT_DMA_NOFIFO,
|
op->archdata.irqs[0], PARPORT_DMA_NOFIFO,
|
||||||
op->dev.parent->parent, 0);
|
op->dev.parent->parent, 0);
|
||||||
|
|||||||
@@ -108,10 +108,10 @@ static int auxio_probe(struct platform_device *dev)
|
|||||||
struct device_node *dp = dev->dev.of_node;
|
struct device_node *dp = dev->dev.of_node;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
||||||
if (!strcmp(dp->parent->name, "ebus")) {
|
if (of_node_name_eq(dp->parent, "ebus")) {
|
||||||
auxio_devtype = AUXIO_TYPE_EBUS;
|
auxio_devtype = AUXIO_TYPE_EBUS;
|
||||||
size = sizeof(u32);
|
size = sizeof(u32);
|
||||||
} else if (!strcmp(dp->parent->name, "sbus")) {
|
} else if (of_node_name_eq(dp->parent, "sbus")) {
|
||||||
auxio_devtype = AUXIO_TYPE_SBUS;
|
auxio_devtype = AUXIO_TYPE_SBUS;
|
||||||
size = 1;
|
size = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ static int fhc_probe(struct platform_device *op)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(op->dev.of_node->parent->name, "central"))
|
if (of_node_name_eq(op->dev.of_node->parent, "central"))
|
||||||
p->central = true;
|
p->central = true;
|
||||||
|
|
||||||
p->pregs = of_ioremap(&op->resource[0], 0,
|
p->pregs = of_ioremap(&op->resource[0], 0,
|
||||||
|
|||||||
@@ -915,7 +915,7 @@ static void map_prom_timers(void)
|
|||||||
dp = of_find_node_by_path("/");
|
dp = of_find_node_by_path("/");
|
||||||
dp = dp->child;
|
dp = dp->child;
|
||||||
while (dp) {
|
while (dp) {
|
||||||
if (!strcmp(dp->name, "counter-timer"))
|
if (of_node_name_eq(dp, "counter-timer"))
|
||||||
break;
|
break;
|
||||||
dp = dp->sibling;
|
dp = dp->sibling;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,10 +232,10 @@ static int __init use_1to1_mapping(struct device_node *pp)
|
|||||||
* But, we should still pass the translation work up
|
* But, we should still pass the translation work up
|
||||||
* to the SBUS itself.
|
* to the SBUS itself.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(pp->name, "dma") ||
|
if (of_node_name_eq(pp, "dma") ||
|
||||||
!strcmp(pp->name, "espdma") ||
|
of_node_name_eq(pp, "espdma") ||
|
||||||
!strcmp(pp->name, "ledma") ||
|
of_node_name_eq(pp, "ledma") ||
|
||||||
!strcmp(pp->name, "lebuffer"))
|
of_node_name_eq(pp, "lebuffer"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ EXPORT_SYMBOL(of_iounmap);
|
|||||||
|
|
||||||
static int of_bus_pci_match(struct device_node *np)
|
static int of_bus_pci_match(struct device_node *np)
|
||||||
{
|
{
|
||||||
if (!strcmp(np->name, "pci")) {
|
if (of_node_name_eq(np, "pci")) {
|
||||||
const char *model = of_get_property(np, "model", NULL);
|
const char *model = of_get_property(np, "model", NULL);
|
||||||
|
|
||||||
if (model && !strcmp(model, "SUNW,simba"))
|
if (model && !strcmp(model, "SUNW,simba"))
|
||||||
@@ -77,7 +77,7 @@ static int of_bus_simba_match(struct device_node *np)
|
|||||||
/* Treat PCI busses lacking ranges property just like
|
/* Treat PCI busses lacking ranges property just like
|
||||||
* simba.
|
* simba.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(np->name, "pci")) {
|
if (of_node_name_eq(np, "pci")) {
|
||||||
if (!of_find_property(np, "ranges", NULL))
|
if (!of_find_property(np, "ranges", NULL))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -170,8 +170,8 @@ static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
|
|||||||
*/
|
*/
|
||||||
static int of_bus_fhc_match(struct device_node *np)
|
static int of_bus_fhc_match(struct device_node *np)
|
||||||
{
|
{
|
||||||
return !strcmp(np->name, "fhc") ||
|
return of_node_name_eq(np, "fhc") ||
|
||||||
!strcmp(np->name, "central");
|
of_node_name_eq(np, "central");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define of_bus_fhc_count_cells of_bus_sbus_count_cells
|
#define of_bus_fhc_count_cells of_bus_sbus_count_cells
|
||||||
@@ -295,17 +295,17 @@ static int __init use_1to1_mapping(struct device_node *pp)
|
|||||||
* But, we should still pass the translation work up
|
* But, we should still pass the translation work up
|
||||||
* to the SBUS itself.
|
* to the SBUS itself.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(pp->name, "dma") ||
|
if (of_node_name_eq(pp, "dma") ||
|
||||||
!strcmp(pp->name, "espdma") ||
|
of_node_name_eq(pp, "espdma") ||
|
||||||
!strcmp(pp->name, "ledma") ||
|
of_node_name_eq(pp, "ledma") ||
|
||||||
!strcmp(pp->name, "lebuffer"))
|
of_node_name_eq(pp, "lebuffer"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Similarly for all PCI bridges, if we get this far
|
/* Similarly for all PCI bridges, if we get this far
|
||||||
* it lacks a ranges property, and this will include
|
* it lacks a ranges property, and this will include
|
||||||
* cases like Simba.
|
* cases like Simba.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(pp->name, "pci"))
|
if (of_node_name_eq(pp, "pci"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -591,7 +591,7 @@ static unsigned int __init build_one_device_irq(struct platform_device *op,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!strcmp(pp->name, "pci")) {
|
if (of_node_name_eq(pp, "pci")) {
|
||||||
unsigned int this_orig_irq = irq;
|
unsigned int this_orig_irq = irq;
|
||||||
|
|
||||||
irq = pci_irq_swizzle(dp, pp, irq);
|
irq = pci_irq_swizzle(dp, pp, irq);
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ int of_bus_sbus_match(struct device_node *np)
|
|||||||
struct device_node *dp = np;
|
struct device_node *dp = np;
|
||||||
|
|
||||||
while (dp) {
|
while (dp) {
|
||||||
if (!strcmp(dp->name, "sbus") ||
|
if (of_node_name_eq(dp, "sbus") ||
|
||||||
!strcmp(dp->name, "sbi"))
|
of_node_name_eq(dp, "sbi"))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Have a look at use_1to1_mapping(). We're trying
|
/* Have a look at use_1to1_mapping(). We're trying
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
|
|||||||
sd->stc = &pbm->stc;
|
sd->stc = &pbm->stc;
|
||||||
sd->numa_node = pbm->numa_node;
|
sd->numa_node = pbm->numa_node;
|
||||||
|
|
||||||
if (!strcmp(node->name, "ebus"))
|
if (of_node_name_eq(node, "ebus"))
|
||||||
of_propagate_archdata(op);
|
of_propagate_archdata(op);
|
||||||
|
|
||||||
type = of_get_property(node, "device_type", NULL);
|
type = of_get_property(node, "device_type", NULL);
|
||||||
@@ -336,7 +336,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
|
|||||||
dev->error_state = pci_channel_io_normal;
|
dev->error_state = pci_channel_io_normal;
|
||||||
dev->dma_mask = 0xffffffff;
|
dev->dma_mask = 0xffffffff;
|
||||||
|
|
||||||
if (!strcmp(node->name, "pci")) {
|
if (of_node_name_eq(node, "pci")) {
|
||||||
/* a PCI-PCI bridge */
|
/* a PCI-PCI bridge */
|
||||||
dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
|
dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
|
||||||
dev->rom_base_reg = PCI_ROM_ADDRESS1;
|
dev->rom_base_reg = PCI_ROM_ADDRESS1;
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ static int sabre_probe(struct platform_device *op)
|
|||||||
* different ways, inconsistently.
|
* different ways, inconsistently.
|
||||||
*/
|
*/
|
||||||
for_each_node_by_type(cpu_dp, "cpu") {
|
for_each_node_by_type(cpu_dp, "cpu") {
|
||||||
if (!strcmp(cpu_dp->name, "SUNW,UltraSPARC-IIe"))
|
if (of_node_name_eq(cpu_dp, "SUNW,UltraSPARC-IIe"))
|
||||||
hummingbird_p = 1;
|
hummingbird_p = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,8 +335,8 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
|
|||||||
ebus_path_component(dp, tmp_buf);
|
ebus_path_component(dp, tmp_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!strcmp(parent->name, "usb") ||
|
if (of_node_name_eq(parent, "usb") ||
|
||||||
!strcmp(parent->name, "hub")) {
|
of_node_name_eq(parent, "hub")) {
|
||||||
usb_path_component(dp, tmp_buf);
|
usb_path_component(dp, tmp_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -725,11 +725,11 @@ static unsigned int central_build_irq(struct device_node *dp,
|
|||||||
unsigned long imap, iclr;
|
unsigned long imap, iclr;
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
if (!strcmp(dp->name, "eeprom")) {
|
if (of_node_name_eq(dp, "eeprom")) {
|
||||||
res = ¢ral_op->resource[5];
|
res = ¢ral_op->resource[5];
|
||||||
} else if (!strcmp(dp->name, "zs")) {
|
} else if (of_node_name_eq(dp, "zs")) {
|
||||||
res = ¢ral_op->resource[4];
|
res = ¢ral_op->resource[4];
|
||||||
} else if (!strcmp(dp->name, "clock-board")) {
|
} else if (of_node_name_eq(dp, "clock-board")) {
|
||||||
res = ¢ral_op->resource[3];
|
res = ¢ral_op->resource[3];
|
||||||
} else {
|
} else {
|
||||||
return ino;
|
return ino;
|
||||||
@@ -824,19 +824,19 @@ void __init irq_trans_init(struct device_node *dp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SBUS
|
#ifdef CONFIG_SBUS
|
||||||
if (!strcmp(dp->name, "sbus") ||
|
if (of_node_name_eq(dp, "sbus") ||
|
||||||
!strcmp(dp->name, "sbi")) {
|
of_node_name_eq(dp, "sbi")) {
|
||||||
sbus_irq_trans_init(dp);
|
sbus_irq_trans_init(dp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!strcmp(dp->name, "fhc") &&
|
if (of_node_name_eq(dp, "fhc") &&
|
||||||
!strcmp(dp->parent->name, "central")) {
|
of_node_name_eq(dp->parent, "central")) {
|
||||||
central_irq_trans_init(dp);
|
central_irq_trans_init(dp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!strcmp(dp->name, "virtual-devices") ||
|
if (of_node_name_eq(dp, "virtual-devices") ||
|
||||||
!strcmp(dp->name, "niu")) {
|
of_node_name_eq(dp, "niu")) {
|
||||||
sun4v_vdev_irq_trans_init(dp);
|
sun4v_vdev_irq_trans_init(dp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,12 +335,12 @@ static unsigned int sun4d_build_device_irq(struct platform_device *op,
|
|||||||
|
|
||||||
irq = real_irq;
|
irq = real_irq;
|
||||||
while (bus) {
|
while (bus) {
|
||||||
if (!strcmp(bus->name, "sbi")) {
|
if (of_node_name_eq(bus, "sbi")) {
|
||||||
bus_connection = "io-unit";
|
bus_connection = "io-unit";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(bus->name, "bootbus")) {
|
if (of_node_name_eq(bus, "bootbus")) {
|
||||||
bus_connection = "cpu-unit";
|
bus_connection = "cpu-unit";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ static unsigned int sun4d_build_device_irq(struct platform_device *op,
|
|||||||
* If Bus nodes parent is not io-unit/cpu-unit or the io-unit/cpu-unit
|
* If Bus nodes parent is not io-unit/cpu-unit or the io-unit/cpu-unit
|
||||||
* lacks a "board#" property, something is very wrong.
|
* lacks a "board#" property, something is very wrong.
|
||||||
*/
|
*/
|
||||||
if (!bus->parent || strcmp(bus->parent->name, bus_connection)) {
|
if (!of_node_name_eq(bus->parent, bus_connection)) {
|
||||||
printk(KERN_ERR "%pOF: Error, parent is not %s.\n",
|
printk(KERN_ERR "%pOF: Error, parent is not %s.\n",
|
||||||
bus, bus_connection);
|
bus, bus_connection);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|||||||
@@ -561,8 +561,8 @@ static int mostek_probe(struct platform_device *op)
|
|||||||
/* On an Enterprise system there can be multiple mostek clocks.
|
/* On an Enterprise system there can be multiple mostek clocks.
|
||||||
* We should only match the one that is on the central FHC bus.
|
* We should only match the one that is on the central FHC bus.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(dp->parent->name, "fhc") &&
|
if (of_node_name_eq(dp->parent, "fhc") &&
|
||||||
strcmp(dp->parent->parent->name, "central") != 0)
|
!of_node_name_eq(dp->parent->parent, "central"))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
printk(KERN_INFO "%pOF: Mostek regs at 0x%llx\n",
|
printk(KERN_INFO "%pOF: Mostek regs at 0x%llx\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user