diff options
author | Liviu Dudau <Liviu.Dudau@arm.com> | 2014-09-29 10:29:24 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-09-30 15:29:09 -0400 |
commit | 83bbde1cc0ec9d156b9271e29ffe0dc89c687feb (patch) | |
tree | 379436a87c6b9188434ed5ab87d5d9b6c30ba684 | |
parent | dad13e3c08e7005854271e562eda4ffa5c71bc38 (diff) |
of/pci: Move of_pci_range_to_resource() to of/address.c
We need to enhance of_pci_range_to_resources() enough that it won't make
sense for it to be inline anymore. Move it to drivers/of/address.c, under
#ifdef CONFIG_PCI.
of_address.h previously implemented of_pci_range_to_resources()
unconditionally, regardless of any config options. The implementation in
address.c is defined only when CONFIG_OF_ADDRESS=y and CONFIG_PCI=y,
so add a dummy version to avoid build errors when CONFIG_OF or
CONFIG_OF_ADDRESS is not defined.
[bhelgaas: drop extra detail from changelog, move def under CONFIG_PCI,
add dummy of_pci_range_to_resource() for build errors (from Arnd)]
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Grant Likely <grant.likely@linaro.org>
CC: Rob Herring <robh+dt@kernel.org>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | drivers/of/address.c | 9 | ||||
-rw-r--r-- | include/linux/of_address.h | 20 |
2 files changed, 18 insertions, 11 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c index 758d4f04d4aa..327a57410797 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -295,6 +295,15 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, | |||
295 | } | 295 | } |
296 | EXPORT_SYMBOL_GPL(of_pci_range_parser_one); | 296 | EXPORT_SYMBOL_GPL(of_pci_range_parser_one); |
297 | 297 | ||
298 | void of_pci_range_to_resource(struct of_pci_range *range, | ||
299 | struct device_node *np, struct resource *res) | ||
300 | { | ||
301 | res->flags = range->flags; | ||
302 | res->start = range->cpu_addr; | ||
303 | res->end = range->cpu_addr + range->size - 1; | ||
304 | res->parent = res->child = res->sibling = NULL; | ||
305 | res->name = np->full_name; | ||
306 | } | ||
298 | #endif /* CONFIG_PCI */ | 307 | #endif /* CONFIG_PCI */ |
299 | 308 | ||
300 | /* | 309 | /* |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 497a04356ff8..a38e1c846c23 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h | |||
@@ -23,17 +23,6 @@ struct of_pci_range { | |||
23 | #define for_each_of_pci_range(parser, range) \ | 23 | #define for_each_of_pci_range(parser, range) \ |
24 | for (; of_pci_range_parser_one(parser, range);) | 24 | for (; of_pci_range_parser_one(parser, range);) |
25 | 25 | ||
26 | static inline void of_pci_range_to_resource(struct of_pci_range *range, | ||
27 | struct device_node *np, | ||
28 | struct resource *res) | ||
29 | { | ||
30 | res->flags = range->flags; | ||
31 | res->start = range->cpu_addr; | ||
32 | res->end = range->cpu_addr + range->size - 1; | ||
33 | res->parent = res->child = res->sibling = NULL; | ||
34 | res->name = np->full_name; | ||
35 | } | ||
36 | |||
37 | /* Translate a DMA address from device space to CPU space */ | 26 | /* Translate a DMA address from device space to CPU space */ |
38 | extern u64 of_translate_dma_address(struct device_node *dev, | 27 | extern u64 of_translate_dma_address(struct device_node *dev, |
39 | const __be32 *in_addr); | 28 | const __be32 *in_addr); |
@@ -145,6 +134,9 @@ extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, | |||
145 | u64 *size, unsigned int *flags); | 134 | u64 *size, unsigned int *flags); |
146 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | 135 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, |
147 | struct resource *r); | 136 | struct resource *r); |
137 | extern void of_pci_range_to_resource(struct of_pci_range *range, | ||
138 | struct device_node *np, | ||
139 | struct resource *res); | ||
148 | #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ | 140 | #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
149 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, | 141 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, |
150 | struct resource *r) | 142 | struct resource *r) |
@@ -157,6 +149,12 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev, | |||
157 | { | 149 | { |
158 | return NULL; | 150 | return NULL; |
159 | } | 151 | } |
152 | static inline void of_pci_range_to_resource(struct of_pci_range *range, | ||
153 | struct device_node *np, | ||
154 | struct resource *res) | ||
155 | { | ||
156 | return -ENOSYS; | ||
157 | } | ||
160 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ | 158 | #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */ |
161 | 159 | ||
162 | #endif /* __OF_ADDRESS_H */ | 160 | #endif /* __OF_ADDRESS_H */ |