diff options
author | Rob Herring <robh@kernel.org> | 2021-05-27 22:45:45 +0300 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2021-06-03 04:59:28 +0300 |
commit | 050a2c62dfc7d9ef457405f6ab4b715e9a2e32d7 (patch) | |
tree | 6616469201bc92d81706a757a1f4fe22b43ddc62 /include/linux/of_address.h | |
parent | 00dcc7cf1a49f93efaa281cc85c88005995ecf63 (diff) | |
download | linux-050a2c62dfc7d9ef457405f6ab4b715e9a2e32d7.tar.xz |
of: Merge of_get_address() and of_get_pci_address() implementations
of_get_address() and of_get_pci_address() are the same implementation
except of_get_pci_address() takes the PCI BAR number rather than an
index. Modify the of_get_address() implementation to work on either
index or BAR and provide wrapper functions for the existing functions.
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210527194547.1287934-3-robh@kernel.org
Diffstat (limited to 'include/linux/of_address.h')
-rw-r--r-- | include/linux/of_address.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 88bc943405cd..b72807faf037 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -51,8 +51,8 @@ void __iomem *of_io_request_and_map(struct device_node *device, * the address space flags too. The PCI version uses a BAR number * instead of an absolute index */ -extern const __be32 *of_get_address(struct device_node *dev, int index, - u64 *size, unsigned int *flags); +extern const __be32 *__of_get_address(struct device_node *dev, int index, int bar_no, + u64 *size, unsigned int *flags); extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, struct device_node *node); @@ -75,8 +75,8 @@ static inline u64 of_translate_address(struct device_node *np, return OF_BAD_ADDR; } -static inline const __be32 *of_get_address(struct device_node *dev, int index, - u64 *size, unsigned int *flags) +static inline const __be32 *__of_get_address(struct device_node *dev, int index, int bar_no, + u64 *size, unsigned int *flags) { return NULL; } @@ -125,8 +125,6 @@ static inline void __iomem *of_iomap(struct device_node *device, int index) #define of_range_parser_init of_pci_range_parser_init #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) -extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, - u64 *size, unsigned int *flags); 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, @@ -139,11 +137,6 @@ static inline int of_pci_address_to_resource(struct device_node *dev, int bar, return -ENOSYS; } -static inline const __be32 *of_get_pci_address(struct device_node *dev, - int bar_no, u64 *size, unsigned int *flags) -{ - return NULL; -} static inline int of_pci_range_to_resource(struct of_pci_range *range, struct device_node *np, struct resource *res) @@ -152,4 +145,16 @@ static inline int of_pci_range_to_resource(struct of_pci_range *range, } #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ +static inline const __be32 *of_get_address(struct device_node *dev, int index, + u64 *size, unsigned int *flags) +{ + return __of_get_address(dev, index, -1, size, flags); +} + +static inline const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, + u64 *size, unsigned int *flags) +{ + return __of_get_address(dev, -1, bar_no, size, flags); +} + #endif /* __OF_ADDRESS_H */ |