diff options
author | Rob Herring <robh@kernel.org> | 2021-05-27 14:45:46 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2021-06-02 20:59:29 -0500 |
commit | c3c0dc75774b488770f33598109161040d291367 (patch) | |
tree | 448ec0f71854c5150b658ba87b06935ff5c762e2 /include/linux/of_address.h | |
parent | 050a2c62dfc7d9ef457405f6ab4b715e9a2e32d7 (diff) |
of: address: Use IS_ENABLED() for !CONFIG_PCI
Convert address.c to use IS_ENABLED() instead of ifdefs for the
public PCI functions. This simplifies the ifdefs in of_address.h.
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210527194547.1287934-4-robh@kernel.org
Diffstat (limited to 'include/linux/of_address.h')
-rw-r--r-- | include/linux/of_address.h | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index b72807faf037..45598dbec269 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -61,6 +61,11 @@ extern int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, extern struct of_pci_range *of_pci_range_parser_one( struct of_pci_range_parser *parser, struct of_pci_range *range); +extern int of_pci_address_to_resource(struct device_node *dev, int bar, + struct resource *r); +extern int of_pci_range_to_resource(struct of_pci_range *range, + struct device_node *np, + struct resource *res); extern bool of_dma_is_coherent(struct device_node *np); #else /* CONFIG_OF_ADDRESS */ static inline void __iomem *of_io_request_and_map(struct device_node *device, @@ -100,6 +105,19 @@ static inline struct of_pci_range *of_pci_range_parser_one( return NULL; } +static inline int of_pci_address_to_resource(struct device_node *dev, int bar, + struct resource *r) +{ + return -ENOSYS; +} + +static inline int of_pci_range_to_resource(struct of_pci_range *range, + struct device_node *np, + struct resource *res) +{ + return -ENOSYS; +} + static inline bool of_dma_is_coherent(struct device_node *np) { return false; @@ -124,27 +142,6 @@ static inline void __iomem *of_iomap(struct device_node *device, int index) #endif #define of_range_parser_init of_pci_range_parser_init -#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) -extern int of_pci_address_to_resource(struct device_node *dev, int bar, - struct resource *r); -extern int of_pci_range_to_resource(struct of_pci_range *range, - struct device_node *np, - struct resource *res); -#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ -static inline int of_pci_address_to_resource(struct device_node *dev, int bar, - struct resource *r) -{ - return -ENOSYS; -} - -static inline int of_pci_range_to_resource(struct of_pci_range *range, - struct device_node *np, - struct resource *res) -{ - return -ENOSYS; -} -#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ - static inline const __be32 *of_get_address(struct device_node *dev, int index, u64 *size, unsigned int *flags) { |