powerpc/ptrace: Fix bug in signal handling
In some cases during a threaded core dump not all the threads will have a full register set. This will cause problems when the sigkill is sent to the thread Signed-off-by: Mike Wolf --- --- ptrace-signal.orig/arch/powerpc/kernel/ptrace.c 2011-02-20 12:15:57.0 -0600 +++ ptrace-signal/arch/powerpc/kernel/ptrace.c 2011-02-21 12:39:17.0 -0600 @@ -234,11 +234,23 @@ if (target->thread.regs == NULL) return -EIO; - CHECK_FULL_REGS(target->thread.regs); - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - target->thread.regs, - 0, offsetof(struct pt_regs, msr)); + if (!FULL_REGS(target->thread.regs)) { + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, + target->thread.regs, + 0, sizeof(long)*PT_R14); + if (!ret) + ret = user_regset_copyout_poison(&pos, &count, &kbuf, &ubuf, + sizeof(long)*PT_R14, offsetof(struct pt_regs, nip)); + if (!ret) + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, + target->thread.regs, + offsetof(struct pt_regs, nip), offsetof(struct pt_regs, msr)); + + } else + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, + target->thread.regs, + 0, offsetof(struct pt_regs, msr)); if (!ret) { unsigned long msr = get_user_msr(target); ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &msr, @@ -645,11 +657,24 @@ if (target->thread.regs == NULL) return -EIO; - CHECK_FULL_REGS(target->thread.regs); - pos /= sizeof(reg); count /= sizeof(reg); + if(!FULL_REGS(target->thread.regs)) { + if (kbuf) { + for (; count > 0 && pos < PT_R14; --count) + *k++ = regs[pos++]; + for (; count > 0 && pos < PT_R31; --count,pos++) + *k++ = 0xdeadbeef; + } else { + for (; count > 0 && pos < PT_R14; --count) + if (__put_user((compat_ulong_t) regs[pos++], u++)) + return -EFAULT; + for (; count > 0 && pos < PT_R31; --count,pos++) + if (__put_user((compat_ulong_t) 0xdeadbeef, u++)) + return -EFAULT; + } + } if (kbuf) for (; count > 0 && pos < PT_MSR; --count) *k++ = regs[pos++]; --- ptrace-signal.orig/include/linux/regset.h 2011-02-20 12:15:57.0 -0600 +++ ptrace-signal/include/linux/regset.h2011-02-21 12:39:17.0 -0600 @@ -240,6 +240,32 @@ } return 0; } +static inline int user_regset_copyout_poison(unsigned int *pos, + unsigned int *count, + void **kbuf, void __user **ubuf, + const int start_pos, + const int end_pos) +{ + long poison_data[17] = { [0 ... 16] = 0xdeadbeefdeadbeefUL }; + + if (*count == 0) + return 0; + BUG_ON(*pos < start_pos); + if (end_pos < 0 || *pos < end_pos) { + unsigned int copy = (end_pos < 0 ? *count +: min(*count, end_pos - *pos)); + if (*kbuf) { + memset(*kbuf, 0xdeadbeef, copy); + *kbuf += copy; + } else if (__copy_to_user(*ubuf,poison_data, copy)) + return -EFAULT; + else + *ubuf += copy; + *pos += copy; + *count -= copy; + } + return 0; +} static inline int user_regset_copyin(unsigned int *pos, unsigned int *count, const void **kbuf, ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 00/15] Remove last remains of of_platform_bus_type
This series finally removes all the remaining users of the of_platform_{,un}register_driver() functions that used to be sued with the of_platform_bus_type. All the cool kids are using the platform bus now. At the end of this series the ugly stop-gap shim code is finally removed. g. --- Grant Likely (15): dt/powerpc: move of_bus_type infrastructure to ibmebus dt: add a match table pointer to struct device dt/powerpc: Eliminate users of of_platform_{,un}register_driver dt/sparc: Eliminate users of of_platform_{,un}register_driver leds/leds-gpio: merge platform_driver with of_platform_driver dt: xilinx_hwicap: merge platform and of_platform driver bindings dt: uartlite: merge platform and of_platform driver bindings dt/spi: Eliminate users of of_platform_{,un}register_driver dt/sound: Eliminate users of of_platform_{,un}register_driver dt/net: Eliminate users of of_platform_{,un}register_driver dt/video: Eliminate users of of_platform_{,un}register_driver dt/usb: Eliminate users of of_platform_{,un}register_driver dt/serial: Eliminate users of of_platform_{,un}register_driver dt: Eliminate of_platform_{,un}register_driver dt: eliminate of_platform_driver shim code arch/powerpc/kernel/ibmebus.c | 404 ++ arch/powerpc/kernel/of_platform.c |7 arch/powerpc/platforms/52xx/mpc52xx_gpio.c| 14 - arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 10 - arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 11 - arch/powerpc/platforms/82xx/ep8248e.c |7 arch/powerpc/platforms/83xx/suspend.c | 14 - arch/powerpc/platforms/cell/axon_msi.c| 11 - arch/powerpc/platforms/pasemi/gpio_mdio.c |9 arch/powerpc/sysdev/axonram.c | 11 - arch/powerpc/sysdev/bestcomm/bestcomm.c |9 arch/powerpc/sysdev/fsl_85xx_l2ctlr.c |9 arch/powerpc/sysdev/fsl_msi.c | 13 - arch/powerpc/sysdev/fsl_pmc.c |7 arch/powerpc/sysdev/fsl_rio.c |7 arch/powerpc/sysdev/pmi.c |9 arch/powerpc/sysdev/qe_lib/qe.c |7 arch/sparc/include/asm/parport.h |6 arch/sparc/kernel/apc.c |7 arch/sparc/kernel/auxio_64.c |7 arch/sparc/kernel/central.c | 14 - arch/sparc/kernel/chmc.c | 19 - arch/sparc/kernel/pci_fire.c |7 arch/sparc/kernel/pci_psycho.c|7 arch/sparc/kernel/pci_sabre.c |9 arch/sparc/kernel/pci_schizo.c| 11 - arch/sparc/kernel/pci_sun4v.c |7 arch/sparc/kernel/pmc.c |7 arch/sparc/kernel/power.c |6 arch/sparc/kernel/time_32.c |6 arch/sparc/kernel/time_64.c | 18 - drivers/ata/pata_mpc52xx.c|8 drivers/ata/pata_of_platform.c|9 drivers/ata/sata_dwc_460ex.c |9 drivers/ata/sata_fsl.c|9 drivers/atm/fore200e.c| 17 + drivers/block/xsysace.c | 11 - drivers/char/hw_random/n2-drv.c | 16 - drivers/char/hw_random/pasemi-rng.c |9 drivers/char/ipmi/ipmi_si_intf.c | 18 + drivers/char/xilinx_hwicap/xilinx_hwicap.c| 129 +++ drivers/crypto/amcc/crypto4xx_core.c |9 drivers/crypto/n2_core.c | 20 - drivers/crypto/talitos.c |9 drivers/dma/fsldma.c | 14 - drivers/dma/mpc512x_dma.c |9 drivers/dma/ppc4xx/adma.c | 11 - drivers/edac/mpc85xx_edac.c | 27 + drivers/edac/ppc4xx_edac.c| 23 - drivers/hwmon/ultra45_env.c |9 drivers/i2c/busses/i2c-cpm.c |9 drivers/i2c/busses/i2c-ibm_iic.c |9 drivers/i2c/busses/i2c-mpc.c | 22 - drivers/input/misc/sparcspkr.c| 22 + drivers/input/serio/i8042-sparcio.h |8 drivers/input/serio/xilinx_ps2.c |9 drivers/leds/leds-gpio.c | 206 +-- drivers/macintosh/smu.c |7 drivers/macintosh/therm_pm72.c|8 drivers/macintosh/therm_windtunnel.c |9 drivers/media/video/fsl-viu.c |9 drivers/mmc/host/sdhci-of-core.c | 12 - drivers/mtd/maps/physmap_of.c | 15 - drivers/mtd/maps/sun_uflash.c |8 drivers/mtd/nand/fsl_upm.c|9 drivers/mtd/nand/mpc5121_nfc.c|9 drivers/mtd/nand/ndfc.c
[RFC PATCH 01/15] dt/powerpc: move of_bus_type infrastructure to ibmebus
arch/powerpc/kernel/ibmebus.c is the only remaining user of the of_bus_type support code for initializing the bus and registering drivers. All others have either been switched to the vanilla platform bus or already have their own infrastructure. This patch moves the functionality that ibmebus is using out of drivers/of/{platform,device}.c and into ibmebus.c where it is actually used. Also renames the moved symbols from of_platform_* to ibmebus_bus_* to reflect the actual usage. This patch is part of moving all of the of_platform_bus_type users over to the platform_bus_type. Signed-off-by: Grant Likely --- arch/powerpc/kernel/ibmebus.c | 404 + drivers/of/device.c | 34 --- drivers/of/platform.c | 393 include/linux/of_platform.h |6 - 4 files changed, 400 insertions(+), 437 deletions(-) diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index f62efdf..c00d4ca 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c @@ -201,13 +201,14 @@ int ibmebus_register_driver(struct of_platform_driver *drv) /* If the driver uses devices that ibmebus doesn't know, add them */ ibmebus_create_devices(drv->driver.of_match_table); - return of_register_driver(drv, &ibmebus_bus_type); + drv->driver.bus = &ibmebus_bus_type; + return driver_register(&drv->driver); } EXPORT_SYMBOL(ibmebus_register_driver); void ibmebus_unregister_driver(struct of_platform_driver *drv) { - of_unregister_driver(drv); + driver_unregister(&drv->driver); } EXPORT_SYMBOL(ibmebus_unregister_driver); @@ -308,15 +309,410 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus, } } + static struct bus_attribute ibmebus_bus_attrs[] = { __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe), __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove), __ATTR_NULL }; +static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv) +{ + const struct of_device_id *matches = drv->of_match_table; + + if (!matches) + return 0; + + return of_match_device(matches, dev) != NULL; +} + +static int ibmebus_bus_device_probe(struct device *dev) +{ + int error = -ENODEV; + struct of_platform_driver *drv; + struct platform_device *of_dev; + const struct of_device_id *match; + + drv = to_of_platform_driver(dev->driver); + of_dev = to_platform_device(dev); + + if (!drv->probe) + return error; + + of_dev_get(of_dev); + + match = of_match_device(drv->driver.of_match_table, dev); + if (match) + error = drv->probe(of_dev, match); + if (error) + of_dev_put(of_dev); + + return error; +} + +static int ibmebus_bus_device_remove(struct device *dev) +{ + struct platform_device *of_dev = to_platform_device(dev); + struct of_platform_driver *drv = to_of_platform_driver(dev->driver); + + if (dev->driver && drv->remove) + drv->remove(of_dev); + return 0; +} + +static void ibmebus_bus_device_shutdown(struct device *dev) +{ + struct platform_device *of_dev = to_platform_device(dev); + struct of_platform_driver *drv = to_of_platform_driver(dev->driver); + + if (dev->driver && drv->shutdown) + drv->shutdown(of_dev); +} + +/* + * ibmebus_bus_device_attrs + */ +static ssize_t devspec_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct platform_device *ofdev; + + ofdev = to_platform_device(dev); + return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name); +} + +static ssize_t name_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct platform_device *ofdev; + + ofdev = to_platform_device(dev); + return sprintf(buf, "%s\n", ofdev->dev.of_node->name); +} + +static ssize_t modalias_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + ssize_t len = of_device_get_modalias(dev, buf, PAGE_SIZE - 2); + buf[len] = '\n'; + buf[len+1] = 0; + return len+1; +} + +struct device_attribute ibmebus_bus_device_attrs[] = { + __ATTR_RO(devspec), + __ATTR_RO(name), + __ATTR_RO(modalias), + __ATTR_NULL +}; + +#ifdef CONFIG_PM_SLEEP +static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg) +{ + struct platform_device *of_dev = to_platform_device(dev); + struct of_platform_driver *drv = to_of_platform_driver(dev->driver); + int ret = 0; + + if (dev->driver && drv->suspend) + ret = drv->suspend(of_dev, mesg); + return ret; +} + +static int ibmebus_bus_legacy_resume(struct device *dev) +{ + struct platform_device *of_dev = to_pla
[RFC PATCH 02/15] dt: add a match table pointer to struct device
Add a new .of_match field to struct device which points at the matching device driver .of_match_table entry when a device is probed via the device tree Signed-off-by: Grant Likely --- include/linux/device.h|1 + include/linux/of_device.h |5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/device.h b/include/linux/device.h index ca5d252..8d8e267 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -441,6 +441,7 @@ struct device { struct dev_archdata archdata; struct device_node *of_node; /* associated device tree node */ + const struct of_device_id *of_match; /* matching of_device_id from driver */ dev_t devt; /* dev_t, creates the sysfs "dev" */ diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 975d347..8bfe6c1 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev); * @drv: the device_driver structure to test * @dev: the device structure to match against */ -static inline int of_driver_match_device(const struct device *dev, +static inline int of_driver_match_device(struct device *dev, const struct device_driver *drv) { - return of_match_device(drv->of_match_table, dev) != NULL; + dev->of_match = of_match_device(drv->of_match_table, dev); + return dev->of_match != NULL; } extern struct platform_device *of_dev_get(struct platform_device *dev); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 03/15] dt/powerpc: Eliminate users of of_platform_{, un}register_driver
Get rid of old users of of_platform_driver in arch/powerpc. Most of_platform_driver users can be converted to use the platform_bus directly. Signed-off-by: Grant Likely --- arch/powerpc/kernel/of_platform.c |7 +++--- arch/powerpc/platforms/52xx/mpc52xx_gpio.c| 14 ++--- arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 10 +++-- arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c | 11 -- arch/powerpc/platforms/82xx/ep8248e.c |7 +++--- arch/powerpc/platforms/83xx/suspend.c | 14 - arch/powerpc/platforms/cell/axon_msi.c| 11 -- arch/powerpc/platforms/pasemi/gpio_mdio.c |9 arch/powerpc/sysdev/axonram.c | 11 +- arch/powerpc/sysdev/bestcomm/bestcomm.c |9 arch/powerpc/sysdev/fsl_85xx_l2ctlr.c |9 arch/powerpc/sysdev/fsl_msi.c | 13 +++- arch/powerpc/sysdev/fsl_pmc.c |7 +++--- arch/powerpc/sysdev/fsl_rio.c |7 +++--- arch/powerpc/sysdev/pmi.c |9 arch/powerpc/sysdev/qe_lib/qe.c |7 +++--- drivers/char/hw_random/pasemi-rng.c |9 drivers/crypto/amcc/crypto4xx_core.c |9 drivers/dma/fsldma.c | 14 +++-- drivers/dma/mpc512x_dma.c |9 drivers/dma/ppc4xx/adma.c | 11 +- drivers/edac/mpc85xx_edac.c | 27 +++-- drivers/edac/ppc4xx_edac.c| 23 ++--- drivers/macintosh/smu.c |7 +++--- drivers/macintosh/therm_pm72.c|8 --- drivers/macintosh/therm_windtunnel.c |9 26 files changed, 120 insertions(+), 161 deletions(-) diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index 9bd951c..2458218 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c @@ -36,8 +36,7 @@ * lacking some bits needed here. */ -static int __devinit of_pci_phb_probe(struct platform_device *dev, - const struct of_device_id *match) +static int __devinit of_pci_phb_probe(struct platform_device *dev) { struct pci_controller *phb; @@ -104,7 +103,7 @@ static struct of_device_id of_pci_phb_ids[] = { {} }; -static struct of_platform_driver of_pci_phb_driver = { +static struct platform_driver of_pci_phb_driver = { .probe = of_pci_phb_probe, .driver = { .name = "of-pci", @@ -115,7 +114,7 @@ static struct of_platform_driver of_pci_phb_driver = { static __init int of_pci_phb_init(void) { - return of_register_platform_driver(&of_pci_phb_driver); + return platform_driver_register(&of_pci_phb_driver); } device_initcall(of_pci_phb_init); diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c index 0dad9a9..1757d1d 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c @@ -147,8 +147,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) return 0; } -static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev, - const struct of_device_id *match) +static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev) { struct mpc52xx_gpiochip *chip; struct mpc52xx_gpio_wkup __iomem *regs; @@ -191,7 +190,7 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = { {} }; -static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = { +static struct platform_driver mpc52xx_wkup_gpiochip_driver = { .driver = { .name = "gpio_wkup", .owner = THIS_MODULE, @@ -310,8 +309,7 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) return 0; } -static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev, - const struct of_device_id *match) +static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev) { struct mpc52xx_gpiochip *chip; struct gpio_chip *gc; @@ -349,7 +347,7 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = { {} }; -static struct of_platform_driver mpc52xx_simple_gpiochip_driver = { +static struct platform_driver mpc52xx_simple_gpiochip_driver = { .driver = { .name = "gpio", .owner = THIS_MODULE, @@ -361,10 +359,10 @@ static struct of_platform_driver mpc52xx_simple_gpiochip_driver = { static int __init mpc52xx_gpio_init(void) { - if (of_register_platform_driver(&mpc52xx_wkup_gpiochip_driver)) + if (platform_drive
[RFC PATCH 04/15] dt/sparc: Eliminate users of of_platform_{, un}register_driver
Get rid of old users of of_platform_driver in arch/sparc. Most of_platform_driver users can be converted to use the platform_bus directly. Signed-off-by: Grant Likely --- arch/sparc/include/asm/parport.h|6 +++--- arch/sparc/kernel/apc.c |7 +++ arch/sparc/kernel/auxio_64.c|7 +++ arch/sparc/kernel/central.c | 14 ++ arch/sparc/kernel/chmc.c| 19 --- arch/sparc/kernel/pci_fire.c|7 +++ arch/sparc/kernel/pci_psycho.c |7 +++ arch/sparc/kernel/pci_sabre.c |9 - arch/sparc/kernel/pci_schizo.c | 11 ++- arch/sparc/kernel/pci_sun4v.c |7 +++ arch/sparc/kernel/pmc.c |7 +++ arch/sparc/kernel/power.c |6 +++--- arch/sparc/kernel/time_32.c |6 +++--- arch/sparc/kernel/time_64.c | 18 +- drivers/char/hw_random/n2-drv.c | 16 +--- drivers/crypto/n2_core.c| 20 +--- drivers/hwmon/ultra45_env.c |9 - drivers/input/misc/sparcspkr.c | 22 ++ drivers/input/serio/i8042-sparcio.h |8 drivers/parport/parport_sunbpp.c|8 drivers/sbus/char/bbc_i2c.c |9 - drivers/sbus/char/display7seg.c |9 - drivers/sbus/char/envctrl.c |9 - drivers/sbus/char/flash.c |9 - drivers/sbus/char/uctrl.c |9 - drivers/scsi/qlogicpti.c| 14 +- drivers/scsi/sun_esp.c |8 27 files changed, 133 insertions(+), 148 deletions(-) diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h index aa4c826..cb33608 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 platform_device *op, const struct of_device_id *match) +static int __devinit ecpp_probe(struct platform_device *op) { unsigned long base = op->resource[0].start; unsigned long config = op->resource[1].start; @@ -235,7 +235,7 @@ static const struct of_device_id ecpp_match[] = { {}, }; -static struct of_platform_driver ecpp_driver = { +static struct platform_driver ecpp_driver = { .driver = { .name = "ecpp", .owner = THIS_MODULE, @@ -247,7 +247,7 @@ static struct of_platform_driver ecpp_driver = { static int parport_pc_find_nonpci_ports(int autoirq, int autodma) { - return of_register_platform_driver(&ecpp_driver); + return platform_driver_register(&ecpp_driver); } #endif /* !(_ASM_SPARC64_PARPORT_H */ diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c index 52de4a9..f679c57 100644 --- a/arch/sparc/kernel/apc.c +++ b/arch/sparc/kernel/apc.c @@ -137,8 +137,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 platform_device *op, - const struct of_device_id *match) +static int __devinit apc_probe(struct platform_device *op) { int err; @@ -174,7 +173,7 @@ static struct of_device_id __initdata apc_match[] = { }; MODULE_DEVICE_TABLE(of, apc_match); -static struct of_platform_driver apc_driver = { +static struct platform_driver apc_driver = { .driver = { .name = "apc", .owner = THIS_MODULE, @@ -185,7 +184,7 @@ static struct of_platform_driver apc_driver = { static int __init apc_init(void) { - return of_register_platform_driver(&apc_driver); + return platform_driver_register(&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 3efd3c5..2abace0 100644 --- a/arch/sparc/kernel/auxio_64.c +++ b/arch/sparc/kernel/auxio_64.c @@ -102,8 +102,7 @@ static struct of_device_id __initdata auxio_match[] = { MODULE_DEVICE_TABLE(of, auxio_match); -static int __devinit auxio_probe(struct platform_device *dev, -const struct of_device_id *match) +static int __devinit auxio_probe(struct platform_device *dev) { struct device_node *dp = dev->dev.of_node; unsigned long size; @@ -132,7 +131,7 @@ static int __devinit auxio_probe(struct platform_device *dev, return 0; } -static struct of_platform_driver auxio_driver = { +static struct platform_driver auxio_driver = { .probe = auxio_probe, .driver = { .name = "auxio", @@ -143,7 +142,7 @@ static struct of_platform_driver auxio_driver = { static int __init auxio_init(void) { - return of_register_pla
[RFC PATCH 05/15] leds/leds-gpio: merge platform_driver with of_platform_driver
Both interfaces can be driven with the same driver, and of_platform_driver is getting removed. This patch merges the two driver registrations. Signed-off-by: Grant Likely --- drivers/leds/leds-gpio.c | 206 +++--- 1 files changed, 83 insertions(+), 123 deletions(-) diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 4d9fa38..c4efece 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include @@ -151,96 +153,34 @@ static void delete_gpio_led(struct gpio_led_data *led) gpio_free(led->gpio); } -#ifdef CONFIG_LEDS_GPIO_PLATFORM -static int __devinit gpio_led_probe(struct platform_device *pdev) -{ - struct gpio_led_platform_data *pdata = pdev->dev.platform_data; - struct gpio_led_data *leds_data; - int i, ret = 0; - - if (!pdata) - return -EBUSY; - - leds_data = kzalloc(sizeof(struct gpio_led_data) * pdata->num_leds, - GFP_KERNEL); - if (!leds_data) - return -ENOMEM; - - for (i = 0; i < pdata->num_leds; i++) { - ret = create_gpio_led(&pdata->leds[i], &leds_data[i], - &pdev->dev, pdata->gpio_blink_set); - if (ret < 0) - goto err; - } - - platform_set_drvdata(pdev, leds_data); - - return 0; - -err: - for (i = i - 1; i >= 0; i--) - delete_gpio_led(&leds_data[i]); - - kfree(leds_data); - - return ret; -} +struct gpio_leds_priv { + int num_leds; + struct gpio_led_data leds[]; +}; -static int __devexit gpio_led_remove(struct platform_device *pdev) +static inline int sizeof_gpio_leds_priv(int num_leds) { - int i; - struct gpio_led_platform_data *pdata = pdev->dev.platform_data; - struct gpio_led_data *leds_data; - - leds_data = platform_get_drvdata(pdev); - - for (i = 0; i < pdata->num_leds; i++) - delete_gpio_led(&leds_data[i]); - - kfree(leds_data); - - return 0; + return sizeof(struct gpio_leds_priv) + + (sizeof(struct gpio_led_data) * num_leds); } -static struct platform_driver gpio_led_driver = { - .probe = gpio_led_probe, - .remove = __devexit_p(gpio_led_remove), - .driver = { - .name = "leds-gpio", - .owner = THIS_MODULE, - }, -}; - -MODULE_ALIAS("platform:leds-gpio"); -#endif /* CONFIG_LEDS_GPIO_PLATFORM */ - /* Code to create from OpenFirmware platform devices */ #ifdef CONFIG_LEDS_GPIO_OF -#include -#include - -struct gpio_led_of_platform_data { - int num_leds; - struct gpio_led_data led_data[]; -}; - -static int __devinit of_gpio_leds_probe(struct platform_device *ofdev, - const struct of_device_id *match) +static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) { struct device_node *np = ofdev->dev.of_node, *child; - struct gpio_led_of_platform_data *pdata; + struct gpio_leds_priv *priv; int count = 0, ret; - /* count LEDs defined by this device, so we know how much to allocate */ + /* count LEDs in this device, so we know how much to allocate */ for_each_child_of_node(np, child) count++; if (!count) - return 0; /* or ENODEV? */ + return NULL; - pdata = kzalloc(sizeof(*pdata) + sizeof(struct gpio_led_data) * count, - GFP_KERNEL); - if (!pdata) - return -ENOMEM; + priv = kzalloc(sizeof_gpio_leds_priv(count), GFP_KERNEL); + if (!priv) + return NULL; for_each_child_of_node(np, child) { struct gpio_led led = {}; @@ -256,13 +196,13 @@ static int __devinit of_gpio_leds_probe(struct platform_device *ofdev, if (state) { if (!strcmp(state, "keep")) led.default_state = LEDS_GPIO_DEFSTATE_KEEP; - else if(!strcmp(state, "on")) + else if (!strcmp(state, "on")) led.default_state = LEDS_GPIO_DEFSTATE_ON; else led.default_state = LEDS_GPIO_DEFSTATE_OFF; } - ret = create_gpio_led(&led, &pdata->led_data[pdata->num_leds++], + ret = create_gpio_led(&led, &priv->leds[priv->num_leds++], &ofdev->dev, NULL); if (ret < 0) { of_node_put(child); @@ -270,78 +210,98 @@ static int __devinit of_gpio_leds_probe(struct platform_device *ofdev, } } - dev_set_drvdata(&ofdev->dev, pdata); - - return 0; + return priv;
[RFC PATCH 06/15] dt: xilinx_hwicap: merge platform and of_platform driver bindings
of_platform_driver is getting removed, and a single platform_driver can now support both devicetree and non-devicetree use cases. This patch merges the two driver registrations. Signed-off-by: Grant Likely --- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 129 +++- 1 files changed, 49 insertions(+), 80 deletions(-) diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 9f2272e..a55e877 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -714,20 +714,29 @@ static int __devexit hwicap_remove(struct device *dev) return 0; /* success */ } -static int __devinit hwicap_drv_probe(struct platform_device *pdev) +#ifdef CONFIG_OF +static int __devinit hwicap_of_probe(struct platform_device *op) { - struct resource *res; - const struct config_registers *regs; + struct resource res; + const unsigned int *id; const char *family; + int rc; + const struct hwicap_driver_config *config = op->dev.of_match->data; + const struct config_registers *regs; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; + + rc = of_address_to_resource(op->dev.of_node, 0, &res); + if (rc) { + dev_err(&op->dev, "invalid address\n"); + return rc; + } + + id = of_get_property(op->dev.of_node, "port-number", NULL); /* It's most likely that we're using V4, if the family is not specified */ regs = &v4_config_registers; - family = pdev->dev.platform_data; + family = of_get_property(op->dev.of_node, "xlnx,family", NULL); if (family) { if (!strcmp(family, "virtex2p")) { @@ -738,54 +747,33 @@ static int __devinit hwicap_drv_probe(struct platform_device *pdev) regs = &v5_config_registers; } } - - return hwicap_setup(&pdev->dev, pdev->id, res, - &buffer_icap_config, regs); + return hwicap_setup(&op->dev, id ? *id : -1, &res, config, + regs); } - -static int __devexit hwicap_drv_remove(struct platform_device *pdev) +#else +static inline int hwicap_of_probe(struct platform_device *op) { - return hwicap_remove(&pdev->dev); + return -EINVAL; } +#endif /* CONFIG_OF */ -static struct platform_driver hwicap_platform_driver = { - .probe = hwicap_drv_probe, - .remove = hwicap_drv_remove, - .driver = { - .owner = THIS_MODULE, - .name = DRIVER_NAME, - }, -}; - -/* - - * OF bus binding - */ - -#if defined(CONFIG_OF) -static int __devinit -hwicap_of_probe(struct platform_device *op, const struct of_device_id *match) +static int __devinit hwicap_drv_probe(struct platform_device *pdev) { - struct resource res; - const unsigned int *id; - const char *family; - int rc; - const struct hwicap_driver_config *config = match->data; + struct resource *res; const struct config_registers *regs; + const char *family; - dev_dbg(&op->dev, "hwicap_of_probe(%p, %p)\n", op, match); - - rc = of_address_to_resource(op->dev.of_node, 0, &res); - if (rc) { - dev_err(&op->dev, "invalid address\n"); - return rc; - } + if (pdev->dev.of_match) + return hwicap_of_probe(pdev); - id = of_get_property(op->dev.of_node, "port-number", NULL); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; /* It's most likely that we're using V4, if the family is not specified */ regs = &v4_config_registers; - family = of_get_property(op->dev.of_node, "xlnx,family", NULL); + family = pdev->dev.platform_data; if (family) { if (!strcmp(family, "virtex2p")) { @@ -796,15 +784,17 @@ hwicap_of_probe(struct platform_device *op, const struct of_device_id *match) regs = &v5_config_registers; } } - return hwicap_setup(&op->dev, id ? *id : -1, &res, config, - regs); + + return hwicap_setup(&pdev->dev, pdev->id, res, + &buffer_icap_config, regs); } -static int __devexit hwicap_of_remove(struct platform_device *op) +static int __devexit hwicap_drv_remove(struct platform_device *pdev) { - return hwicap_remove(&op->dev); + return hwicap_remove(&pdev->dev); } +#ifdef CONFIG_OF /* Match table for of_platform binding */ static const struct of_device_id __devinitconst hwicap_of_match[] = { { .compatible = "xlnx,opb-hwicap-1.00.b", .data = &buffer_icap_config}, @@ -812,33 +802,23 @@ static const struct of_device_id __devin
[RFC PATCH 07/15] dt: uartlite: merge platform and of_platform driver bindings
of_platform_driver is getting removed, and a single platform_driver can now support both devicetree and non-devicetree use cases. This patch merges the two driver registrations. Signed-off-by: Grant Likely --- drivers/tty/serial/uartlite.c | 103 ++--- 1 files changed, 24 insertions(+), 79 deletions(-) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index d2fce86..457ac34 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -19,22 +19,11 @@ #include #include #include -#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE)) #include #include #include #include -/* Match table for of_platform binding */ -static struct of_device_id ulite_of_match[] __devinitdata = { - { .compatible = "xlnx,opb-uartlite-1.00.b", }, - { .compatible = "xlnx,xps-uartlite-1.00.a", }, - {} -}; -MODULE_DEVICE_TABLE(of, ulite_of_match); - -#endif - #define ULITE_NAME "ttyUL" #define ULITE_MAJOR204 #define ULITE_MINOR187 @@ -571,9 +560,23 @@ static int __devexit ulite_release(struct device *dev) * Platform bus binding */ +#if defined(CONFIG_OF) +/* Match table for of_platform binding */ +static struct of_device_id ulite_of_match[] __devinitdata = { + { .compatible = "xlnx,opb-uartlite-1.00.b", }, + { .compatible = "xlnx,xps-uartlite-1.00.a", }, + {} +}; +MODULE_DEVICE_TABLE(of, ulite_of_match); +#else /* CONFIG_OF */ +#define ulite_of_match NULL +#endif /* CONFIG_OF */ + static int __devinit ulite_probe(struct platform_device *pdev) { struct resource *res, *res2; + const __be32 *prop; + int id = pdev->id; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) @@ -583,7 +586,13 @@ static int __devinit ulite_probe(struct platform_device *pdev) if (!res2) return -ENODEV; - return ulite_assign(&pdev->dev, pdev->id, res->start, res2->start); +#ifdef CONFIG_OF + prop = of_get_property(pdev->dev.of_node, "port-number", NULL); + if (prop) + id = be32_to_cpup(prop); +#endif + + return ulite_assign(&pdev->dev, id, res->start, res2->start); } static int __devexit ulite_remove(struct platform_device *pdev) @@ -595,72 +604,15 @@ static int __devexit ulite_remove(struct platform_device *pdev) MODULE_ALIAS("platform:uartlite"); static struct platform_driver ulite_platform_driver = { - .probe = ulite_probe, - .remove = __devexit_p(ulite_remove), - .driver = { - .owner = THIS_MODULE, - .name = "uartlite", - }, -}; - -/* - - * OF bus bindings - */ -#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE)) -static int __devinit -ulite_of_probe(struct platform_device *op, const struct of_device_id *match) -{ - struct resource res; - const unsigned int *id; - int irq, rc; - - dev_dbg(&op->dev, "%s(%p, %p)\n", __func__, op, match); - - rc = of_address_to_resource(op->dev.of_node, 0, &res); - if (rc) { - dev_err(&op->dev, "invalid address\n"); - return rc; - } - - irq = irq_of_parse_and_map(op->dev.of_node, 0); - - id = of_get_property(op->dev.of_node, "port-number", NULL); - - return ulite_assign(&op->dev, id ? *id : -1, res.start, irq); -} - -static int __devexit ulite_of_remove(struct platform_device *op) -{ - return ulite_release(&op->dev); -} - -static struct of_platform_driver ulite_of_driver = { - .probe = ulite_of_probe, - .remove = __devexit_p(ulite_of_remove), + .probe = ulite_probe, + .remove = __devexit_p(ulite_remove), .driver = { - .name = "uartlite", .owner = THIS_MODULE, + .name = "uartlite", .of_match_table = ulite_of_match, }, }; -/* Registration helpers to keep the number of #ifdefs to a minimum */ -static inline int __init ulite_of_register(void) -{ - pr_debug("uartlite: calling of_register_platform_driver()\n"); - return of_register_platform_driver(&ulite_of_driver); -} - -static inline void __exit ulite_of_unregister(void) -{ - of_unregister_platform_driver(&ulite_of_driver); -} -#else /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */ -/* Appropriate config not enabled; do nothing helpers */ -static inline int __init ulite_of_register(void) { return 0; } -static inline void __exit ulite_of_unregister(void) { } -#endif /* CONFIG_OF && (CONFIG_PPC32 || CONFIG_MICROBLAZE) */ - /* - * Module setup/teardown */ @@ -674,10 +626,6 @@ int __init ulite_init(void) if (ret) goto err_uart; - ret = ulite_of_register(); - if (ret) -
[RFC PATCH 08/15] dt/spi: Eliminate users of of_platform_{, un}register_driver
Get rid of users of of_platform_driver in drivers/spi. The of_platform_{,un}register_driver functions are going away, so the users need to be converted to using the platform_bus_type directly. Signed-off-by: Grant Likely --- drivers/spi/mpc512x_psc_spi.c |9 - drivers/spi/mpc52xx_psc_spi.c |9 - drivers/spi/mpc52xx_spi.c |9 - drivers/spi/spi_fsl_espi.c| 11 +-- drivers/spi/spi_fsl_lib.c |3 +-- drivers/spi/spi_fsl_lib.h |3 +-- drivers/spi/spi_fsl_spi.c | 11 +-- drivers/spi/spi_ppc4xx.c |9 - 8 files changed, 28 insertions(+), 36 deletions(-) diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/mpc512x_psc_spi.c index 77d9e7e..6a5b423 100644 --- a/drivers/spi/mpc512x_psc_spi.c +++ b/drivers/spi/mpc512x_psc_spi.c @@ -507,8 +507,7 @@ static int __devexit mpc512x_psc_spi_do_remove(struct device *dev) return 0; } -static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op, - const struct of_device_id *match) +static int __devinit mpc512x_psc_spi_of_probe(struct platform_device *op) { const u32 *regaddr_p; u64 regaddr64, size64; @@ -551,7 +550,7 @@ static struct of_device_id mpc512x_psc_spi_of_match[] = { MODULE_DEVICE_TABLE(of, mpc512x_psc_spi_of_match); -static struct of_platform_driver mpc512x_psc_spi_of_driver = { +static struct platform_driver mpc512x_psc_spi_of_driver = { .probe = mpc512x_psc_spi_of_probe, .remove = __devexit_p(mpc512x_psc_spi_of_remove), .driver = { @@ -563,13 +562,13 @@ static struct of_platform_driver mpc512x_psc_spi_of_driver = { static int __init mpc512x_psc_spi_init(void) { - return of_register_platform_driver(&mpc512x_psc_spi_of_driver); + return platform_driver_register(&mpc512x_psc_spi_of_driver); } module_init(mpc512x_psc_spi_init); static void __exit mpc512x_psc_spi_exit(void) { - of_unregister_platform_driver(&mpc512x_psc_spi_of_driver); + platform_driver_unregister(&mpc512x_psc_spi_of_driver); } module_exit(mpc512x_psc_spi_exit); diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 8a904c1..e30baf0 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c @@ -450,8 +450,7 @@ free_master: return ret; } -static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op, - const struct of_device_id *match) +static int __devinit mpc52xx_psc_spi_of_probe(struct platform_device *op) { const u32 *regaddr_p; u64 regaddr64, size64; @@ -503,7 +502,7 @@ static const struct of_device_id mpc52xx_psc_spi_of_match[] = { MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match); -static struct of_platform_driver mpc52xx_psc_spi_of_driver = { +static struct platform_driver mpc52xx_psc_spi_of_driver = { .probe = mpc52xx_psc_spi_of_probe, .remove = __devexit_p(mpc52xx_psc_spi_of_remove), .driver = { @@ -515,13 +514,13 @@ static struct of_platform_driver mpc52xx_psc_spi_of_driver = { static int __init mpc52xx_psc_spi_init(void) { - return of_register_platform_driver(&mpc52xx_psc_spi_of_driver); + return platform_driver_register(&mpc52xx_psc_spi_of_driver); } module_init(mpc52xx_psc_spi_init); static void __exit mpc52xx_psc_spi_exit(void) { - of_unregister_platform_driver(&mpc52xx_psc_spi_of_driver); + platform_driver_unregister(&mpc52xx_psc_spi_of_driver); } module_exit(mpc52xx_psc_spi_exit); diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 84439f6..015a974 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c @@ -390,8 +390,7 @@ static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m) /* * OF Platform Bus Binding */ -static int __devinit mpc52xx_spi_probe(struct platform_device *op, - const struct of_device_id *match) +static int __devinit mpc52xx_spi_probe(struct platform_device *op) { struct spi_master *master; struct mpc52xx_spi *ms; @@ -556,7 +555,7 @@ static const struct of_device_id mpc52xx_spi_match[] __devinitconst = { }; MODULE_DEVICE_TABLE(of, mpc52xx_spi_match); -static struct of_platform_driver mpc52xx_spi_of_driver = { +static struct platform_driver mpc52xx_spi_of_driver = { .driver = { .name = "mpc52xx-spi", .owner = THIS_MODULE, @@ -568,13 +567,13 @@ static struct of_platform_driver mpc52xx_spi_of_driver = { static int __init mpc52xx_spi_init(void) { - return of_register_platform_driver(&mpc52xx_spi_of_driver); + return platform_driver_register(&mpc52xx_spi_of_driver); } module_init(mpc52xx_spi_init); static void __exit mpc52xx_spi_exit(void) { - of_unregister_platform_driver(&mpc52xx_spi_of_driver); + platform_driver_unregister(&mpc52xx_spi_of_driver); } module_exit(mp
[RFC PATCH 09/15] dt/sound: Eliminate users of of_platform_{, un}register_driver
Get rid of users of of_platform_driver in drivers/sound. The of_platform_{,un}register_driver functions are going away, so the users need to be converted to using the platform_bus_type directly. Signed-off-by: Grant Likely --- sound/soc/fsl/fsl_dma.c |9 - sound/soc/fsl/fsl_ssi.c |9 - sound/soc/fsl/mpc5200_dma.c | 24 +++- sound/soc/fsl/mpc5200_psc_ac97.c |9 - sound/soc/fsl/mpc5200_psc_i2s.c |9 - sound/sparc/amd7930.c|8 sound/sparc/cs4231.c | 16 sound/sparc/dbri.c |8 8 files changed, 43 insertions(+), 49 deletions(-) diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index 4cf98c0..15dac0f 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c @@ -896,8 +896,7 @@ static struct snd_pcm_ops fsl_dma_ops = { .pointer= fsl_dma_pointer, }; -static int __devinit fsl_soc_dma_probe(struct platform_device *pdev, - const struct of_device_id *match) +static int __devinit fsl_soc_dma_probe(struct platform_device *pdev) { struct dma_object *dma; struct device_node *np = pdev->dev.of_node; @@ -979,7 +978,7 @@ static const struct of_device_id fsl_soc_dma_ids[] = { }; MODULE_DEVICE_TABLE(of, fsl_soc_dma_ids); -static struct of_platform_driver fsl_soc_dma_driver = { +static struct platform_driver fsl_soc_dma_driver = { .driver = { .name = "fsl-pcm-audio", .owner = THIS_MODULE, @@ -993,12 +992,12 @@ static int __init fsl_soc_dma_init(void) { pr_info("Freescale Elo DMA ASoC PCM Driver\n"); - return of_register_platform_driver(&fsl_soc_dma_driver); + return platform_driver_register(&fsl_soc_dma_driver); } static void __exit fsl_soc_dma_exit(void) { - of_unregister_platform_driver(&fsl_soc_dma_driver); + platform_driver_unregister(&fsl_soc_dma_driver); } module_init(fsl_soc_dma_init); diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 4cc167a..313e0cc 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -624,8 +624,7 @@ static void make_lowercase(char *s) } } -static int __devinit fsl_ssi_probe(struct platform_device *pdev, - const struct of_device_id *match) +static int __devinit fsl_ssi_probe(struct platform_device *pdev) { struct fsl_ssi_private *ssi_private; int ret = 0; @@ -774,7 +773,7 @@ static const struct of_device_id fsl_ssi_ids[] = { }; MODULE_DEVICE_TABLE(of, fsl_ssi_ids); -static struct of_platform_driver fsl_ssi_driver = { +static struct platform_driver fsl_ssi_driver = { .driver = { .name = "fsl-ssi-dai", .owner = THIS_MODULE, @@ -788,12 +787,12 @@ static int __init fsl_ssi_init(void) { printk(KERN_INFO "Freescale Synchronous Serial Interface (SSI) ASoC Driver\n"); - return of_register_platform_driver(&fsl_ssi_driver); + return platform_driver_register(&fsl_ssi_driver); } static void __exit fsl_ssi_exit(void) { - of_unregister_platform_driver(&fsl_ssi_driver); + platform_driver_unregister(&fsl_ssi_driver); } module_init(fsl_ssi_init); diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index f92dca0..fff695c 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c @@ -368,8 +368,7 @@ static struct snd_soc_platform_driver mpc5200_audio_dma_platform = { .pcm_free = &psc_dma_free, }; -static int mpc5200_hpcd_probe(struct of_device *op, - const struct of_device_id *match) +static int mpc5200_hpcd_probe(struct of_device *op) { phys_addr_t fifo; struct psc_dma *psc_dma; @@ -511,32 +510,31 @@ static int mpc5200_hpcd_remove(struct of_device *op) } static struct of_device_id mpc5200_hpcd_match[] = { - { - .compatible = "fsl,mpc5200-pcm", - }, + { .compatible = "fsl,mpc5200-pcm", }, {} }; MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match); -static struct of_platform_driver mpc5200_hpcd_of_driver = { - .owner = THIS_MODULE, - .name = "mpc5200-pcm-audio", - .match_table= mpc5200_hpcd_match, +static struct platform_driver mpc5200_hpcd_of_driver = { .probe = mpc5200_hpcd_probe, .remove = mpc5200_hpcd_remove, + .dev = { + .owner = THIS_MODULE, + .name = "mpc5200-pcm-audio", + .of_match_table= mpc5200_hpcd_match, + } }; static int __init mpc5200_hpcd_init(void) { - return of_register_platform_driver(&mpc5200_hpcd_of_driver); + return platform_driver_register(&mpc5200_hpcd_of_driver); } +module_init(mpc5200_hpcd_init); static void __exit mpc5200_hpcd_exit(void) { - of_unregister_pl
[RFC PATCH 10/15] dt/net: Eliminate users of of_platform_{, un}register_driver
Get rid of users of of_platform_driver in drivers/net. The of_platform_{,un}register_driver functions are going away, so the users need to be converted to using the platform_bus_type directly. Signed-off-by: Grant Likely --- drivers/net/can/mscan/mpc5xxx_can.c | 15 +-- drivers/net/can/sja1000/sja1000_of_platform.c |9 - drivers/net/fec_mpc52xx.c | 13 ++--- drivers/net/fec_mpc52xx.h |2 +- drivers/net/fec_mpc52xx_phy.c |5 ++--- drivers/net/fs_enet/fs_enet-main.c| 16 +--- drivers/net/fs_enet/mii-bitbang.c |9 - drivers/net/fs_enet/mii-fec.c | 15 +-- drivers/net/fsl_pq_mdio.c |9 - drivers/net/gianfar.c | 12 +--- drivers/net/greth.c |8 drivers/net/ibm_newemac/core.c|9 - drivers/net/ibm_newemac/mal.c |9 - drivers/net/ibm_newemac/rgmii.c |9 - drivers/net/ibm_newemac/tah.c |9 - drivers/net/ibm_newemac/zmii.c|9 - drivers/net/ll_temac_main.c |9 - drivers/net/myri_sbus.c |8 drivers/net/niu.c | 11 +-- drivers/net/phy/mdio-gpio.c |9 - drivers/net/sunbmac.c |9 - drivers/net/sunhme.c | 14 +- drivers/net/sunlance.c|8 drivers/net/sunqe.c |8 drivers/net/ucc_geth.c|8 drivers/net/xilinx_emaclite.c |9 - 26 files changed, 123 insertions(+), 128 deletions(-) diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index 312b9c8..c0a1bc5 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -247,10 +247,9 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, } #endif /* CONFIG_PPC_MPC512x */ -static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev, - const struct of_device_id *id) +static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) { - struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data; + struct mpc5xxx_can_data *data; struct device_node *np = ofdev->dev.of_node; struct net_device *dev; struct mscan_priv *priv; @@ -259,6 +258,10 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev, int irq, mscan_clksrc = 0; int err = -ENOMEM; + if (!ofdev->dev.of_match) + return -EINVAL; + data = (struct mpc5xxx_can_data *)of_dev->dev.of_match->data; + base = of_iomap(np, 0); if (!base) { dev_err(&ofdev->dev, "couldn't ioremap\n"); @@ -391,7 +394,7 @@ static struct of_device_id __devinitdata mpc5xxx_can_table[] = { {}, }; -static struct of_platform_driver mpc5xxx_can_driver = { +static struct platform_driver mpc5xxx_can_driver = { .driver = { .name = "mpc5xxx_can", .owner = THIS_MODULE, @@ -407,13 +410,13 @@ static struct of_platform_driver mpc5xxx_can_driver = { static int __init mpc5xxx_can_init(void) { - return of_register_platform_driver(&mpc5xxx_can_driver); + return platform_driver_register(&mpc5xxx_can_driver); } module_init(mpc5xxx_can_init); static void __exit mpc5xxx_can_exit(void) { - return of_unregister_platform_driver(&mpc5xxx_can_driver); + platform_driver_unregister(&mpc5xxx_can_driver); }; module_exit(mpc5xxx_can_exit); diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c index 09c3e9d..9793df6 100644 --- a/drivers/net/can/sja1000/sja1000_of_platform.c +++ b/drivers/net/can/sja1000/sja1000_of_platform.c @@ -87,8 +87,7 @@ static int __devexit sja1000_ofp_remove(struct platform_device *ofdev) return 0; } -static int __devinit sja1000_ofp_probe(struct platform_device *ofdev, - const struct of_device_id *id) +static int __devinit sja1000_ofp_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; struct net_device *dev; @@ -210,7 +209,7 @@ static struct of_device_id __devinitdata sja1000_ofp_table[] = { }; MODULE_DEVICE_TABLE(of, sja1000_ofp_table); -static struct of_platform_driver sja1000_ofp_driver = { +static struct platform_driver sja1000_ofp_driver = { .driver = { .owner = THIS_MODULE, .name = DRV_NAME, @@ -222,12 +221,12 @@ static struct of
[RFC PATCH 11/15] dt/video: Eliminate users of of_platform_{, un}register_driver
Get rid of users of of_platform_driver in drivers/video. The of_platform_{,un}register_driver functions are going away, so the users need to be converted to using the platform_bus_type directly. Signed-off-by: Grant Likely --- drivers/video/bw2.c |8 drivers/video/cg14.c |8 drivers/video/cg3.c |9 - drivers/video/cg6.c |9 - drivers/video/ffb.c |9 - drivers/video/fsl-diu-fb.c|9 - drivers/video/leo.c |9 - drivers/video/mb862xx/mb862xxfb.c |9 - drivers/video/p9100.c |8 drivers/video/platinumfb.c|9 - drivers/video/sunxvr1000.c|9 - drivers/video/tcx.c |9 - drivers/video/xilinxfb.c | 11 --- 13 files changed, 52 insertions(+), 64 deletions(-) diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index 4dc1346..7ba74cd 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c @@ -273,7 +273,7 @@ static int __devinit bw2_do_default_mode(struct bw2_par *par, return 0; } -static int __devinit bw2_probe(struct platform_device *op, const struct of_device_id *match) +static int __devinit bw2_probe(struct platform_device *op) { struct device_node *dp = op->dev.of_node; struct fb_info *info; @@ -375,7 +375,7 @@ static const struct of_device_id bw2_match[] = { }; MODULE_DEVICE_TABLE(of, bw2_match); -static struct of_platform_driver bw2_driver = { +static struct platform_driver bw2_driver = { .driver = { .name = "bw2", .owner = THIS_MODULE, @@ -390,12 +390,12 @@ static int __init bw2_init(void) if (fb_get_options("bw2fb", NULL)) return -ENODEV; - return of_register_platform_driver(&bw2_driver); + return platform_driver_register(&bw2_driver); } static void __exit bw2_exit(void) { - of_unregister_platform_driver(&bw2_driver); + platform_driver_unregister(&bw2_driver); } module_init(bw2_init); diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 2424953..e2c85b0 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c @@ -463,7 +463,7 @@ static void cg14_unmap_regs(struct platform_device *op, struct fb_info *info, info->screen_base, info->fix.smem_len); } -static int __devinit cg14_probe(struct platform_device *op, const struct of_device_id *match) +static int __devinit cg14_probe(struct platform_device *op) { struct device_node *dp = op->dev.of_node; struct fb_info *info; @@ -595,7 +595,7 @@ static const struct of_device_id cg14_match[] = { }; MODULE_DEVICE_TABLE(of, cg14_match); -static struct of_platform_driver cg14_driver = { +static struct platform_driver cg14_driver = { .driver = { .name = "cg14", .owner = THIS_MODULE, @@ -610,12 +610,12 @@ static int __init cg14_init(void) if (fb_get_options("cg14fb", NULL)) return -ENODEV; - return of_register_platform_driver(&cg14_driver); + return platform_driver_register(&cg14_driver); } static void __exit cg14_exit(void) { - of_unregister_platform_driver(&cg14_driver); + platform_driver_unregister(&cg14_driver); } module_init(cg14_init); diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 09c0c3c..f927a7b 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c @@ -346,8 +346,7 @@ static int __devinit cg3_do_default_mode(struct cg3_par *par) return 0; } -static int __devinit cg3_probe(struct platform_device *op, - const struct of_device_id *match) +static int __devinit cg3_probe(struct platform_device *op) { struct device_node *dp = op->dev.of_node; struct fb_info *info; @@ -462,7 +461,7 @@ static const struct of_device_id cg3_match[] = { }; MODULE_DEVICE_TABLE(of, cg3_match); -static struct of_platform_driver cg3_driver = { +static struct platform_driver cg3_driver = { .driver = { .name = "cg3", .owner = THIS_MODULE, @@ -477,12 +476,12 @@ static int __init cg3_init(void) if (fb_get_options("cg3fb", NULL)) return -ENODEV; - return of_register_platform_driver(&cg3_driver); + return platform_driver_register(&cg3_driver); } static void __exit cg3_exit(void) { - of_unregister_platform_driver(&cg3_driver); + platform_driver_unregister(&cg3_driver); } module_init(cg3_init); diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 2b5a970..4ffad90 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c @@ -737,8 +737,7 @@ static void cg6_unmap_regs(struct platform_device *op, struct fb_info *info, info->fix.smem_len); } -static int __devinit cg6_probe(struct platform_device *op,
[RFC PATCH 12/15] dt/usb: Eliminate users of of_platform_{, un}register_driver
Get rid of users of of_platform_driver in drivers/usb. The of_platform_{,un}register_driver functions are going away, so the users need to be converted to using the platform_bus_type directly. Signed-off-by: Grant Likely --- drivers/usb/gadget/fsl_qe_udc.c | 14 -- drivers/usb/host/ehci-hcd.c | 12 ++-- drivers/usb/host/ehci-ppc-of.c|9 +++-- drivers/usb/host/ehci-xilinx-of.c |6 ++ drivers/usb/host/fhci-hcd.c |9 - drivers/usb/host/isp1760-if.c |9 - drivers/usb/host/ohci-hcd.c |6 +++--- drivers/usb/host/ohci-ppc-of.c|9 +++-- 8 files changed, 33 insertions(+), 41 deletions(-) diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index 792d5ef..aee7e3c 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c @@ -2523,8 +2523,7 @@ static void qe_udc_release(struct device *dev) } /* Driver probe functions */ -static int __devinit qe_udc_probe(struct platform_device *ofdev, - const struct of_device_id *match) +static int __devinit qe_udc_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; struct qe_ep *ep; @@ -2532,6 +2531,9 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev, unsigned int i; const void *prop; + if (!ofdev->dev.of_match) + return -EINVAL; + prop = of_get_property(np, "mode", NULL); if (!prop || strcmp(prop, "peripheral")) return -ENODEV; @@ -2543,7 +2545,7 @@ static int __devinit qe_udc_probe(struct platform_device *ofdev, return -ENOMEM; } - udc_controller->soc_type = (unsigned long)match->data; + udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data; udc_controller->usb_regs = of_iomap(np, 0); if (!udc_controller->usb_regs) { ret = -ENOMEM; @@ -2768,7 +2770,7 @@ static const struct of_device_id qe_udc_match[] __devinitconst = { MODULE_DEVICE_TABLE(of, qe_udc_match); -static struct of_platform_driver udc_driver = { +static struct platform_driver udc_driver = { .driver = { .name = (char *)driver_name, .owner = THIS_MODULE, @@ -2786,12 +2788,12 @@ static int __init qe_udc_init(void) { printk(KERN_INFO "%s: %s, %s\n", driver_name, driver_desc, DRIVER_VERSION); - return of_register_platform_driver(&udc_driver); + return platform_driver_register(&udc_driver); } static void __exit qe_udc_exit(void) { - of_unregister_platform_driver(&udc_driver); + platform_driver_unregister(&udc_driver); } module_init(qe_udc_init); diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 74dcf49..c4de2d7 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1306,24 +1306,24 @@ static int __init ehci_hcd_init(void) #endif #ifdef OF_PLATFORM_DRIVER - retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); + retval = platform_driver_register(&OF_PLATFORM_DRIVER); if (retval < 0) goto clean3; #endif #ifdef XILINX_OF_PLATFORM_DRIVER - retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER); + retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER); if (retval < 0) goto clean4; #endif return retval; #ifdef XILINX_OF_PLATFORM_DRIVER - /* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */ + /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ clean4: #endif #ifdef OF_PLATFORM_DRIVER - of_unregister_platform_driver(&OF_PLATFORM_DRIVER); + platform_driver_unregister(&OF_PLATFORM_DRIVER); clean3: #endif #ifdef PS3_SYSTEM_BUS_DRIVER @@ -1351,10 +1351,10 @@ module_init(ehci_hcd_init); static void __exit ehci_hcd_cleanup(void) { #ifdef XILINX_OF_PLATFORM_DRIVER - of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); + platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); #endif #ifdef OF_PLATFORM_DRIVER - of_unregister_platform_driver(&OF_PLATFORM_DRIVER); + platform_driver_unregister(&OF_PLATFORM_DRIVER); #endif #ifdef PLATFORM_DRIVER platform_driver_unregister(&PLATFORM_DRIVER); diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index ba52be4..1f09f25 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c @@ -105,8 +105,7 @@ ppc44x_enable_bmt(struct device_node *dn) } -static int __devinit -ehci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match) +static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op) { struct device_node *dn = op->dev.of_node; struct usb_hcd *hcd; @@ -255,14 +254,12 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op)
[RFC PATCH 13/15] dt/serial: Eliminate users of of_platform_{, un}register_driver
Get rid of users of of_platform_driver in drivers/serial. The of_platform_{,un}register_driver functions are going away, so the users need to be converted to using the platform_bus_type directly. Signed-off-by: Grant Likely --- drivers/tty/serial/apbuart.c| 11 +-- drivers/tty/serial/cpm_uart/cpm_uart_core.c |9 - drivers/tty/serial/mpc52xx_uart.c | 13 + drivers/tty/serial/of_serial.c | 14 -- drivers/tty/serial/sunhv.c |8 drivers/tty/serial/sunsab.c |8 drivers/tty/serial/sunsu.c |6 +++--- drivers/tty/serial/sunzilog.c | 10 +- drivers/tty/serial/ucc_uart.c |9 - 9 files changed, 42 insertions(+), 46 deletions(-) diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index 095a5d5..1ab999b 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c @@ -553,8 +553,7 @@ static struct uart_driver grlib_apbuart_driver = { /* OF Platform Driver */ /* */ -static int __devinit apbuart_probe(struct platform_device *op, - const struct of_device_id *match) +static int __devinit apbuart_probe(struct platform_device *op) { int i = -1; struct uart_port *port = NULL; @@ -587,7 +586,7 @@ static struct of_device_id __initdata apbuart_match[] = { {}, }; -static struct of_platform_driver grlib_apbuart_of_driver = { +static struct platform_driver grlib_apbuart_of_driver = { .probe = apbuart_probe, .driver = { .owner = THIS_MODULE, @@ -676,10 +675,10 @@ static int __init grlib_apbuart_init(void) return ret; } - ret = of_register_platform_driver(&grlib_apbuart_of_driver); + ret = platform_driver_register(&grlib_apbuart_of_driver); if (ret) { printk(KERN_ERR - "%s: of_register_platform_driver failed (%i)\n", + "%s: platform_driver_register failed (%i)\n", __FILE__, ret); uart_unregister_driver(&grlib_apbuart_driver); return ret; @@ -697,7 +696,7 @@ static void __exit grlib_apbuart_exit(void) &grlib_apbuart_ports[i]); uart_unregister_driver(&grlib_apbuart_driver); - of_unregister_platform_driver(&grlib_apbuart_of_driver); + platform_driver_unregister(&grlib_apbuart_of_driver); } module_init(grlib_apbuart_init); diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 8692ff9..a9a6a5f 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -1359,8 +1359,7 @@ static struct uart_driver cpm_reg = { static int probe_index; -static int __devinit cpm_uart_probe(struct platform_device *ofdev, -const struct of_device_id *match) +static int __devinit cpm_uart_probe(struct platform_device *ofdev) { int index = probe_index++; struct uart_cpm_port *pinfo = &cpm_uart_ports[index]; @@ -1405,7 +1404,7 @@ static struct of_device_id cpm_uart_match[] = { {} }; -static struct of_platform_driver cpm_uart_driver = { +static struct platform_driver cpm_uart_driver = { .driver = { .name = "cpm_uart", .owner = THIS_MODULE, @@ -1421,7 +1420,7 @@ static int __init cpm_uart_init(void) if (ret) return ret; - ret = of_register_platform_driver(&cpm_uart_driver); + ret = platform_driver_register(&cpm_uart_driver); if (ret) uart_unregister_driver(&cpm_reg); @@ -1430,7 +1429,7 @@ static int __init cpm_uart_init(void) static void __exit cpm_uart_exit(void) { - of_unregister_platform_driver(&cpm_uart_driver); + platform_driver_unregister(&cpm_uart_driver); uart_unregister_driver(&cpm_reg); } diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c index 126ec7f..a0bcd8a 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c @@ -1302,8 +1302,7 @@ static struct of_device_id mpc52xx_uart_of_match[] = { {}, }; -static int __devinit -mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *match) +static int __devinit mpc52xx_uart_of_probe(struct platform_device *op) { int idx = -1; unsigned int uartclk; @@ -1311,8 +1310,6 @@ mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *mat struct resource res; int ret; - dev_dbg(&op->dev, "mpc52xx_uart_probe(op=%p, match=%p)\n", op, match); - /* Check validity & presenc
[RFC PATCH 14/15] dt: Eliminate of_platform_{,un}register_driver
Final step to eliminate of_platform_bus_type. They're all just platform drivers now. Signed-off-by: Grant Likely --- drivers/ata/pata_mpc52xx.c |8 drivers/ata/pata_of_platform.c |9 - drivers/ata/sata_dwc_460ex.c |9 - drivers/ata/sata_fsl.c |9 - drivers/atm/fore200e.c | 17 ++--- drivers/block/xsysace.c | 11 --- drivers/char/ipmi/ipmi_si_intf.c | 18 ++ drivers/crypto/talitos.c |9 - drivers/i2c/busses/i2c-cpm.c |9 - drivers/i2c/busses/i2c-ibm_iic.c |9 - drivers/i2c/busses/i2c-mpc.c | 22 +- drivers/input/serio/xilinx_ps2.c |9 - drivers/media/video/fsl-viu.c|9 - drivers/mmc/host/sdhci-of-core.c | 12 drivers/mtd/maps/physmap_of.c| 15 +-- drivers/mtd/maps/sun_uflash.c|8 drivers/mtd/nand/fsl_upm.c |9 - drivers/mtd/nand/mpc5121_nfc.c |9 - drivers/mtd/nand/ndfc.c |9 - drivers/mtd/nand/pasemi_nand.c |9 - drivers/mtd/nand/socrates_nand.c |9 - drivers/pcmcia/electra_cf.c |9 - drivers/pcmcia/m8xx_pcmcia.c |9 - drivers/rtc/rtc-mpc5121.c|9 - drivers/watchdog/cpwd.c |9 - drivers/watchdog/gef_wdt.c |9 - drivers/watchdog/mpc8xxx_wdt.c | 15 +-- drivers/watchdog/riowd.c |9 - 28 files changed, 143 insertions(+), 154 deletions(-) diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index d7d8026..2fcac51 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c @@ -680,7 +680,7 @@ mpc52xx_ata_remove_one(struct device *dev) /* */ static int __devinit -mpc52xx_ata_probe(struct platform_device *op, const struct of_device_id *match) +mpc52xx_ata_probe(struct platform_device *op) { unsigned int ipb_freq; struct resource res_mem; @@ -883,7 +883,7 @@ static struct of_device_id mpc52xx_ata_of_match[] = { }; -static struct of_platform_driver mpc52xx_ata_of_platform_driver = { +static struct platform_driver mpc52xx_ata_of_platform_driver = { .probe = mpc52xx_ata_probe, .remove = mpc52xx_ata_remove, #ifdef CONFIG_PM @@ -906,13 +906,13 @@ static int __init mpc52xx_ata_init(void) { printk(KERN_INFO "ata: MPC52xx IDE/ATA libata driver\n"); - return of_register_platform_driver(&mpc52xx_ata_of_platform_driver); + return platform_driver_register(&mpc52xx_ata_of_platform_driver); } static void __exit mpc52xx_ata_exit(void) { - of_unregister_platform_driver(&mpc52xx_ata_of_platform_driver); + platform_driver_unregister(&mpc52xx_ata_of_platform_driver); } module_init(mpc52xx_ata_init); diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index 480e043..f305400 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c @@ -14,8 +14,7 @@ #include #include -static int __devinit pata_of_platform_probe(struct platform_device *ofdev, - const struct of_device_id *match) +static int __devinit pata_of_platform_probe(struct platform_device *ofdev) { int ret; struct device_node *dn = ofdev->dev.of_node; @@ -90,7 +89,7 @@ static struct of_device_id pata_of_platform_match[] = { }; MODULE_DEVICE_TABLE(of, pata_of_platform_match); -static struct of_platform_driver pata_of_platform_driver = { +static struct platform_driver pata_of_platform_driver = { .driver = { .name = "pata_of_platform", .owner = THIS_MODULE, @@ -102,13 +101,13 @@ static struct of_platform_driver pata_of_platform_driver = { static int __init pata_of_platform_init(void) { - return of_register_platform_driver(&pata_of_platform_driver); + return platform_driver_register(&pata_of_platform_driver); } module_init(pata_of_platform_init); static void __exit pata_of_platform_exit(void) { - of_unregister_platform_driver(&pata_of_platform_driver); + platform_driver_unregister(&pata_of_platform_driver); } module_exit(pata_of_platform_exit); diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 6cf57c5..685a3a4 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -1588,8 +1588,7 @@ static const struct ata_port_info sata_dwc_port_info[] = { }, }; -static int sata_dwc_probe(struct platform_device *ofdev, - const struct of_device_id *match) +static int sata_dwc_probe(struct platform_device *ofdev) { struct sata_dwc_device *hsdev; u32 idr, versionr; @@ -1727,7 +1726,7 @@ static const struct of_device_id
[RFC PATCH 15/15] dt: eliminate of_platform_driver shim code
Commit eca393016, "of: Merge of_platform_bus_type with platform_bus_type" added a shim to allow of_platform_drivers to get registers onto the platform bus so that there was time to migrate the existing drivers to the platform_bus_type. This patch removes the shim since there are no more users of the old interface. Signed-off-by: Grant Likely --- drivers/of/platform.c | 68 --- include/linux/of_platform.h | 12 +--- 2 files changed, 1 insertions(+), 79 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b71d0cd..1ce4c45 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -42,74 +42,6 @@ struct platform_device *of_find_device_by_node(struct device_node *np) } EXPORT_SYMBOL(of_find_device_by_node); -static int platform_driver_probe_shim(struct platform_device *pdev) -{ - struct platform_driver *pdrv; - struct of_platform_driver *ofpdrv; - const struct of_device_id *match; - - pdrv = container_of(pdev->dev.driver, struct platform_driver, driver); - ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver); - - /* There is an unlikely chance that an of_platform driver might match -* on a non-OF platform device. If so, then of_match_device() will -* come up empty. Return -EINVAL in this case so other drivers get -* the chance to bind. */ - match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); - return match ? ofpdrv->probe(pdev, match) : -EINVAL; -} - -static void platform_driver_shutdown_shim(struct platform_device *pdev) -{ - struct platform_driver *pdrv; - struct of_platform_driver *ofpdrv; - - pdrv = container_of(pdev->dev.driver, struct platform_driver, driver); - ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver); - ofpdrv->shutdown(pdev); -} - -/** - * of_register_platform_driver - */ -int of_register_platform_driver(struct of_platform_driver *drv) -{ - char *of_name; - - /* setup of_platform_driver to platform_driver adaptors */ - drv->platform_driver.driver = drv->driver; - - /* Prefix the driver name with 'of:' to avoid namespace collisions -* and bogus matches. There are some drivers in the tree that -* register both an of_platform_driver and a platform_driver with -* the same name. This is a temporary measure until they are all -* cleaned up --gcl July 29, 2010 */ - of_name = kmalloc(strlen(drv->driver.name) + 5, GFP_KERNEL); - if (!of_name) - return -ENOMEM; - sprintf(of_name, "of:%s", drv->driver.name); - drv->platform_driver.driver.name = of_name; - - if (drv->probe) - drv->platform_driver.probe = platform_driver_probe_shim; - drv->platform_driver.remove = drv->remove; - if (drv->shutdown) - drv->platform_driver.shutdown = platform_driver_shutdown_shim; - drv->platform_driver.suspend = drv->suspend; - drv->platform_driver.resume = drv->resume; - - return platform_driver_register(&drv->platform_driver); -} -EXPORT_SYMBOL(of_register_platform_driver); - -void of_unregister_platform_driver(struct of_platform_driver *drv) -{ - platform_driver_unregister(&drv->platform_driver); - kfree(drv->platform_driver.driver.name); - drv->platform_driver.driver.name = NULL; -} -EXPORT_SYMBOL(of_unregister_platform_driver); - #if defined(CONFIG_PPC_DCR) #include #endif diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 048949f..17c7e21 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -23,13 +23,7 @@ * of_platform_driver - Legacy of-aware driver for platform devices. * * An of_platform_driver driver is attached to a basic platform_device on - * ether the "platform bus" (platform_bus_type), or the ibm ebus - * (ibmebus_bus_type). - * - * of_platform_driver is being phased out when used with the platform_bus_type, - * and regular platform_drivers should be used instead. When the transition - * is complete, only ibmebus will be using this structure, and the - * platform_driver member of this structure will be removed. + * the ibm ebus (ibmebus_bus_type). */ struct of_platform_driver { @@ -42,15 +36,11 @@ struct of_platform_driver int (*shutdown)(struct platform_device* dev); struct device_driverdriver; - struct platform_driver platform_driver; }; #defineto_of_platform_driver(drv) \ container_of(drv,struct of_platform_driver, driver) /* Platform drivers register/unregister */ -extern int of_register_platform_driver(struct of_platform_driver *drv); -extern void of_unregister_platform_driver(struct of_platform_driver *drv); - extern struct platform_device *of_device_alloc(struct device_node *np, const char *bus_id,