Skip to content

Commit 83bbde1

Browse files
dliviubjorn-helgaas
authored andcommitted
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>
1 parent dad13e3 commit 83bbde1

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎drivers/of/address.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
295295
}
296296
EXPORT_SYMBOL_GPL(of_pci_range_parser_one);
297297

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+
}
298307
#endif /* CONFIG_PCI */
299308

300309
/*

‎include/linux/of_address.h‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ struct of_pci_range {
2323
#define for_each_of_pci_range(parser, range) \
2424
for (; of_pci_range_parser_one(parser, range);)
2525

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-
3726
/* Translate a DMA address from device space to CPU space */
3827
extern u64 of_translate_dma_address(struct device_node *dev,
3928
const __be32 *in_addr);
@@ -145,6 +134,9 @@ extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
145134
u64 *size, unsigned int *flags);
146135
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
147136
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);
148140
#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
149141
static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
150142
struct resource *r)
@@ -157,6 +149,12 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
157149
{
158150
return NULL;
159151
}
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+
}
160158
#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
161159

162160
#endif /* __OF_ADDRESS_H */

0 commit comments

Comments
 (0)