diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index cb9c3dd9a23b82f72e08b25dafd20ccb21be9d5f..101fa098f62af7576f05b694a346e80349ae2c2d 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h @@ -20,11 +20,6 @@ #ifndef __ASSEMBLY__ #include <linux/types.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> -#include <linux/of_fdt.h> -#include <linux/proc_fs.h> -#include <linux/platform_device.h> #include <asm/irq.h> #include <asm/atomic.h> @@ -52,25 +47,9 @@ extern void pci_create_OF_bus_map(void); * OF address retreival & translation */ -/* Extract an address from a device, returns the region size and - * the address space flags too. The PCI version uses a BAR number - * instead of an absolute index - */ -extern const u32 *of_get_address(struct device_node *dev, int index, - u64 *size, unsigned int *flags); -extern const u32 *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); - #ifdef CONFIG_PCI extern unsigned long pci_address_to_pio(phys_addr_t address); -#else -static inline unsigned long pci_address_to_pio(phys_addr_t address) -{ - return (unsigned long)-1; -} +#define pci_address_to_pio pci_address_to_pio #endif /* CONFIG_PCI */ /* Parse the ibm,dma-window property of an OF node into the busno, phys and @@ -99,8 +78,18 @@ extern const void *of_get_mac_address(struct device_node *np); * resolving using the OF tree walking. */ struct pci_dev; +struct of_irq; extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ + +/* These includes are put at the bottom because they may contain things + * that are overridden by this file. Ideally they shouldn't be included + * by this file, but there are a bunch of .c files that currently depend + * on it. Eventually they will be cleaned up. */ +#include <linux/of_fdt.h> +#include <linux/of_irq.h> +#include <linux/platform_device.h> + #endif /* _ASM_MICROBLAZE_PROM_H */ diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index 55bccc0a21c3e357e37f31850173d6dfa9df700c..ae26f2efd089c80d92f0c9b50ea434dd43464f91 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h @@ -17,11 +17,6 @@ * 2 of the License, or (at your option) any later version. */ #include <linux/types.h> -#include <linux/of_fdt.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> -#include <linux/proc_fs.h> -#include <linux/platform_device.h> #include <asm/irq.h> #include <asm/atomic.h> @@ -49,41 +44,9 @@ extern void pci_create_OF_bus_map(void); extern u64 of_translate_dma_address(struct device_node *dev, const u32 *in_addr); -/* Extract an address from a device, returns the region size and - * the address space flags too. The PCI version uses a BAR number - * instead of an absolute index - */ -extern const u32 *of_get_address(struct device_node *dev, int index, - u64 *size, unsigned int *flags); -#ifdef CONFIG_PCI -extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, - 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 */ - -#ifdef CONFIG_PCI -extern int of_pci_address_to_resource(struct device_node *dev, int bar, - 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 */ - #ifdef CONFIG_PCI extern unsigned long pci_address_to_pio(phys_addr_t address); -#else -static inline unsigned long pci_address_to_pio(phys_addr_t address) -{ - return (unsigned long)-1; -} +#define pci_address_to_pio pci_address_to_pio #endif /* CONFIG_PCI */ /* Parse the ibm,dma-window property of an OF node into the busno, phys and @@ -122,9 +85,19 @@ static inline int of_node_to_nid(struct device_node *device) { return 0; } * resolving using the OF tree walking. */ struct pci_dev; +struct of_irq; extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); extern void of_instantiate_rtc(void); +/* These includes are put at the bottom because they may contain things + * that are overridden by this file. Ideally they shouldn't be included + * by this file, but there are a bunch of .c files that currently depend + * on it. Eventually they will be cleaned up. */ +#include <linux/of_fdt.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +#include <linux/platform_device.h> + #endif /* __KERNEL__ */ #endif /* _POWERPC_PROM_H */ diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 035ada5443ee4e17cc6c0fc3fd2165505820b43e..c1fd0f9658fd715536b3b2a7ce57ca34de67eee4 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c @@ -4,6 +4,7 @@ #include <linux/serial_core.h> #include <linux/console.h> #include <linux/pci.h> +#include <linux/of_address.h> #include <linux/of_device.h> #include <asm/io.h> #include <asm/mmu.h> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 5b38f6ae2b299695139c25a21cff0b73f8857808..9021c4ad4bbd3ebdcda00af9de8bf59e6bfacc83 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -21,6 +21,7 @@ #include <linux/string.h> #include <linux/init.h> #include <linux/bootmem.h> +#include <linux/of_address.h> #include <linux/mm.h> #include <linux/list.h> #include <linux/syscalls.h> diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index 6d584f4e3c9a1032b98e22e8f96cb91900158edf..de55bc0584b5d6cadaa24572db3302dbd0ea19ea 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c @@ -18,6 +18,7 @@ #include <linux/init.h> #include <linux/pci.h> #include <linux/of.h> +#include <linux/of_address.h> #include <linux/root_dev.h> #include <linux/initrd.h> #include <asm/time.h> diff --git a/arch/powerpc/platforms/amigaone/setup.c b/arch/powerpc/platforms/amigaone/setup.c index fb4eb0df054c0a701fe74df78990d40bd480e2df..03aabc0e16ac2f212ec6d5ae6a78909333e606c6 100644 --- a/arch/powerpc/platforms/amigaone/setup.c +++ b/arch/powerpc/platforms/amigaone/setup.c @@ -13,12 +13,13 @@ */ #include <linux/kernel.h> +#include <linux/of.h> +#include <linux/of_address.h> #include <linux/seq_file.h> #include <generated/utsrelease.h> #include <asm/machdep.h> #include <asm/cputable.h> -#include <asm/prom.h> #include <asm/pci-bridge.h> #include <asm/i8259.h> #include <asm/time.h> diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c index d2c1d497846e75f46f612d9c85043a56cadcbaa9..33e5fc7334fc508be63b52ce6cae473f24726a6c 100644 --- a/arch/powerpc/platforms/iseries/mf.c +++ b/arch/powerpc/platforms/iseries/mf.c @@ -30,6 +30,7 @@ #include <linux/init.h> #include <linux/completion.h> #include <linux/delay.h> +#include <linux/proc_fs.h> #include <linux/dma-mapping.h> #include <linux/bcd.h> #include <linux/rtc.h> diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index 9e1b9fd7520614d3c3840fe839a7611c5824408e..75eec031e7a209593a29f67b3e6614196f8cd1aa 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c @@ -21,6 +21,8 @@ #include <linux/delay.h> #include <linux/kernel.h> #include <linux/sched.h> +#include <linux/of.h> +#include <linux/of_address.h> #include <linux/spinlock.h> #include <linux/adb.h> #include <linux/pmu.h> diff --git a/arch/powerpc/sysdev/bestcomm/sram.c b/arch/powerpc/sysdev/bestcomm/sram.c index 5d74ef7a651f6e6f4fb38837fe914bcbe4c0297c..1225012a681a01de66f5b80bdaf117451f2052d2 100644 --- a/arch/powerpc/sysdev/bestcomm/sram.c +++ b/arch/powerpc/sysdev/bestcomm/sram.c @@ -11,6 +11,7 @@ * kind, whether express or implied. */ +#include <linux/err.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c index eca4545dd52ee0619b0bb0ad2b86597a5737d736..7dd2885321ad112cf88592e299d77ac4b2359d9b 100644 --- a/arch/powerpc/sysdev/fsl_gtm.c +++ b/arch/powerpc/sysdev/fsl_gtm.c @@ -14,6 +14,7 @@ */ #include <linux/kernel.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/list.h> #include <linux/io.h> diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c index 89d871ef8c2f814dbaecc390bd47fa34ad14574c..91917133ae0ad7de08d58a9379e943c9ecef2988 100644 --- a/drivers/char/bsr.c +++ b/drivers/char/bsr.c @@ -23,6 +23,7 @@ #include <linux/of.h> #include <linux/of_device.h> #include <linux/of_platform.h> +#include <linux/fs.h> #include <linux/module.h> #include <linux/cdev.h> #include <linux/list.h> diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c index b4c41d72c423ef79e004bd901f23ef03f96e311f..f53f850b641888acb1080d6f08402caf2094eccb 100644 --- a/drivers/net/fsl_pq_mdio.c +++ b/drivers/net/fsl_pq_mdio.c @@ -35,6 +35,7 @@ #include <linux/mii.h> #include <linux/phy.h> #include <linux/of.h> +#include <linux/of_address.h> #include <linux/of_mdio.h> #include <linux/of_platform.h> diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index d04c5b262050a9aefef0f48cde2bfa2f700510a7..b2c2f391b29db5e025e94381e8d5f97438ff1fc8 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -20,7 +20,7 @@ #include <linux/skbuff.h> #include <linux/io.h> #include <linux/slab.h> - +#include <linux/of_address.h> #include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/of_mdio.h> diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c index 8acccd564378aaa405f2fb04cf1958b532499993..caf085d3a76abdc18c8e2cca06e7304a503342d4 100644 --- a/drivers/serial/uartlite.c +++ b/drivers/serial/uartlite.c @@ -21,6 +21,7 @@ #include <asm/io.h> #if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE)) #include <linux/of.h> +#include <linux/of_address.h> #include <linux/of_device.h> #include <linux/of_platform.h> diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/mpc512x_psc_spi.c index 1bb4315f5f84d2d0e2ba0ac6151040824a049f8f..10baac3f8ea53d1ed3a8cafe6b9d90dd561eb771 100644 --- a/drivers/spi/mpc512x_psc_spi.c +++ b/drivers/spi/mpc512x_psc_spi.c @@ -19,6 +19,7 @@ #include <linux/init.h> #include <linux/errno.h> #include <linux/interrupt.h> +#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/workqueue.h> #include <linux/completion.h> diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index bd81ff90cfb3acc44a96c15e4e8e4f2930d568a7..66d170147dccabc9cbb22d5c8e1d50af39225415 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c @@ -16,6 +16,7 @@ #include <linux/types.h> #include <linux/errno.h> #include <linux/interrupt.h> +#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/workqueue.h> #include <linux/completion.h> diff --git a/drivers/spi/xilinx_spi_of.c b/drivers/spi/xilinx_spi_of.c index 87cda0956a83f5ccaea7ada8bff1cc2ac15c9cff..f53d3f6b9f611671ccc31d6bf5afb847882a9153 100644 --- a/drivers/spi/xilinx_spi_of.c +++ b/drivers/spi/xilinx_spi_of.c @@ -29,6 +29,7 @@ #include <linux/io.h> #include <linux/slab.h> +#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/of_device.h> #include <linux/of_spi.h> diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index 82506ca297d5f1632312f8d52b7f80b7aab49637..9648b75f0283e31d9b1c02c618b979fe3472ee41 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c @@ -32,6 +32,7 @@ #include <linux/interrupt.h> #include <linux/io.h> #include <linux/moduleparam.h> +#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/dma-mapping.h> #include <linux/usb/ch9.h> diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 49fcbe8f18ac4dbbd958f5e1973be85dda2875ae..c225dcce89e78f083f0e02c60b3064b29d001748 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c @@ -40,6 +40,8 @@ #include <linux/vmalloc.h> #include <linux/delay.h> #include <linux/interrupt.h> +#include <linux/of.h> +#include <linux/of_address.h> #include <linux/fb.h> #include <linux/init.h> #include <linux/pci.h> diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 46dda7d8aaeefae0d3a4b3a850ee6799e080a44d..cb163a5397beab1a592b836db2c273db3266351c 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c @@ -19,13 +19,14 @@ #include <linux/mm.h> #include <linux/vmalloc.h> #include <linux/delay.h> +#include <linux/of.h> +#include <linux/of_address.h> #include <linux/interrupt.h> #include <linux/fb.h> #include <linux/init.h> #include <linux/ioport.h> #include <linux/pci.h> #include <asm/io.h> -#include <asm/prom.h> #ifdef CONFIG_PPC64 #include <asm/pci-bridge.h> diff --git a/include/linux/of_address.h b/include/linux/of_address.h index cc567df9a00d7b397fa3d51e422a533962ce4c9e..8aea06f0564ca9843b05812d2d21b23712b9c30c 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -8,5 +8,37 @@ extern int of_address_to_resource(struct device_node *dev, int index, struct resource *r); extern void __iomem *of_iomap(struct device_node *device, int index); +/* Extract an address from a device, returns the region size and + * the address space flags too. The PCI version uses a BAR number + * instead of an absolute index + */ +extern const u32 *of_get_address(struct device_node *dev, int index, + u64 *size, unsigned int *flags); + +#ifndef pci_address_to_pio +static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } +#define pci_address_to_pio pci_address_to_pio +#endif + +#ifdef CONFIG_PCI +extern const u32 *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); +#else /* CONFIG_PCI */ +static inline int of_pci_address_to_resource(struct device_node *dev, int bar, + struct resource *r) +{ + return -ENOSYS; +} + +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 */ + + #endif /* __OF_ADDRESS_H */