diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 15:57:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 15:57:35 -0700 |
commit | 03c0c29aff7e56b722eb6c47eace222b140d0377 (patch) | |
tree | 47267a19b523159cf36a050ef3c35f4dbdb33016 /arch/sparc | |
parent | c60c6a96b7bb0f1f8bb635fdfcf5b592aaf062b4 (diff) | |
parent | 7fb8f881c54beb05dd4d2c947dada1c636581d87 (diff) | |
download | linux-03c0c29aff7e56b722eb6c47eace222b140d0377.tar.gz linux-03c0c29aff7e56b722eb6c47eace222b140d0377.tar.bz2 linux-03c0c29aff7e56b722eb6c47eace222b140d0377.zip |
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (63 commits)
of/platform: Register of_platform_drivers with an "of:" prefix
of/address: Clean up function declarations
of/spi: call of_register_spi_devices() from spi core code
of: Provide default of_node_to_nid() implementation.
of/device: Make of_device_make_bus_id() usable by other code.
of/irq: Fix endian issues in parsing interrupt specifiers
of: Fix phandle endian issues
of/flattree: fix of_flat_dt_is_compatible() to match the full compatible string
of: remove of_default_bus_ids
of: make of_find_device_by_node generic
microblaze: remove references to of_device and to_of_device
sparc: remove references to of_device and to_of_device
powerpc: remove references to of_device and to_of_device
of/device: Replace of_device with platform_device in includes and core code
of/device: Protect against binding of_platform_drivers to non-OF devices
of: remove asm/of_device.h
of: remove asm/of_platform.h
of/platform: remove all of_bus_type and of_platform_bus_type references
of: Merge of_platform_bus_type with platform_bus_type
drivercore/of: Add OF style matching to platform bus
...
Fix up trivial conflicts in arch/microblaze/kernel/Makefile due to just
some obj-y removals by the devicetree branch, while the microblaze
updates added a new file.
Diffstat (limited to 'arch/sparc')
35 files changed, 172 insertions, 283 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index c0015db247ba..ba068c833e5d 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -18,6 +18,7 @@ config 64BIT config SPARC bool default y + select OF select HAVE_IDE select HAVE_OPROFILE select HAVE_ARCH_KGDB if !SMP || SPARC64 @@ -148,9 +149,6 @@ config GENERIC_GPIO config ARCH_NO_VIRT_TO_BUS def_bool y -config OF - def_bool y - config ARCH_SUPPORTS_DEBUG_PAGEALLOC def_bool y if SPARC64 diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h index d4c452147412..daa6a8a5e9cd 100644 --- a/arch/sparc/include/asm/device.h +++ b/arch/sparc/include/asm/device.h @@ -6,18 +6,25 @@ #ifndef _ASM_SPARC_DEVICE_H #define _ASM_SPARC_DEVICE_H +#include <asm/openprom.h> + struct device_node; -struct of_device; +struct platform_device; struct dev_archdata { void *iommu; void *stc; void *host_controller; - struct of_device *op; + struct platform_device *op; int numa_node; }; +extern void of_propagate_archdata(struct platform_device *bus); + struct pdev_archdata { + struct resource resource[PROMREG_MAX]; + unsigned int irqs[PROMINTR_MAX]; + int num_irqs; }; #endif /* _ASM_SPARC_DEVICE_H */ diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h index 8fac3ab22f36..6597ce874d78 100644 --- a/arch/sparc/include/asm/floppy_64.h +++ b/arch/sparc/include/asm/floppy_64.h @@ -43,7 +43,7 @@ struct sun_flpy_controller { /* You'll only ever find one controller on an Ultra anyways. */ static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1; unsigned long fdc_status; -static struct of_device *floppy_op = NULL; +static struct platform_device *floppy_op = NULL; struct sun_floppy_ops { unsigned char (*fd_inb) (unsigned long port); @@ -548,7 +548,7 @@ static unsigned long __init sun_floppy_init(void) { static int initialized = 0; struct device_node *dp; - struct of_device *op; + struct platform_device *op; const char *prop; char state[128]; @@ -567,7 +567,7 @@ static unsigned long __init sun_floppy_init(void) } if (op) { floppy_op = op; - FLOPPY_IRQ = op->irqs[0]; + FLOPPY_IRQ = op->archdata.irqs[0]; } else { struct device_node *ebus_dp; void __iomem *auxio_reg; @@ -593,7 +593,7 @@ static unsigned long __init sun_floppy_init(void) if (state_prop && !strncmp(state_prop, "disabled", 8)) return 0; - FLOPPY_IRQ = op->irqs[0]; + FLOPPY_IRQ = op->archdata.irqs[0]; /* Make sure the high density bit is set, some systems * (most notably Ultra5/Ultra10) come up with it clear. @@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void) config = 0; for (dp = ebus_dp->child; dp; dp = dp->sibling) { if (!strcmp(dp->name, "ecpp")) { - struct of_device *ecpp_op; + struct platform_device *ecpp_op; ecpp_op = of_find_device_by_node(dp); if (ecpp_op) diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h deleted file mode 100644 index f320246a0586..000000000000 --- a/arch/sparc/include/asm/of_device.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _ASM_SPARC_OF_DEVICE_H -#define _ASM_SPARC_OF_DEVICE_H -#ifdef __KERNEL__ - -#include <linux/device.h> -#include <linux/of.h> -#include <linux/mod_devicetable.h> -#include <asm/openprom.h> - -/* - * The of_device is a kind of "base class" that is a superset of - * struct device for use by devices attached to an OF node and - * probed using OF properties. - */ -struct of_device -{ - struct device dev; - struct resource resource[PROMREG_MAX]; - unsigned int irqs[PROMINTR_MAX]; - int num_irqs; - - void *sysdata; - - int slot; - int portid; - int clock_freq; -}; - -extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); -extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); - -extern void of_propagate_archdata(struct of_device *bus); - -/* This is just here during the transition */ -#include <linux/of_platform.h> - -#endif /* __KERNEL__ */ -#endif /* _ASM_SPARC_OF_DEVICE_H */ diff --git a/arch/sparc/include/asm/of_platform.h b/arch/sparc/include/asm/of_platform.h deleted file mode 100644 index 90da99059f83..000000000000 --- a/arch/sparc/include/asm/of_platform.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef ___ASM_SPARC_OF_PLATFORM_H -#define ___ASM_SPARC_OF_PLATFORM_H -/* - * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. - * <benh@kernel.crashing.org> - * Modified for Sparc by merging parts of asm/of_device.h - * by Stephen Rothwell - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#define of_bus_type of_platform_bus_type /* for compatibility */ - -#endif diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h index c333b8d0949b..4f7afa01b2ae 100644 --- a/arch/sparc/include/asm/parport.h +++ b/arch/sparc/include/asm/parport.h @@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int dmanr) return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); } -static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match) +static int __devinit ecpp_probe(struct platform_device *op, const struct of_device_id *match) { unsigned long base = op->resource[0].start; unsigned long config = op->resource[1].start; @@ -116,7 +116,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id parent = op->dev.of_node->parent; if (!strcmp(parent->name, "dma")) { p = parport_pc_probe_port(base, base + 0x400, - op->irqs[0], PARPORT_DMA_NOFIFO, + op->archdata.irqs[0], PARPORT_DMA_NOFIFO, op->dev.parent->parent, 0); if (!p) return -ENOMEM; @@ -166,7 +166,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id 0, PTR_LPT_REG_DIR); p = parport_pc_probe_port(base, base + 0x400, - op->irqs[0], + op->archdata.irqs[0], slot, op->dev.parent, 0); @@ -192,7 +192,7 @@ out_err: return err; } -static int __devexit ecpp_remove(struct of_device *op) +static int __devexit ecpp_remove(struct platform_device *op) { struct parport *p = dev_get_drvdata(&op->dev); int slot = p->dma; @@ -243,9 +243,7 @@ static struct of_platform_driver ecpp_driver = { static int parport_pc_find_nonpci_ports(int autoirq, int autodma) { - of_register_driver(&ecpp_driver, &of_bus_type); - - return 0; + return of_register_platform_driver(&ecpp_driver); } #endif /* !(_ASM_SPARC64_PARPORT_H */ diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h index f845828ca4c6..291f12575edd 100644 --- a/arch/sparc/include/asm/prom.h +++ b/arch/sparc/include/asm/prom.h @@ -43,20 +43,22 @@ extern int of_getintprop_default(struct device_node *np, extern int of_find_in_proplist(const char *list, const char *match, int len); #ifdef CONFIG_NUMA extern int of_node_to_nid(struct device_node *dp); -#else -#define of_node_to_nid(dp) (-1) +#define of_node_to_nid of_node_to_nid #endif extern void prom_build_devicetree(void); extern void of_populate_present_mask(void); extern void of_fill_in_cpu_data(void); +struct resource; +extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); +extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); + /* These routines are here to provide compatibility with how powerpc * handles IRQ mapping for OF device nodes. We precompute and permanently - * register them in the of_device objects, whereas powerpc computes them + * register them in the platform_device objects, whereas powerpc computes them * on request. */ -extern unsigned int irq_of_parse_and_map(struct device_node *node, int index); static inline void irq_dispose_mapping(unsigned int virq) { } diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c index b27476caa133..2c0046ecc715 100644 --- a/arch/sparc/kernel/apc.c +++ b/arch/sparc/kernel/apc.c @@ -68,7 +68,7 @@ static void apc_swift_idle(void) #endif } -static inline void apc_free(struct of_device *op) +static inline void apc_free(struct platform_device *op) { of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0])); } @@ -136,7 +136,7 @@ static const struct file_operations apc_fops = { static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; -static int __devinit apc_probe(struct of_device *op, +static int __devinit apc_probe(struct platform_device *op, const struct of_device_id *match) { int err; @@ -184,7 +184,7 @@ static struct of_platform_driver apc_driver = { static int __init apc_init(void) { - return of_register_driver(&apc_driver, &of_bus_type); + return of_register_platform_driver(&apc_driver); } /* This driver is not critical to the boot process diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c index ddc84128b3c2..3efd3c5af6a9 100644 --- a/arch/sparc/kernel/auxio_64.c +++ b/arch/sparc/kernel/auxio_64.c @@ -102,7 +102,8 @@ static struct of_device_id __initdata auxio_match[] = { MODULE_DEVICE_TABLE(of, auxio_match); -static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) +static int __devinit auxio_probe(struct platform_device *dev, + const struct of_device_id *match) { struct device_node *dp = dev->dev.of_node; unsigned long size; @@ -142,7 +143,7 @@ static struct of_platform_driver auxio_driver = { static int __init auxio_init(void) { - return of_register_driver(&auxio_driver, &of_platform_bus_type); + return of_register_platform_driver(&auxio_driver); } /* Must be after subsys_initcall() so that busses are probed. Must diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c index 434335f65823..cfa2624c5332 100644 --- a/arch/sparc/kernel/central.c +++ b/arch/sparc/kernel/central.c @@ -59,7 +59,7 @@ static int __devinit clock_board_calc_nslots(struct clock_board *p) } } -static int __devinit clock_board_probe(struct of_device *op, +static int __devinit clock_board_probe(struct platform_device *op, const struct of_device_id *match) { struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL); @@ -157,7 +157,7 @@ static struct of_platform_driver clock_board_driver = { }, }; -static int __devinit fhc_probe(struct of_device *op, +static int __devinit fhc_probe(struct platform_device *op, const struct of_device_id *match) { struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL); @@ -265,8 +265,8 @@ static struct of_platform_driver fhc_driver = { static int __init sunfire_init(void) { - (void) of_register_driver(&fhc_driver, &of_platform_bus_type); - (void) of_register_driver(&clock_board_driver, &of_platform_bus_type); + (void) of_register_platform_driver(&fhc_driver); + (void) of_register_platform_driver(&clock_board_driver); return 0; } diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c index 870cb65b3f21..08c466ebb32b 100644 --- a/arch/sparc/kernel/chmc.c +++ b/arch/sparc/kernel/chmc.c @@ -392,7 +392,7 @@ static void __devinit jbusmc_construct_dimm_groups(struct jbusmc *p, } } -static int __devinit jbusmc_probe(struct of_device *op, +static int __devinit jbusmc_probe(struct platform_device *op, const struct of_device_id *match) { const struct linux_prom64_registers *mem_regs; @@ -690,7 +690,7 @@ static void chmc_fetch_decode_regs(struct chmc *p) chmc_read_mcreg(p, CHMCTRL_DECODE4)); } -static int __devinit chmc_probe(struct of_device *op, +static int __devinit chmc_probe(struct platform_device *op, const struct of_device_id *match) { struct device_node *dp = op->dev.of_node; @@ -765,7 +765,7 @@ out_free: goto out; } -static int __devinit us3mc_probe(struct of_device *op, +static int __devinit us3mc_probe(struct platform_device *op, const struct of_device_id *match) { if (mc_type == MC_TYPE_SAFARI) @@ -775,21 +775,21 @@ static int __devinit us3mc_probe(struct of_device *op, return -ENODEV; } -static void __devexit chmc_destroy(struct of_device *op, struct chmc *p) +static void __devexit chmc_destroy(struct platform_device *op, struct chmc *p) { list_del(&p->list); of_iounmap(&op->resource[0], p->regs, 0x48); kfree(p); } -static void __devexit jbusmc_destroy(struct of_device *op, struct jbusmc *p) +static void __devexit jbusmc_destroy(struct platform_device *op, struct jbusmc *p) { mc_list_del(&p->list); of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE); kfree(p); } -static int __devexit us3mc_remove(struct of_device *op) +static int __devexit us3mc_remove(struct platform_device *op) { void *p = dev_get_drvdata(&op->dev); @@ -848,7 +848,7 @@ static int __init us3mc_init(void) ret = register_dimm_printer(us3mc_dimm_printer); if (!ret) { - ret = of_register_driver(&us3mc_driver, &of_bus_type); + ret = of_register_platform_driver(&us3mc_driver); if (ret) unregister_dimm_printer(us3mc_dimm_printer); } @@ -859,7 +859,7 @@ static void __exit us3mc_cleanup(void) { if (us3mc_platform()) { unregister_dimm_printer(us3mc_dimm_printer); - of_unregister_driver(&us3mc_driver); + of_unregister_platform_driver(&us3mc_driver); } } diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 703e4aa9bc38..41f7e4e0f72a 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c @@ -253,7 +253,7 @@ EXPORT_SYMBOL(sbus_set_sbus64); static void *sbus_alloc_coherent(struct device *dev, size_t len, dma_addr_t *dma_addrp, gfp_t gfp) { - struct of_device *op = to_of_device(dev); + struct platform_device *op = to_platform_device(dev); unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; unsigned long va; struct resource *res; diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c index 47e63f1e719c..2d055a1e9cc2 100644 --- a/arch/sparc/kernel/of_device_32.c +++ b/arch/sparc/kernel/of_device_32.c @@ -241,10 +241,10 @@ static int __init use_1to1_mapping(struct device_node *pp) static int of_resource_verbose; -static void __init build_device_resources(struct of_device *op, +static void __init build_device_resources(struct platform_device *op, struct device *parent) { - struct of_device *p_op; + struct platform_device *p_op; struct of_bus *bus; int na, ns; int index, num_reg; @@ -253,7 +253,7 @@ static void __init build_device_resources(struct of_device *op, if (!parent) return; - p_op = to_of_device(parent); + p_op = to_platform_device(parent); bus = of_match_bus(p_op->dev.of_node); bus->count_cells(op->dev.of_node, &na, &ns); @@ -267,6 +267,8 @@ static void __init build_device_resources(struct of_device *op, /* Conver to num-entries. */ num_reg /= na + ns; + op->resource = op->archdata.resource; + op->num_resources = num_reg; for (index = 0; index < num_reg; index++) { struct resource *r = &op->resource[index]; u32 addr[OF_MAX_ADDR_CELLS]; @@ -333,10 +335,10 @@ static void __init build_device_resources(struct of_device *op, } } -static struct of_device * __init scan_one_device(struct device_node *dp, +static struct platform_device * __init scan_one_device(struct device_node *dp, struct device *parent) { - struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); + struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL); const struct linux_prom_irqs *intr; struct dev_archdata *sd; int len, i; @@ -349,27 +351,21 @@ static struct of_device * __init scan_one_device(struct device_node *dp, op->dev.of_node = dp; - op->clock_freq = of_getintprop_default(dp, "clock-frequency", - (25*1000*1000)); - op->portid = of_getintprop_default(dp, "upa-portid", -1); - if (op->portid == -1) - op->portid = of_getintprop_default(dp, "portid", -1); - intr = of_get_property(dp, "intr", &len); if (intr) { - op->num_irqs = len / sizeof(struct linux_prom_irqs); - for (i = 0; i < op->num_irqs; i++) - op->irqs[i] = intr[i].pri; + op->archdata.num_irqs = len / sizeof(struct linux_prom_irqs); + for (i = 0; i < op->archdata.num_irqs; i++) + op->archdata.irqs[i] = intr[i].pri; } else { const unsigned int *irq = of_get_property(dp, "interrupts", &len); if (irq) { - op->num_irqs = len / sizeof(unsigned int); - for (i = 0; i < op->num_irqs; i++) - op->irqs[i] = irq[i]; + op->archdata.num_irqs = len / sizeof(unsigned int); + for (i = 0; i < op->archdata.num_irqs; i++) + op->archdata.irqs[i] = irq[i]; } else { - op->num_irqs = 0; + op->archdata.num_irqs = 0; } } if (sparc_cpu_model == sun4d) { @@ -411,8 +407,8 @@ static struct of_device * __init scan_one_device(struct device_node *dp, goto build_resources; } - for (i = 0; i < op->num_irqs; i++) { - int this_irq = op->irqs[i]; + for (i = 0; i < op->archdata.num_irqs; i++) { + int this_irq = op->archdata.irqs[i]; int sbusl = pil_to_sbus[this_irq]; if (sbusl) @@ -420,7 +416,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, (sbusl << 2) + slot); - op->irqs[i] = this_irq; + op->archdata.irqs[i] = this_irq; } } @@ -428,7 +424,7 @@ build_resources: build_device_resources(op, parent); op->dev.parent = parent; - op->dev.bus = &of_platform_bus_type; + op->dev.bus = &platform_bus_type; if (!parent) dev_set_name(&op->dev, "root"); else @@ -447,7 +443,7 @@ build_resources: static void __init scan_tree(struct device_node *dp, struct device *parent) { while (dp) { - struct of_device *op = scan_one_device(dp, parent); + struct platform_device *op = scan_one_device(dp, parent); if (op) scan_tree(dp->child, &op->dev); @@ -456,30 +452,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent) } } -static void __init scan_of_devices(void) +static int __init scan_of_devices(void) { struct device_node *root = of_find_node_by_path("/"); - struct of_device *parent; + struct platform_device *parent; parent = scan_one_device(root, NULL); if (!parent) - return; + return 0; scan_tree(root->child, &parent->dev); + return 0; } - -static int __init of_bus_driver_init(void) -{ - int err; - - err = of_bus_type_init(&of_platform_bus_type, "of"); - if (!err) - scan_of_devices(); - - return err; -} - -postcore_initcall(of_bus_driver_init); +postcore_initcall(scan_of_devices); static int __init of_debug(char *str) { diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c index 1dae8079f728..63cd4e5d47c2 100644 --- a/arch/sparc/kernel/of_device_64.c +++ b/arch/sparc/kernel/of_device_64.c @@ -310,10 +310,10 @@ static int __init use_1to1_mapping(struct device_node *pp) static int of_resource_verbose; -static void __init build_device_resources(struct of_device *op, +static void __init build_device_resources(struct platform_device *op, struct device *parent) { - struct of_device *p_op; + struct platform_device *p_op; struct of_bus *bus; int na, ns; int index, num_reg; @@ -322,7 +322,7 @@ static void __init build_device_resources(struct of_device *op, if (!parent) return; - p_op = to_of_device(parent); + p_op = to_platform_device(parent); bus = of_match_bus(p_op->dev.of_node); bus->count_cells(op->dev.of_node, &na, &ns); @@ -344,6 +344,8 @@ static void __init build_device_resources(struct of_device *op, num_reg = PROMREG_MAX; } + op->resource = op->archdata.resource; + op->num_resources = num_reg; for (index = 0; index < num_reg; index++) { struct resource *r = &op->resource[index]; u32 addr[OF_MAX_ADDR_CELLS]; @@ -526,7 +528,7 @@ static unsigned int __init pci_irq_swizzle(struct device_node *dp, static int of_irq_verbose; -static unsigned int __init build_one_device_irq(struct of_device *op, +static unsigned int __init build_one_device_irq(struct platform_device *op, struct device *parent, unsigned int irq) { @@ -628,10 +630,10 @@ out: return irq; } -static struct of_device * __init scan_one_device(struct device_node *dp, +static struct platform_device * __init scan_one_device(struct device_node *dp, struct device *parent) { - struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); + struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL); const unsigned int *irq; struct dev_archdata *sd; int len, i; @@ -644,34 +646,28 @@ static struct of_device * __init scan_one_device(struct device_node *dp, op->dev.of_node = dp; - op->clock_freq = of_getintprop_default(dp, "clock-frequency", - (25*1000*1000)); - op->portid = of_getintprop_default(dp, "upa-portid", -1); - if (op->portid == -1) - op->portid = of_getintprop_default(dp, "portid", -1); - irq = of_get_property(dp, "interrupts", &len); if (irq) { - op->num_irqs = len / 4; + op->archdata.num_irqs = len / 4; /* Prevent overrunning the op->irqs[] array. */ - if (op->num_irqs > PROMINTR_MAX) { + if (op->archdata.num_irqs > PROMINTR_MAX) { printk(KERN_WARNING "%s: Too many irqs (%d), " "limiting to %d.\n", - dp->full_name, op->num_irqs, PROMINTR_MAX); - op->num_irqs = PROMINTR_MAX; + dp->full_name, op->archdata.num_irqs, PROMINTR_MAX); + op->archdata.num_irqs = PROMINTR_MAX; } - memcpy(op->irqs, irq, op->num_irqs * 4); + memcpy(op->archdata.irqs, irq, op->archdata.num_irqs * 4); } else { - op->num_irqs = 0; + op->archdata.num_irqs = 0; } build_device_resources(op, parent); - for (i = 0; i < op->num_irqs; i++) - op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]); + for (i = 0; i < op->archdata.num_irqs; i++) + op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]); op->dev.parent = parent; - op->dev.bus = &of_platform_bus_type; + op->dev.bus = &platform_bus_type; if (!parent) dev_set_name(&op->dev, "root"); else @@ -690,7 +686,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, static void __init scan_tree(struct device_node *dp, struct device *parent) { while (dp) { - struct of_device *op = scan_one_device(dp, parent); + struct platform_device *op = scan_one_device(dp, parent); if (op) scan_tree(dp->child, &op->dev); @@ -699,30 +695,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent) } } -static void __init scan_of_devices(void) +static int __init scan_of_devices(void) { struct device_node *root = of_find_node_by_path("/"); - struct of_device *parent; + struct platform_device *parent; parent = scan_one_device(root, NULL); if (!parent) - return; + return 0; scan_tree(root->child, &parent->dev); + return 0; } - -static int __init of_bus_driver_init(void) -{ - int err; - - err = of_bus_type_init(&of_platform_bus_type, "of"); - if (!err) - scan_of_devices(); - - return err; -} - -postcore_initcall(of_bus_driver_init); +postcore_initcall(scan_of_devices); static int __init of_debug(char *str) { diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c index 10c6c36a6e75..49ddff56cb04 100644 --- a/arch/sparc/kernel/of_device_common.c +++ b/arch/sparc/kernel/of_device_common.c @@ -11,48 +11,28 @@ #include "of_device_common.h" -static int node_match(struct device *dev, void *data) -{ - struct of_device *op = to_of_device(dev); - struct device_node *dp = data; - - return (op->dev.of_node == dp); -} - -struct of_device *of_find_device_by_node(struct device_node *dp) -{ - struct device *dev = bus_find_device(&of_platform_bus_type, NULL, - dp, node_match); - - if (dev) - return to_of_device(dev); - - return NULL; -} -EXPORT_SYMBOL(of_find_device_by_node); - unsigned int irq_of_parse_and_map(struct device_node *node, int index) { - struct of_device *op = of_find_device_by_node(node); + struct platform_device *op = of_find_device_by_node(node); - if (!op || index >= op->num_irqs) + if (!op || index >= op->archdata.num_irqs) return 0; - return op->irqs[index]; + return op->archdata.irqs[index]; } EXPORT_SYMBOL(irq_of_parse_and_map); /* Take the archdata values for IOMMU, STC, and HOSTDATA found in - * BUS and propagate to all child of_device objects. + * BUS and propagate to all child platform_device objects. */ -void of_propagate_archdata(struct of_device *bus) +void of_propagate_archdata(struct platform_device *bus) { struct dev_archdata *bus_sd = &bus->dev.archdata; struct device_node *bus_dp = bus->dev.of_node; struct device_node *dp; for (dp = bus_dp->child; dp; dp = dp->sibling) { - struct of_device *op = of_find_device_by_node(dp); + struct platform_device *op = of_find_device_by_node(dp); op->dev.archdata.iommu = bus_sd->iommu; op->dev.archdata.stc = bus_sd->stc; @@ -64,9 +44,6 @@ void of_propagate_archdata(struct of_device *bus) } } -struct bus_type of_platform_bus_type; -EXPORT_SYMBOL(of_platform_bus_type); - static void get_cells(struct device_node *dp, int *addrc, int *sizec) { if (addrc) diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 8a8363adb8bd..4137579d9adc 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -198,7 +198,7 @@ static unsigned long pci_parse_of_flags(u32 addr0) * into physical address resources, we only have to figure out the register * mapping. */ -static void pci_parse_of_addrs(struct of_device *op, +static void pci_parse_of_addrs(struct platform_device *op, struct device_node *node, struct pci_dev *dev) { @@ -248,7 +248,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, { struct dev_archdata *sd; struct pci_slot *slot; - struct of_device *op; + struct platform_device *op; struct pci_dev *dev; const char *type; u32 class; @@ -340,7 +340,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, dev->hdr_type = PCI_HEADER_TYPE_NORMAL; dev->rom_base_reg = PCI_ROM_ADDRESS; - dev->irq = sd->op->irqs[0]; + dev->irq = sd->op->archdata.irqs[0]; if (dev->irq == 0xffffffff) dev->irq = PCI_IRQ_NONE; } diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c index 51cfa09e392a..efb896d68754 100644 --- a/arch/sparc/kernel/pci_fire.c +++ b/arch/sparc/kernel/pci_fire.c @@ -410,7 +410,7 @@ static void pci_fire_hw_init(struct pci_pbm_info *pbm) } static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm, - struct of_device *op, u32 portid) + struct platform_device *op, u32 portid) { const struct linux_prom64_registers *regs; struct device_node *dp = op->dev.of_node; @@ -455,7 +455,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm, return 0; } -static int __devinit fire_probe(struct of_device *op, +static int __devinit fire_probe(struct platform_device *op, const struct of_device_id *match) { struct device_node *dp = op->dev.of_node; @@ -518,7 +518,7 @@ static struct of_platform_driver fire_driver = { static int __init fire_init(void) { - return of_register_driver(&fire_driver, &of_bus_type); + return of_register_platform_driver(&fire_driver); } subsys_initcall(fire_init); diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h index 03186824327e..e20ed5f06e9c 100644 --- a/arch/sparc/kernel/pci_impl.h +++ b/arch/sparc/kernel/pci_impl.h @@ -91,7 +91,7 @@ struct pci_pbm_info { char *name; /* OBP specific information. */ - struct of_device *op; + struct platform_device *op; u64 ino_bitmap; /* PBM I/O and Memory space resources. */ diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c index 558a70512824..22eab7cf3b11 100644 --- a/arch/sparc/kernel/pci_psycho.c +++ b/arch/sparc/kernel/pci_psycho.c @@ -285,7 +285,7 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id) #define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ static void psycho_register_error_handlers(struct pci_pbm_info *pbm) { - struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); + struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node); unsigned long base = pbm->controller_regs; u64 tmp; int err; @@ -302,23 +302,23 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm) * 5: POWER MANAGEMENT */ - if (op->num_irqs < 6) + if (op->archdata.num_irqs < 6) return; /* We really mean to ignore the return result here. Two * PCI controller share the same interrupt numbers and * drive the same front-end hardware. */ - err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED, + err = request_irq(op->archdata.irqs[1], psycho_ue_intr, IRQF_SHARED, "PSYCHO_UE", pbm); - err = request_irq(op->irqs[2], psycho_ce_intr, IRQF_SHARED, + err = request_irq(op->archdata.irqs[2], psycho_ce_intr, IRQF_SHARED, "PSYCHO_CE", pbm); /* This one, however, ought not to fail. We can just warn * about it since the system can still operate properly even * if this fails. */ - err = request_irq(op->irqs[0], psycho_pcierr_intr, IRQF_SHARED, + err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, IRQF_SHARED, "PSYCHO_PCIERR", pbm); if (err) printk(KERN_WARNING "%s: Could not register PCIERR, " @@ -483,7 +483,7 @@ static void psycho_pbm_strbuf_init(struct pci_pbm_info *pbm, #define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm, - struct of_device *op, int is_pbm_a) + struct platform_device *op, int is_pbm_a) { psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO); psycho_pbm_strbuf_init(pbm, is_pbm_a); @@ -503,7 +503,7 @@ static struct pci_pbm_info * __devinit psycho_find_sibling(u32 upa_portid) #define PSYCHO_CONFIGSPACE 0x001000000UL -static int __devinit psycho_probe(struct of_device *op, +static int __devinit psycho_probe(struct platform_device *op, const struct of_device_id *match) { const struct linux_prom64_registers *pr_regs; @@ -612,7 +612,7 @@ static struct of_platform_driver psycho_driver = { static int __init psycho_init(void) { - return of_register_driver(&psycho_driver, &of_bus_type); + return of_register_platform_driver(&psycho_driver); } subsys_initcall(psycho_init); diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c index 6dad8e3b7506..5c3f5ec4cabc 100644 --- a/arch/sparc/kernel/pci_sabre.c +++ b/arch/sparc/kernel/pci_sabre.c @@ -311,7 +311,7 @@ static irqreturn_t sabre_ce_intr(int irq, void *dev_id) static void sabre_register_error_handlers(struct pci_pbm_info *pbm) { struct device_node *dp = pbm->op->dev.of_node; - struct of_device *op; + struct platform_device *op; unsigned long base = pbm->controller_regs; u64 tmp; int err; @@ -329,7 +329,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm) * 2: CE ERR * 3: POWER FAIL */ - if (op->num_irqs < 4) + if (op->archdata.num_irqs < 4) return; /* We clear the error bits in the appropriate AFSR before @@ -341,7 +341,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm) SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE), base + SABRE_UE_AFSR); - err = request_irq(op->irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm); + err = request_irq(op->archdata.irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm); if (err) printk(KERN_WARNING "%s: Couldn't register UE, err=%d.\n", pbm->name, err); @@ -351,11 +351,11 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm) base + SABRE_CE_AFSR); - err = request_irq(op->irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm); + err = request_irq(op->archdata.irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm); if (err) printk(KERN_WARNING "%s: Couldn't register CE, err=%d.\n", pbm->name, err); - err = request_irq(op->irqs[0], psycho_pcierr_intr, 0, + err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, 0, "SABRE_PCIERR", pbm); if (err) printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n", @@ -443,7 +443,7 @@ static void __devinit sabre_scan_bus(struct pci_pbm_info *pbm, } static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm, - struct of_device *op) + struct platform_device *op) { psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE); pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR; @@ -452,7 +452,7 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm, sabre_scan_bus(pbm, &op->dev); } -static int __devinit sabre_probe(struct of_device *op, +static int __devinit sabre_probe(struct platform_device *op, const struct of_device_id *match) { const struct linux_prom64_registers *pr_regs; @@ -606,7 +606,7 @@ static struct of_platform_driver sabre_driver = { static int __init sabre_init(void) { - return of_register_driver(&sabre_driver, &of_bus_type); + return of_register_platform_driver(&sabre_driver); } subsys_initcall(sabre_init); diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c index 97a1ae2e1c02..445a47a2fb3d 100644 --- a/arch/sparc/kernel/pci_schizo.c +++ b/arch/sparc/kernel/pci_schizo.c @@ -844,7 +844,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino) */ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) { - struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); + struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node); u64 tmp, err_mask, err_no_mask; int err; @@ -857,14 +857,14 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) */ if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { - err = request_irq(op->irqs[1], schizo_ue_intr, 0, + err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0, "TOMATILLO_UE", pbm); if (err) printk(KERN_WARNING "%s: Could not register UE, " "err=%d\n", pbm->name, err); } if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { - err = request_irq(op->irqs[2], schizo_ce_intr, 0, + err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0, "TOMATILLO_CE", pbm); if (err) printk(KERN_WARNING "%s: Could not register CE, " @@ -872,10 +872,10 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) } err = 0; if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { - err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, + err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0, "TOMATILLO_PCIERR", pbm); } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { - err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, + err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0, "TOMATILLO_PCIERR", pbm); } if (err) @@ -883,7 +883,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) "err=%d\n", pbm->name, err); if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { - err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, + err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0, "TOMATILLO_SERR", pbm); if (err) printk(KERN_WARNING "%s: Could not register SERR, " @@ -939,7 +939,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) static void schizo_register_error_handlers(struct pci_pbm_info *pbm) { - struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); + struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node); u64 tmp, err_mask, err_no_mask; int err; @@ -952,14 +952,14 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm) */ if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { - err = request_irq(op->irqs[1], schizo_ue_intr, 0, + err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0, "SCHIZO_UE", pbm); if (err) printk(KERN_WARNING "%s: Could not register UE, " "err=%d\n", pbm->name, err); } if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { - err = request_irq(op->irqs[2], schizo_ce_intr, 0, + err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0, "SCHIZO_CE", pbm); if (err) printk(KERN_WARNING "%s: Could not register CE, " @@ -967,10 +967,10 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm) } err = 0; if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { - err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, + err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0, "SCHIZO_PCIERR", pbm); } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { - err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, + err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0, "SCHIZO_PCIERR", pbm); } if (err) @@ -978,7 +978,7 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm) "err=%d\n", pbm->name, err); if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { - err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, + err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0, "SCHIZO_SERR", pbm); if (err) printk(KERN_WARNING "%s: Could not register SERR, " @@ -1307,7 +1307,7 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm) } static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm, - struct of_device *op, u32 portid, + struct platform_device *op, u32 portid, int chip_type) { const struct linux_prom64_registers *regs; @@ -1413,7 +1413,7 @@ static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid, return NULL; } -static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type) +static int __devinit __schizo_init(struct platform_device *op, unsigned long chip_type) { struct device_node *dp = op->dev.of_node; struct pci_pbm_info *pbm; @@ -1460,7 +1460,7 @@ out_err: return err; } -static int __devinit schizo_probe(struct of_device *op, +static int __devinit schizo_probe(struct platform_device *op, const struct of_device_id *match) { return __schizo_init(op, (unsigned long) match->data); @@ -1501,7 +1501,7 @@ static struct of_platform_driver schizo_driver = { static int __init schizo_init(void) { - return of_register_driver(&schizo_driver, &of_bus_type); + return of_register_platform_driver(&schizo_driver); } subsys_initcall(schizo_init); diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index a24af6f7e17f..743344aa6d8a 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c @@ -879,7 +879,7 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm) #endif /* !(CONFIG_PCI_MSI) */ static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, - struct of_device *op, u32 devhandle) + struct platform_device *op, u32 devhandle) { struct device_node *dp = op->dev.of_node; int err; @@ -918,7 +918,7 @@ static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, return 0; } -static int __devinit pci_sun4v_probe(struct of_device *op, +static int __devinit pci_sun4v_probe(struct platform_device *op, const struct of_device_id *match) { const struct linux_prom64_registers *regs; @@ -1019,7 +1019,7 @@ static struct of_platform_driver pci_sun4v_driver = { static int __init pci_sun4v_init(void) { - return of_register_driver(&pci_sun4v_driver, &of_bus_type); + return of_register_platform_driver(&pci_sun4v_driver); } subsys_initcall(pci_sun4v_init); diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c index 9589d8b9b0c1..94536a85f161 100644 --- a/arch/sparc/kernel/pmc.c +++ b/arch/sparc/kernel/pmc.c @@ -51,7 +51,7 @@ static void pmc_swift_idle(void) #endif } -static int __devinit pmc_probe(struct of_device *op, +static int __devinit pmc_probe(struct platform_device *op, const struct of_device_id *match) { regs = of_ioremap(&op->resource[0], 0, @@ -89,7 +89,7 @@ static struct of_platform_driver pmc_driver = { static int __init pmc_init(void) { - return of_register_driver(&pmc_driver, &of_bus_type); + return of_register_platform_driver(&pmc_driver); } /* This driver is not critical to the boot process diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c index 168d4cb63f5b..2c59f4d387dd 100644 --- a/arch/sparc/kernel/power.c +++ b/arch/sparc/kernel/power.c @@ -33,10 +33,10 @@ static int __devinit has_button_interrupt(unsigned int irq, struct device_node * return 1; } -static int __devinit power_probe(struct of_device *op, const struct of_device_id *match) +static int __devinit power_probe(struct platform_device *op, const struct of_device_id *match) { struct resource *res = &op->resource[0]; - unsigned int irq= op->irqs[0]; + unsigned int irq = op->archdata.irqs[0]; power_reg = of_ioremap(res, 0, 0x4, "power"); @@ -70,7 +70,7 @@ static struct of_platform_driver power_driver = { static int __init power_init(void) { - return of_register_driver(&power_driver, &of_platform_bus_type); + return of_register_platform_driver(&power_driver); } device_initcall(power_init); diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h index a8591ef2636d..eeb04a782ec8 100644 --- a/arch/sparc/kernel/prom.h +++ b/arch/sparc/kernel/prom.h @@ -9,14 +9,6 @@ extern void irq_trans_init(struct device_node *dp); extern unsigned int prom_unique_id; -static inline int is_root_node(const struct device_node *dp) -{ - if (!dp) - return 0; - - return (dp->parent == NULL); -} - extern char *build_path_component(struct device_node *dp); extern void of_console_init(void); diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index 466a32763ea8..86597d9867fd 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -21,7 +21,7 @@ #include <linux/mm.h> #include <linux/module.h> #include <linux/memblock.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <asm/prom.h> #include <asm/oplib.h> @@ -81,7 +81,7 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf) return; regs = rprop->value; - if (!is_root_node(dp->parent)) { + if (!of_node_is_root(dp->parent)) { sprintf(tmp_buf, "%s@%x,%x", dp->name, (unsigned int) (regs->phys_addr >> 32UL), @@ -121,7 +121,7 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf) return; regs = prop->value; - if (!is_root_node(dp->parent)) { + if (!of_node_is_root(dp->parent)) { sprintf(tmp_buf, "%s@%x,%x", dp->name, (unsigned int) (regs->phys_addr >> 32UL), diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 57ac9e28be0c..1f830da2ddf2 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -244,7 +244,7 @@ char * __init build_full_name(struct device_node *dp) n = prom_early_alloc(len); strcpy(n, dp->parent->full_name); - if (!is_root_node(dp->parent)) { + if (!of_node_is_root(dp->parent)) { strcpy(n + plen, "/"); plen++; } diff --git a/arch/sparc/kernel/prom_irqtrans.c b/arch/sparc/kernel/prom_irqtrans.c index 5702ad4710cb..ce651147fabc 100644 --- a/arch/sparc/kernel/prom_irqtrans.c +++ b/arch/sparc/kernel/prom_irqtrans.c @@ -719,7 +719,7 @@ static unsigned int central_build_irq(struct device_node *dp, void *_data) { struct device_node *central_dp = _data; - struct of_device *central_op = of_find_device_by_node(central_dp); + struct platform_device *central_op = of_find_device_by_node(central_dp); struct resource *res; unsigned long imap, iclr; u32 tmp; diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c index 3f34ac853931..fe2af66bb198 100644 --- a/arch/sparc/kernel/psycho_common.c +++ b/arch/sparc/kernel/psycho_common.c @@ -447,7 +447,7 @@ int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, } -void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op, +void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op, const char *chip_name, int chip_type) { struct device_node *dp = op->dev.of_node; diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h index 092c278ef28d..590b4ed8ab5e 100644 --- a/arch/sparc/kernel/psycho_common.h +++ b/arch/sparc/kernel/psycho_common.h @@ -42,7 +42,7 @@ extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize, unsigned long write_complete_offset); extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, - struct of_device *op, + struct platform_device *op, const char *chip_name, int chip_type); #endif /* _PSYCHO_COMMON_H */ diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c index cfeaf04b9cdf..2ca32d13abcf 100644 --- a/arch/sparc/kernel/sbus.c +++ b/arch/sparc/kernel/sbus.c @@ -57,7 +57,7 @@ void sbus_set_sbus64(struct device *dev, int bursts) { struct iommu *iommu = dev->archdata.iommu; - struct of_device *op = to_of_device(dev); + struct platform_device *op = to_platform_device(dev); const struct linux_prom_registers *regs; unsigned long cfg_reg; int slot; @@ -204,7 +204,7 @@ static unsigned long sysio_imap_to_iclr(unsigned long imap) return imap + diff; } -static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino) +static unsigned int sbus_build_irq(struct platform_device *op, unsigned int ino) { struct iommu *iommu = op->dev.archdata.iommu; unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; @@ -267,7 +267,7 @@ static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino) #define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ static irqreturn_t sysio_ue_handler(int irq, void *dev_id) { - struct of_device *op = dev_id; + struct platform_device *op = dev_id; struct iommu *iommu = op->dev.archdata.iommu; unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; unsigned long afsr_reg, afar_reg; @@ -341,7 +341,7 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id) #define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ static irqreturn_t sysio_ce_handler(int irq, void *dev_id) { - struct of_device *op = dev_id; + struct platform_device *op = dev_id; struct iommu *iommu = op->dev.archdata.iommu; unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; unsigned long afsr_reg, afar_reg; @@ -420,7 +420,7 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id) #define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) { - struct of_device *op = dev_id; + struct platform_device *op = dev_id; struct iommu *iommu = op->dev.archdata.iommu; unsigned long afsr_reg, afar_reg, reg_base; unsigned long afsr, afar, error_bits; @@ -488,7 +488,7 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) #define SYSIO_CE_INO 0x35 #define SYSIO_SBUSERR_INO 0x36 -static void __init sysio_register_error_handlers(struct of_device *op) +static void __init sysio_register_error_handlers(struct platform_device *op) { struct iommu *iommu = op->dev.archdata.iommu; unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; @@ -534,7 +534,7 @@ static void __init sysio_register_error_handlers(struct of_device *op) } /* Boot time initialization. */ -static void __init sbus_iommu_init(struct of_device *op) +static void __init sbus_iommu_init(struct platform_device *op) { const struct linux_prom64_registers *pr; struct device_node *dp = op->dev.of_node; @@ -663,7 +663,7 @@ static int __init sbus_init(void) struct device_node *dp; for_each_node_by_name(dp, "sbus") { - struct of_device *op = of_find_device_by_node(dp); + struct platform_device *op = of_find_device_by_node(dp); sbus_iommu_init(op); of_propagate_archdata(op); diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c index e404b063be2c..9c743b1886ff 100644 --- a/arch/sparc/kernel/time_32.c +++ b/arch/sparc/kernel/time_32.c @@ -142,7 +142,7 @@ static struct platform_device m48t59_rtc = { }, }; -static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) +static int __devinit clock_probe(struct platform_device *op, const struct of_device_id *match) { struct device_node *dp = op->dev.of_node; const char *model = of_get_property(dp, "model", NULL); @@ -189,7 +189,7 @@ static struct of_platform_driver clock_driver = { /* Probe for the mostek real time clock chip. */ static int __init clock_init(void) { - return of_register_driver(&clock_driver, &of_platform_bus_type); + return of_register_platform_driver(&clock_driver); } /* Must be after subsys_initcall() so that busses are probed. Must * be before device_initcall() because things like the RTC driver diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index 21e9fcae0668..3bc9c9979b92 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c @@ -419,7 +419,7 @@ static struct platform_device rtc_cmos_device = { .num_resources = 1, }; -static int __devinit rtc_probe(struct of_device *op, const struct of_device_id *match) +static int __devinit rtc_probe(struct platform_device *op, const struct of_device_id *match) { struct resource *r; @@ -477,7 +477,7 @@ static struct platform_device rtc_bq4802_device = { .num_resources = 1, }; -static int __devinit bq4802_probe(struct of_device *op, const struct of_device_id *match) +static int __devinit bq4802_probe(struct platform_device *op, const struct of_device_id *match) { printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", @@ -534,7 +534,7 @@ static struct platform_device m48t59_rtc = { }, }; -static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match) +static int __devinit mostek_probe(struct platform_device *op, const struct of_device_id *match) { struct device_node *dp = op->dev.of_node; @@ -586,9 +586,9 @@ static int __init clock_init(void) if (tlb_type == hypervisor) return platform_device_register(&rtc_sun4v_device); - (void) of_register_driver(&rtc_driver, &of_platform_bus_type); - (void) of_register_driver(&mostek_driver, &of_platform_bus_type); - (void) of_register_driver(&bq4802_driver, &of_platform_bus_type); + (void) of_register_platform_driver(&rtc_driver); + (void) of_register_platform_driver(&mostek_driver); + (void) of_register_platform_driver(&bq4802_driver); return 0; } diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 005e758a4db7..fc58c3e917df 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c @@ -35,7 +35,7 @@ #define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID) #define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM) -static void __init iounit_iommu_init(struct of_device *op) +static void __init iounit_iommu_init(struct platform_device *op) { struct iounit_struct *iounit; iopte_t *xpt, *xptend; @@ -74,7 +74,7 @@ static int __init iounit_init(void) struct device_node *dp; for_each_node_by_name(dp, "sbi") { - struct of_device *op = of_find_device_by_node(dp); + struct platform_device *op = of_find_device_by_node(dp); iounit_iommu_init(op); of_propagate_archdata(op); diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 0e8ae298b3c3..07fc6a65d9b6 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c @@ -56,7 +56,7 @@ static pgprot_t dvma_prot; /* Consistent mapping pte flags */ #define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID) #define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ) -static void __init sbus_iommu_init(struct of_device *op) +static void __init sbus_iommu_init(struct platform_device *op) { struct iommu_struct *iommu; unsigned int impl, vers; @@ -132,7 +132,7 @@ static int __init iommu_init(void) struct device_node *dp; for_each_node_by_name(dp, "iommu") { - struct of_device *op = of_find_device_by_node(dp); + struct platform_device *op = of_find_device_by_node(dp); sbus_iommu_init(op); of_propagate_archdata(op); |