xref: /openbmc/linux/include/linux/of_pci.h (revision bbd8810d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __OF_PCI_H
3 #define __OF_PCI_H
4 
5 #include <linux/types.h>
6 #include <linux/errno.h>
7 
8 struct pci_dev;
9 struct device_node;
10 
11 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI)
12 struct device_node *of_pci_find_child_device(struct device_node *parent,
13 					     unsigned int devfn);
14 int of_pci_get_devfn(struct device_node *np);
15 void of_pci_check_probe_only(void);
16 #else
of_pci_find_child_device(struct device_node * parent,unsigned int devfn)17 static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
18 					     unsigned int devfn)
19 {
20 	return NULL;
21 }
22 
of_pci_get_devfn(struct device_node * np)23 static inline int of_pci_get_devfn(struct device_node *np)
24 {
25 	return -EINVAL;
26 }
27 
of_pci_check_probe_only(void)28 static inline void of_pci_check_probe_only(void) { }
29 #endif
30 
31 #if IS_ENABLED(CONFIG_OF_IRQ)
32 int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
33 #else
34 static inline int
of_irq_parse_and_map_pci(const struct pci_dev * dev,u8 slot,u8 pin)35 of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
36 {
37 	return 0;
38 }
39 #endif
40 
41 #endif
42