aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of_address.h
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2021-05-27 14:45:45 -0500
committerRob Herring <robh@kernel.org>2021-06-02 20:59:28 -0500
commit050a2c62dfc7d9ef457405f6ab4b715e9a2e32d7 (patch)
tree6616469201bc92d81706a757a1f4fe22b43ddc62 /include/linux/of_address.h
parentPCI: Add empty stub for pci_register_io_range() (diff)
downloadlinux-dev-050a2c62dfc7d9ef457405f6ab4b715e9a2e32d7.tar.xz
linux-dev-050a2c62dfc7d9ef457405f6ab4b715e9a2e32d7.zip
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.h27
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 */