ed9777683a1c25e49b22e41d741c219782e4bebe
[openwrt/staging/yousong.git] / target / linux / generic / patches-3.8 / 031-PCI-Remove-__weak-annotation-from-pcibios_get_phb_of.patch
1 From 10629d711ed780470937ecda50d9ffa0e925a4ee Mon Sep 17 00:00:00 2001
2 From: Bjorn Helgaas <bhelgaas@google.com>
3 Date: Wed, 10 Apr 2013 09:56:54 -0600
4 Subject: [PATCH 1/2] PCI: Remove __weak annotation from
5 pcibios_get_phb_of_node decl
6
7 The __weak annotation on the pcibios_get_phb_of_node() declaration
8 causes *every* definition to be marked "weak." The linker then
9 selects one based on link order, which may be the wrong one.
10
11 Gabor found that on MIPS, the linker selected the generic implementation
12 from drivers/pci even though arch/mips supplied a definition without the
13 __weak annotation:
14
15 $ mipsel-openwrt-linux-readelf -s arch/mips/pci/built-in.o \
16 drivers/pci/built-in.o vmlinux.o | grep pcibios_get_phb_of_node
17 86: 0000046c 12 FUNC WEAK DEFAULT 2 pcibios_get_phb_of_node
18 1430: 00012e2c 104 FUNC WEAK DEFAULT 2 pcibios_get_phb_of_node
19 31898: 0017e4ec 104 FUNC WEAK DEFAULT 2 pcibios_get_phb_of_node
20
21 This removes the __weak annotation from the pcibios_get_phb_of_node()
22 declaration so arch-specific non-weak implementations work reliably.
23
24 Suggested-by: Gabor Juhos <juhosg@openwrt.org>
25 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
26 ---
27 include/linux/pci.h | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
29
30 --- a/include/linux/pci.h
31 +++ b/include/linux/pci.h
32 @@ -1803,7 +1803,7 @@ extern void pci_set_bus_of_node(struct p
33 extern void pci_release_bus_of_node(struct pci_bus *bus);
34
35 /* Arch may override this (weak) */
36 -extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus);
37 +extern struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);
38
39 static inline struct device_node *
40 pci_device_to_OF_node(const struct pci_dev *pdev)