Root/
1 | #include <linux/kernel.h> |
2 | #include <linux/export.h> |
3 | #include <linux/of.h> |
4 | #include <linux/of_pci.h> |
5 | #include <asm/prom.h> |
6 | |
7 | static inline int __of_pci_pci_compare(struct device_node *node, |
8 | unsigned int devfn) |
9 | { |
10 | unsigned int size; |
11 | const __be32 *reg = of_get_property(node, "reg", &size); |
12 | |
13 | if (!reg || size < 5 * sizeof(__be32)) |
14 | return 0; |
15 | return ((be32_to_cpup(®[0]) >> 8) & 0xff) == devfn; |
16 | } |
17 | |
18 | struct device_node *of_pci_find_child_device(struct device_node *parent, |
19 | unsigned int devfn) |
20 | { |
21 | struct device_node *node, *node2; |
22 | |
23 | for_each_child_of_node(parent, node) { |
24 | if (__of_pci_pci_compare(node, devfn)) |
25 | return node; |
26 | /* |
27 | * Some OFs create a parent node "multifunc-device" as |
28 | * a fake root for all functions of a multi-function |
29 | * device we go down them as well. |
30 | */ |
31 | if (!strcmp(node->name, "multifunc-device")) { |
32 | for_each_child_of_node(node, node2) { |
33 | if (__of_pci_pci_compare(node2, devfn)) { |
34 | of_node_put(node); |
35 | return node2; |
36 | } |
37 | } |
38 | } |
39 | } |
40 | return NULL; |
41 | } |
42 | EXPORT_SYMBOL_GPL(of_pci_find_child_device); |
43 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9