diff options
author | Rob Herring <robh@kernel.org> | 2023-03-28 15:15:57 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2023-04-13 17:46:35 -0500 |
commit | c75a79491835c50ca61938ae1ebd3ba5598f7410 (patch) | |
tree | a87517b093f73b412725b461af721e76d58946e8 /include/linux/of_address.h | |
parent | 6d32dadb11a6480be62c6ada901bbdcbda1775c9 (diff) |
of/address: Add of_range_to_resource() helper
A few users need to convert a specific "ranges" entry into a struct
resource. Add a helper to similar to of_address_to_resource(). The
existing of_pci_range_to_resource() helper isn't really PCI specific,
so it can be used with the CONFIG_PCI check dropped.
Link: https://lore.kernel.org/r/20230328-dt-address-helpers-v1-2-e2456c3e77ab@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include/linux/of_address.h')
-rw-r--r-- | include/linux/of_address.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 376671594746..1d005439f026 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -68,6 +68,8 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar, extern int of_pci_range_to_resource(struct of_pci_range *range, struct device_node *np, struct resource *res); +extern int of_range_to_resource(struct device_node *np, int index, + 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, @@ -120,6 +122,12 @@ static inline int of_pci_range_to_resource(struct of_pci_range *range, return -ENOSYS; } +static inline int of_range_to_resource(struct device_node *np, int index, + struct resource *res) +{ + return -ENOSYS; +} + static inline bool of_dma_is_coherent(struct device_node *np) { return false; |