]> git.karo-electronics.de Git - linux-beck.git/commitdiff
of/pci: Move of_pci_range_to_resource() to of/address.c
authorLiviu Dudau <Liviu.Dudau@arm.com>
Mon, 29 Sep 2014 14:29:24 +0000 (15:29 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 30 Sep 2014 19:29:09 +0000 (13:29 -0600)
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>
drivers/of/address.c
include/linux/of_address.h

index 758d4f04d4aadd1af51452eb4047d75035ce259c..327a5741079743fd31f79a53d039b838cec13780 100644 (file)
@@ -295,6 +295,15 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
 }
 EXPORT_SYMBOL_GPL(of_pci_range_parser_one);
 
+void of_pci_range_to_resource(struct of_pci_range *range,
+                             struct device_node *np, struct resource *res)
+{
+       res->flags = range->flags;
+       res->start = range->cpu_addr;
+       res->end = range->cpu_addr + range->size - 1;
+       res->parent = res->child = res->sibling = NULL;
+       res->name = np->full_name;
+}
 #endif /* CONFIG_PCI */
 
 /*
index 497a04356ff8df334a6c1b302bfb5dd6a710e031..a38e1c846c234076943de20a196583eeeacaa8f6 100644 (file)
@@ -23,17 +23,6 @@ struct of_pci_range {
 #define for_each_of_pci_range(parser, range) \
        for (; of_pci_range_parser_one(parser, range);)
 
-static inline void of_pci_range_to_resource(struct of_pci_range *range,
-                                           struct device_node *np,
-                                           struct resource *res)
-{
-       res->flags = range->flags;
-       res->start = range->cpu_addr;
-       res->end = range->cpu_addr + range->size - 1;
-       res->parent = res->child = res->sibling = NULL;
-       res->name = np->full_name;
-}
-
 /* Translate a DMA address from device space to CPU space */
 extern u64 of_translate_dma_address(struct device_node *dev,
                                    const __be32 *in_addr);
@@ -145,6 +134,9 @@ 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 void of_pci_range_to_resource(struct of_pci_range *range,
+                                    struct device_node *np,
+                                    struct resource *res);
 #else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
 static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
                                             struct resource *r)
@@ -157,6 +149,12 @@ static inline const __be32 *of_get_pci_address(struct device_node *dev,
 {
        return NULL;
 }
+static inline void of_pci_range_to_resource(struct of_pci_range *range,
+                                           struct device_node *np,
+                                           struct resource *res)
+{
+       return -ENOSYS;
+}
 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
 
 #endif /* __OF_ADDRESS_H */