powerpc: Implement OF PCI address accessors stubs for CONFIG_PCI=n

To avoid "#ifdef CONFIG_PCI" in the drivers we should provide stubs in
place of OF PCI address accessors.

Without these stubs build breaks for drivers not strictly requiring PCI,
for example CONFIG_FB_OF=y without CONFIG_PCI:

  LD      .tmp_vmlinux1
drivers/built-in.o: In function `offb_map_reg':
offb.c:(.text+0x6e7c): undefined reference to `of_get_pci_address'

OF PCI IRQ accessors require pci_dev argument, so drivers using PCI
IRQs should depend on CONFIG_PCI anyway.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Anton Vorontsov 2008-06-11 08:31:00 +10:00 committed by Paul Mackerras
parent 9a24729d8a
commit ff1f4ee94c
1 changed files with 16 additions and 0 deletions

View File

@ -212,8 +212,16 @@ extern u64 of_translate_dma_address(struct device_node *dev,
*/ */
extern const u32 *of_get_address(struct device_node *dev, int index, extern const u32 *of_get_address(struct device_node *dev, int index,
u64 *size, unsigned int *flags); u64 *size, unsigned int *flags);
#ifdef CONFIG_PCI
extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
u64 *size, unsigned int *flags); u64 *size, unsigned int *flags);
#else
static inline const u32 *of_get_pci_address(struct device_node *dev,
int bar_no, u64 *size, unsigned int *flags)
{
return NULL;
}
#endif /* CONFIG_PCI */
/* Get an address as a resource. Note that if your address is /* Get an address as a resource. Note that if your address is
* a PIO address, the conversion will fail if the physical address * a PIO address, the conversion will fail if the physical address
@ -223,8 +231,16 @@ extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
*/ */
extern int of_address_to_resource(struct device_node *dev, int index, extern int of_address_to_resource(struct device_node *dev, int index,
struct resource *r); struct resource *r);
#ifdef CONFIG_PCI
extern int of_pci_address_to_resource(struct device_node *dev, int bar, extern int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r); struct resource *r);
#else
static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r)
{
return -ENOSYS;
}
#endif /* CONFIG_PCI */
/* Parse the ibm,dma-window property of an OF node into the busno, phys and /* Parse the ibm,dma-window property of an OF node into the busno, phys and
* size parameters. * size parameters.