Skip to content

Commit 64099d9

Browse files
committed
pci/of: Consolidate pci_device_to_OF_node()
All archs do more or less the same thing now, move it into a single generic place. I chose pci.h rather than of_pci.h to avoid having to change all call-sites to include the later. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michal Simek <monstr@monstr.eu> Acked-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
1 parent 3d5fe5a commit 64099d9

8 files changed

Lines changed: 5 additions & 35 deletions

File tree

‎arch/microblaze/include/asm/pci-bridge.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ struct pci_controller {
102102
};
103103

104104
#ifdef CONFIG_PCI
105-
static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
106-
{
107-
return dev->dev.of_node;
108-
}
109-
110105
static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
111106
{
112107
return bus->dev.of_node;

‎arch/powerpc/include/asm/pci-bridge.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,6 @@ static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
169169
return bus->sysdata;
170170
}
171171

172-
static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
173-
{
174-
return dev->dev.of_node;
175-
}
176-
177172
static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
178173
{
179174
return bus->dev.of_node;

‎arch/sparc/include/asm/pci_32.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
4242
}
4343
#endif
4444

45-
struct device_node;
46-
extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);
47-
4845
#endif /* __KERNEL__ */
4946

5047
/* generic pci stuff */

‎arch/sparc/include/asm/pci_64.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
9191
return PCI_IRQ_NONE;
9292
}
9393

94-
struct device_node;
95-
extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);
96-
9794
#define HAVE_ARCH_PCI_RESOURCE_TO_USER
9895
extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
9996
const struct resource *rsrc,

‎arch/sparc/kernel/pci.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,12 +1021,6 @@ void arch_teardown_msi_irq(unsigned int irq)
10211021
}
10221022
#endif /* !(CONFIG_PCI_MSI) */
10231023

1024-
struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
1025-
{
1026-
return pdev->dev.of_node;
1027-
}
1028-
EXPORT_SYMBOL(pci_device_to_OF_node);
1029-
10301024
static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit)
10311025
{
10321026
struct pci_dev *ali_isa_bridge;

‎arch/sparc/kernel/pcic.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -885,14 +885,6 @@ int pcibios_assign_resource(struct pci_dev *pdev, int resource)
885885
return -ENXIO;
886886
}
887887

888-
struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
889-
{
890-
struct pcidev_cookie *pc = pdev->sysdata;
891-
892-
return pc->prom_node;
893-
}
894-
EXPORT_SYMBOL(pci_device_to_OF_node);
895-
896888
/*
897889
* This probably belongs here rather than ioport.c because
898890
* we do not want this crud linked into SBus kernels.

‎arch/x86/include/asm/prom.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ extern void x86_add_irq_domains(void);
3131
void __cpuinit x86_of_pci_init(void);
3232
void x86_dtb_init(void);
3333

34-
static inline struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
35-
{
36-
return pdev ? pdev->dev.of_node : NULL;
37-
}
38-
3934
static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
4035
{
4136
return pci_device_to_OF_node(bus->self);

‎include/linux/pci.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,11 @@ extern void pci_release_bus_of_node(struct pci_bus *bus);
16001600
/* Arch may override this (weak) */
16011601
extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus);
16021602

1603+
static inline struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
1604+
{
1605+
return pdev ? pdev->dev.of_node : NULL;
1606+
}
1607+
16031608
#else /* CONFIG_OF */
16041609
static inline void pci_set_of_node(struct pci_dev *dev) { }
16051610
static inline void pci_release_of_node(struct pci_dev *dev) { }

0 commit comments

Comments
 (0)