Commit 30686ba6 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Paul Mackerras
Browse files

[POWERPC] Remove old interface find_devices



Replace uses with of_find_node_by_name and for_each_node_by_name.

Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 1658ab66
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -1072,25 +1072,6 @@ int of_n_size_cells(struct device_node* np)
}
EXPORT_SYMBOL(of_n_size_cells);

/**
 * Construct and return a list of the device_nodes with a given name.
 */
struct device_node *find_devices(const char *name)
{
	struct device_node *head, **prevp, *np;

	prevp = &head;
	for (np = allnodes; np != 0; np = np->allnext) {
		if (np->name != 0 && strcasecmp(np->name, name) == 0) {
			*prevp = np;
			prevp = &np->next;
		}
	}
	*prevp = NULL;
	return head;
}
EXPORT_SYMBOL(find_devices);

/** Checks if the given "compat" string matches one of the strings in
 * the device's "compatible" property
 */
+2 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ static int __init vio_bus_init(void)
		return err;
	}

	node_vroot = find_devices("vdevice");
	node_vroot = of_find_node_by_name(NULL, "vdevice");
	if (node_vroot) {
		struct device_node *of_node;

@@ -322,6 +322,7 @@ static int __init vio_bus_init(void)
					__FUNCTION__, of_node);
			vio_register_device_node(of_node);
		}
		of_node_put(node_vroot);
	}

	return 0;
+4 −2
Original line number Diff line number Diff line
@@ -136,9 +136,11 @@ hydra_init(void)
	struct device_node *np;
	struct resource r;

	np = find_devices("mac-io");
	if (np == NULL || of_address_to_resource(np, 0, &r))
	np = of_find_node_by_name(NULL, "mac-io");
	if (np == NULL || of_address_to_resource(np, 0, &r)) {
		of_node_put(np);
		return 0;
	}
	Hydra = ioremap(r.start, r.end-r.start);
	printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start);
	printk("Hydra Feature_Control was %x",
+6 −3
Original line number Diff line number Diff line
@@ -468,7 +468,7 @@ static void __init chrp_find_8259(void)
	 * Also, Pegasos-type platforms don't have a proper node to start
	 * from anyway
	 */
	for (np = find_devices("pci"); np != NULL; np = np->next) {
	for_each_node_by_name(np, "pci") {
		const unsigned int *addrp = of_get_property(np,
				"8259-interrupt-acknowledge", NULL);

@@ -477,6 +477,7 @@ static void __init chrp_find_8259(void)
		chrp_int_ack = addrp[of_n_addr_cells(np)-1];
		break;
	}
	of_node_put(np);
	if (np == NULL)
		printk(KERN_WARNING "Cannot find PCI interrupt acknowledge"
		       " address, polling\n");
@@ -518,10 +519,11 @@ void __init chrp_init_IRQ(void)
#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
	/* see if there is a keyboard in the device tree
	   with a parent of type "adb" */
	for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next)
	for_each_node_by_name(kbd, "keyboard")
		if (kbd->parent && kbd->parent->type
		    && strcmp(kbd->parent->type, "adb") == 0)
			break;
	of_node_put(kbd);
	if (kbd)
		setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction);
#endif
@@ -547,7 +549,7 @@ chrp_init2(void)
	/* Get the event scan rate for the rtas so we know how
	 * often it expects a heartbeat. -- Cort
	 */
	device = find_devices("rtas");
	device = of_find_node_by_name(NULL, "rtas");
	if (device)
		p = of_get_property(device, "rtas-event-scan-rate", NULL);
	if (p && *p) {
@@ -576,6 +578,7 @@ chrp_init2(void)
		printk("RTAS Event Scan Rate: %u (%lu jiffies)\n",
		       *p, interval);
	}
	of_node_put(device);

	if (ppc_md.progress)
		ppc_md.progress("  Have fun!    ", 0x7777);
+5 −2
Original line number Diff line number Diff line
@@ -56,14 +56,17 @@ struct backlight_device *pmac_backlight;

int pmac_has_backlight_type(const char *type)
{
	struct device_node* bk_node = find_devices("backlight");
	struct device_node* bk_node = of_find_node_by_name(NULL, "backlight");

	if (bk_node) {
		const char *prop = of_get_property(bk_node,
				"backlight-control", NULL);
		if (prop && strncmp(prop, type, strlen(type)) == 0)
		if (prop && strncmp(prop, type, strlen(type)) == 0) {
			of_node_put(bk_node);
			return 1;
		}
		of_node_put(bk_node);
	}

	return 0;
}
Loading