Commit 2c8e65b5 authored by Rob Herring's avatar Rob Herring Committed by Michael Ellerman
Browse files

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

A couple of open coded iterating thru the child node names are converted
to use for_each_child_of_node() instead.

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 0d1223dd
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -400,8 +400,7 @@ void __init find_legacy_serial_ports(void)
	/* Next, fill our array with ISA ports */
	for_each_node_by_type(np, "serial") {
		struct device_node *isa = of_get_parent(np);
		if (isa && (!strcmp(isa->name, "isa") ||
			    !strcmp(isa->name, "lpc"))) {
		if (of_node_name_eq(isa, "isa") || of_node_name_eq(isa, "lpc")) {
			if (of_device_is_available(np)) {
				index = add_legacy_isa_port(np, isa);
				if (index >= 0 && np == stdout)
@@ -415,11 +414,11 @@ void __init find_legacy_serial_ports(void)
	/* Next, try to locate PCI ports */
	for (np = NULL; (np = of_find_all_nodes(np));) {
		struct device_node *pci, *parent = of_get_parent(np);
		if (parent && !strcmp(parent->name, "isa")) {
		if (of_node_name_eq(parent, "isa")) {
			of_node_put(parent);
			continue;
		}
		if (strcmp(np->name, "serial") &&
		if (!of_node_name_eq(np, "serial") &&
		    !of_node_is_type(np, "serial")) {
			of_node_put(parent);
			continue;
+2 −2
Original line number Diff line number Diff line
@@ -179,9 +179,9 @@ static int pika_setup_leds(void)
	}

	for_each_child_of_node(np, child)
		if (strcmp(child->name, "green") == 0)
		if (of_node_name_eq(child, "green"))
			green_led = of_get_gpio(child, 0);
		else if (strcmp(child->name, "red") == 0)
		else if (of_node_name_eq(child, "red"))
			red_led = of_get_gpio(child, 0);

	of_node_put(np);
+2 −4
Original line number Diff line number Diff line
@@ -82,11 +82,9 @@ static void __init efika_pcisetup(void)
		return;
	}

	for (pcictrl = NULL;;) {
		pcictrl = of_get_next_child(root, pcictrl);
		if ((pcictrl == NULL) || (strcmp(pcictrl->name, "pci") == 0))
	for_each_child_of_node(root, pcictrl)
		if (of_node_name_eq(pcictrl, "pci"))
			break;
	}

	of_node_put(root);

+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ static int cell_setup_phb(struct pci_controller *phb)

	np = phb->dn;
	model = of_get_property(np, "model", NULL);
	if (model == NULL || strcmp(np->name, "pci"))
	if (model == NULL || !of_node_name_eq(np, "pci"))
		return 0;

	/* Setup workarounds for spider */
+2 −8
Original line number Diff line number Diff line
@@ -458,7 +458,6 @@ static void init_affinity_node(int cbe)
	struct device_node *vic_dn, *last_spu_dn;
	phandle avoid_ph;
	const phandle *vic_handles;
	const char *name;
	int lenp, i, added;

	last_spu = list_first_entry(&cbe_spu_info[cbe].spus, struct spu,
@@ -480,12 +479,7 @@ static void init_affinity_node(int cbe)
			if (!vic_dn)
				continue;

			/* a neighbour might be spe, mic-tm, or bif0 */
			name = of_get_property(vic_dn, "name", NULL);
			if (!name)
				continue;

			if (strcmp(name, "spe") == 0) {
			if (of_node_name_eq(vic_dn, "spe") ) {
				spu = devnode_spu(cbe, vic_dn);
				avoid_ph = last_spu_dn->phandle;
			} else {
@@ -498,7 +492,7 @@ static void init_affinity_node(int cbe)
				spu = neighbour_spu(cbe, vic_dn, last_spu_dn);
				if (!spu)
					continue;
				if (!strcmp(name, "mic-tm")) {
				if (of_node_name_eq(vic_dn, "mic-tm")) {
					last_spu->has_mem_affinity = 1;
					spu->has_mem_affinity = 1;
				}
Loading