Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

of/address: add empty static inlines for !CONFIG_OF

As the title says, this patch adds empty implementations for the address
translation functions so that they can be used when CONFIG_OF is disabled.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>

+29 -4
+29 -4
include/linux/of_address.h
··· 4 4 #include <linux/errno.h> 5 5 #include <linux/of.h> 6 6 7 + #ifdef CONFIG_OF_ADDRESS 7 8 extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 8 9 extern int of_address_to_resource(struct device_node *dev, int index, 9 10 struct resource *r); ··· 26 25 #define pci_address_to_pio pci_address_to_pio 27 26 #endif 28 27 29 - #ifdef CONFIG_PCI 28 + #else /* CONFIG_OF_ADDRESS */ 29 + static inline int of_address_to_resource(struct device_node *dev, int index, 30 + struct resource *r) 31 + { 32 + return -EINVAL; 33 + } 34 + static inline struct device_node *of_find_matching_node_by_address( 35 + struct device_node *from, 36 + const struct of_device_id *matches, 37 + u64 base_address) 38 + { 39 + return NULL; 40 + } 41 + static inline void __iomem *of_iomap(struct device_node *device, int index) 42 + { 43 + return NULL; 44 + } 45 + static inline const u32 *of_get_address(struct device_node *dev, int index, 46 + u64 *size, unsigned int *flags) 47 + { 48 + return NULL; 49 + } 50 + #endif /* CONFIG_OF_ADDRESS */ 51 + 52 + 53 + #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) 30 54 extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, 31 55 u64 *size, unsigned int *flags); 32 56 extern int of_pci_address_to_resource(struct device_node *dev, int bar, 33 57 struct resource *r); 34 - #else /* CONFIG_PCI */ 58 + #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 35 59 static inline int of_pci_address_to_resource(struct device_node *dev, int bar, 36 60 struct resource *r) 37 61 { ··· 68 42 { 69 43 return NULL; 70 44 } 71 - #endif /* CONFIG_PCI */ 72 - 45 + #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ 73 46 74 47 #endif /* __OF_ADDRESS_H */ 75 48