USB: xHCI: prevent infinite loop when processing MSE event
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / powerpc / platforms / wsp / setup.c
blob11ac2f05e01c72a1d9c8874a8020f7eb0947aedc
1 /*
2 * Copyright 2010 Michael Ellerman, IBM Corporation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
10 #include <linux/kernel.h>
11 #include <linux/of_platform.h>
13 #include "wsp.h"
16 * Find chip-id by walking up device tree looking for ibm,wsp-chip-id property.
17 * Won't work for nodes that are not a descendant of a wsp node.
19 int wsp_get_chip_id(struct device_node *dn)
21 const u32 *p;
22 int rc;
24 /* Start looking at the specified node, not its parent */
25 dn = of_node_get(dn);
26 while (dn && !(p = of_get_property(dn, "ibm,wsp-chip-id", NULL)))
27 dn = of_get_next_parent(dn);
29 if (!dn)
30 return -1;
32 rc = *p;
33 of_node_put(dn);
35 return rc;