Linux 3.7.4
[linux/fpc-iii.git] / arch / alpha / kernel / gct.c
blobc0c7155448e08805c44ead133e2c19e5e9c4ece8
1 /*
2 * linux/arch/alpha/kernel/gct.c
3 */
5 #include <linux/kernel.h>
6 #include <linux/types.h>
7 #include <linux/errno.h>
9 #include <asm/hwrpb.h>
10 #include <asm/gct.h>
12 int
13 gct6_find_nodes(gct6_node *node, gct6_search_struct *search)
15 gct6_search_struct *wanted;
16 int status = 0;
18 /* First check the magic number. */
19 if (node->magic != GCT_NODE_MAGIC) {
20 printk(KERN_ERR "GCT Node MAGIC incorrect - GCT invalid\n");
21 return -EINVAL;
24 /* Check against the search struct. */
25 for (wanted = search;
26 wanted && (wanted->type | wanted->subtype);
27 wanted++) {
28 if (node->type != wanted->type)
29 continue;
30 if (node->subtype != wanted->subtype)
31 continue;
33 /* Found it -- call out. */
34 if (wanted->callout)
35 wanted->callout(node);
38 /* Now walk the tree, siblings first. */
39 if (node->next)
40 status |= gct6_find_nodes(GCT_NODE_PTR(node->next), search);
42 /* Then the children. */
43 if (node->child)
44 status |= gct6_find_nodes(GCT_NODE_PTR(node->child), search);
46 return status;