From a05d3dfd42865a9b4d93b2ef48822e3bb81fd0f6 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Fri, 11 Nov 2005 14:02:04 +1100 Subject: [PATCH] --- yaml --- r: 13881 b: refs/heads/master c: 6af37fa9928a0d50cda1bad14b2eda8c1a4d1a0e h: refs/heads/master i: 13879: 1b3a14e246718d9774e11069fbe93133dc90c998 v: v3 --- [refs] | 2 +- trunk/arch/arm/common/locomo.c | 38 +- trunk/arch/arm/common/sa1111.c | 42 +- trunk/arch/arm/common/scoop.c | 30 +- trunk/arch/arm/mach-pxa/corgi_ssp.c | 17 +- trunk/arch/arm/mach-sa1100/neponset.c | 31 +- trunk/arch/powerpc/Kconfig | 11 +- trunk/arch/powerpc/kernel/Makefile | 10 +- trunk/arch/powerpc/kernel/asm-offsets.c | 45 +- trunk/arch/powerpc/kernel/head_32.S | 1 - trunk/arch/powerpc/kernel/lparcfg.c | 23 +- trunk/arch/powerpc/kernel/paca.c | 7 + trunk/arch/powerpc/kernel/proc_ppc64.c | 4 +- trunk/arch/powerpc/kernel/rtas-proc.c | 1 + trunk/arch/powerpc/kernel/setup-common.c | 8 +- trunk/arch/powerpc/kernel/setup_64.c | 62 +- trunk/arch/powerpc/kernel/signal_32.c | 12 +- trunk/arch/powerpc/kernel/smp.c | 4 +- trunk/arch/powerpc/kernel/sysfs.c | 1 + trunk/arch/powerpc/kernel/time.c | 40 +- trunk/arch/powerpc/kernel/traps.c | 1 + trunk/arch/powerpc/kernel/vdso.c | 746 ------------------ .../arch/powerpc/kernel/vdso32/gettimeofday.S | 315 -------- .../arch/powerpc/kernel/vdso64/gettimeofday.S | 242 ------ trunk/arch/powerpc/mm/mem.c | 4 + trunk/arch/powerpc/mm/numa.c | 369 +++++---- trunk/arch/powerpc/oprofile/op_model_power4.c | 1 + trunk/arch/powerpc/platforms/pseries/rtasd.c | 1 + trunk/arch/powerpc/platforms/pseries/setup.c | 4 +- trunk/arch/powerpc/platforms/pseries/smp.c | 4 +- trunk/arch/powerpc/xmon/xmon.c | 25 +- trunk/arch/ppc/kernel/asm-offsets.c | 28 - trunk/arch/ppc/syslib/cpm2_pic.c | 2 +- trunk/arch/ppc64/Kconfig | 11 +- trunk/arch/ppc64/kernel/Makefile | 10 +- trunk/arch/ppc64/kernel/misc.S | 3 +- trunk/arch/{powerpc => ppc64}/kernel/udbg.c | 0 .../{powerpc => ppc64}/kernel/udbg_16550.c | 0 .../arch/{powerpc => ppc64}/kernel/udbg_scc.c | 0 .../{powerpc => ppc64}/kernel/vdso32/Makefile | 6 +- .../kernel/vdso32/cacheflush.S | 0 .../kernel/vdso32/datapage.S | 16 - trunk/arch/ppc64/kernel/vdso32/gettimeofday.S | 140 ++++ .../{powerpc => ppc64}/kernel/vdso32/note.S | 0 .../kernel/vdso32/sigtramp.S | 0 .../kernel/vdso32/vdso32.lds.S | 5 +- .../kernel/vdso32/vdso32_wrapper.S | 2 +- .../{powerpc => ppc64}/kernel/vdso64/Makefile | 0 .../kernel/vdso64/cacheflush.S | 0 .../kernel/vdso64/datapage.S | 16 - trunk/arch/ppc64/kernel/vdso64/gettimeofday.S | 91 +++ .../{powerpc => ppc64}/kernel/vdso64/note.S | 0 .../kernel/vdso64/sigtramp.S | 0 .../kernel/vdso64/vdso64.lds.S | 5 +- .../kernel/vdso64/vdso64_wrapper.S | 2 +- trunk/arch/um/drivers/net_kern.c | 9 +- trunk/arch/um/drivers/ubd_kern.c | 9 +- trunk/arch/xtensa/platform-iss/network.c | 9 +- trunk/drivers/base/platform.c | 73 -- trunk/drivers/char/ipmi/ipmi_msghandler.c | 6 +- trunk/drivers/char/s3c2410-rtc.c | 50 +- trunk/drivers/char/sonypi.c | 19 +- trunk/drivers/char/tb0219.c | 15 +- trunk/drivers/char/vr41xx_giu.c | 15 +- trunk/drivers/char/vr41xx_rtc.c | 17 +- trunk/drivers/char/watchdog/mpcore_wdt.c | 30 +- trunk/drivers/char/watchdog/mv64x60_wdt.c | 20 +- trunk/drivers/char/watchdog/s3c2410_wdt.c | 30 +- trunk/drivers/hwmon/hdaps.c | 62 +- trunk/drivers/i2c/busses/i2c-iop3xx.c | 27 +- trunk/drivers/i2c/busses/i2c-ixp2000.c | 25 +- trunk/drivers/i2c/busses/i2c-ixp4xx.c | 25 +- trunk/drivers/i2c/busses/i2c-mpc.c | 24 +- trunk/drivers/i2c/busses/i2c-mv64xxx.c | 24 +- trunk/drivers/i2c/busses/i2c-pxa.c | 25 +- trunk/drivers/i2c/busses/i2c-s3c2410.c | 71 +- trunk/drivers/i2c/chips/isp1301_omap.c | 21 +- trunk/drivers/input/keyboard/corgikbd.c | 29 +- trunk/drivers/input/keyboard/spitzkbd.c | 29 +- trunk/drivers/input/serio/i8042.c | 19 +- trunk/drivers/input/serio/rpckbd.c | 21 +- trunk/drivers/input/touchscreen/corgi_ts.c | 32 +- trunk/drivers/mfd/mcp-sa11x0.c | 32 +- trunk/drivers/misc/hdpuftrs/hdpu_cpustate.c | 20 +- trunk/drivers/misc/hdpuftrs/hdpu_nexus.c | 20 +- trunk/drivers/mmc/pxamci.c | 42 +- trunk/drivers/mmc/wbsd.c | 34 +- trunk/drivers/mtd/maps/bast-flash.c | 33 +- trunk/drivers/mtd/maps/integrator-flash.c | 23 +- trunk/drivers/mtd/maps/ixp2000.c | 25 +- trunk/drivers/mtd/maps/ixp4xx.c | 25 +- trunk/drivers/mtd/maps/omap_nor.c | 23 +- trunk/drivers/mtd/maps/plat-ram.c | 68 +- trunk/drivers/mtd/maps/sa1100-flash.c | 36 +- trunk/drivers/mtd/nand/s3c2410.c | 77 +- trunk/drivers/net/depca.c | 26 +- trunk/drivers/net/dm9000.c | 35 +- trunk/drivers/net/gianfar.c | 28 +- trunk/drivers/net/ibmveth.c | 2 +- trunk/drivers/net/irda/sa1100_ir.c | 28 +- trunk/drivers/net/irda/smsc-ircc2.c | 27 +- trunk/drivers/net/jazzsonic.c | 21 +- trunk/drivers/net/macsonic.c | 21 +- trunk/drivers/net/mv643xx_eth.c | 40 +- trunk/drivers/net/smc91x.c | 38 +- trunk/drivers/net/tokenring/proteon.c | 17 +- trunk/drivers/net/tokenring/skisa.c | 17 +- trunk/drivers/scsi/ahci.c | 2 +- trunk/drivers/scsi/ata_piix.c | 2 +- trunk/drivers/scsi/libata-core.c | 2 - trunk/drivers/scsi/libata-scsi.c | 2 - trunk/drivers/scsi/pdc_adma.c | 2 +- trunk/drivers/scsi/sata_mv.c | 4 +- trunk/drivers/scsi/sata_nv.c | 2 +- trunk/drivers/scsi/sata_promise.c | 2 +- trunk/drivers/scsi/sata_qstor.c | 2 +- trunk/drivers/scsi/sata_sil.c | 2 +- trunk/drivers/scsi/sata_sil24.c | 2 +- trunk/drivers/scsi/sata_sis.c | 2 +- trunk/drivers/scsi/sata_svw.c | 2 +- trunk/drivers/scsi/sata_sx4.c | 2 +- trunk/drivers/scsi/sata_uli.c | 2 +- trunk/drivers/scsi/sata_via.c | 2 +- trunk/drivers/scsi/sata_vsc.c | 2 +- trunk/drivers/serial/8250.c | 31 +- trunk/drivers/serial/imx.c | 31 +- trunk/drivers/serial/mpc52xx_uart.c | 32 +- trunk/drivers/serial/mpsc.c | 65 +- trunk/drivers/serial/pxa.c | 33 +- trunk/drivers/serial/s3c2410.c | 62 +- trunk/drivers/serial/sa1100.c | 32 +- trunk/drivers/serial/vr41xx_siu.c | 27 +- trunk/drivers/usb/gadget/dummy_hcd.c | 76 +- trunk/drivers/usb/gadget/lh7a40x_udc.c | 31 +- trunk/drivers/usb/gadget/omap_udc.c | 61 +- trunk/drivers/usb/gadget/pxa2xx_udc.c | 41 +- trunk/drivers/usb/host/isp116x-hcd.c | 37 +- trunk/drivers/usb/host/ohci-au1xxx.c | 31 +- trunk/drivers/usb/host/ohci-lh7a404.c | 31 +- trunk/drivers/usb/host/ohci-omap.c | 35 +- trunk/drivers/usb/host/ohci-ppc-soc.c | 21 +- trunk/drivers/usb/host/ohci-pxa27x.c | 31 +- trunk/drivers/usb/host/ohci-s3c2410.c | 21 +- trunk/drivers/usb/host/sl811-hcd.c | 61 +- trunk/drivers/video/acornfb.c | 13 +- trunk/drivers/video/arcfb.c | 22 +- trunk/drivers/video/backlight/corgi_bl.c | 21 +- trunk/drivers/video/dnfb.c | 16 +- trunk/drivers/video/epson1355fb.c | 24 +- trunk/drivers/video/gbefb.c | 25 +- trunk/drivers/video/imxfb.c | 45 +- trunk/drivers/video/pxafb.c | 51 +- trunk/drivers/video/q40fb.c | 14 +- trunk/drivers/video/s1d13xxxfb.c | 49 +- trunk/drivers/video/s3c2410fb.c | 47 +- trunk/drivers/video/sa1100fb.c | 25 +- trunk/drivers/video/sgivwfb.c | 22 +- trunk/drivers/video/vesafb.c | 14 +- trunk/drivers/video/vfb.c | 22 +- trunk/drivers/video/w100fb.c | 46 +- trunk/include/asm-powerpc/auxvec.h | 2 + trunk/include/asm-powerpc/elf.h | 10 +- trunk/include/asm-powerpc/irq.h | 1 - trunk/include/asm-powerpc/processor.h | 2 +- trunk/include/asm-powerpc/sparsemem.h | 4 +- trunk/include/asm-powerpc/systemcfg.h | 64 ++ trunk/include/asm-powerpc/topology.h | 12 +- trunk/include/asm-powerpc/vdso_datapage.h | 108 --- trunk/include/asm-ppc/page.h | 8 +- trunk/include/asm-ppc64/mmzone.h | 69 +- trunk/include/asm-ppc64/page.h | 5 + .../include/{asm-powerpc => asm-ppc64}/udbg.h | 14 +- .../include/{asm-powerpc => asm-ppc64}/vdso.h | 0 trunk/include/linux/libata.h | 2 - trunk/include/linux/platform_device.h | 15 - trunk/net/ipv4/tcp_vegas.c | 2 +- trunk/sound/arm/pxa2xx-ac97.c | 35 +- trunk/sound/core/init.c | 17 +- trunk/sound/core/sound.c | 8 +- 179 files changed, 2245 insertions(+), 3347 deletions(-) delete mode 100644 trunk/arch/powerpc/kernel/vdso.c delete mode 100644 trunk/arch/powerpc/kernel/vdso32/gettimeofday.S delete mode 100644 trunk/arch/powerpc/kernel/vdso64/gettimeofday.S rename trunk/arch/{powerpc => ppc64}/kernel/udbg.c (100%) rename trunk/arch/{powerpc => ppc64}/kernel/udbg_16550.c (100%) rename trunk/arch/{powerpc => ppc64}/kernel/udbg_scc.c (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso32/Makefile (91%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso32/cacheflush.S (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso32/datapage.S (82%) create mode 100644 trunk/arch/ppc64/kernel/vdso32/gettimeofday.S rename trunk/arch/{powerpc => ppc64}/kernel/vdso32/note.S (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso32/sigtramp.S (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso32/vdso32.lds.S (97%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso32/vdso32_wrapper.S (79%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso64/Makefile (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso64/cacheflush.S (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso64/datapage.S (84%) create mode 100644 trunk/arch/ppc64/kernel/vdso64/gettimeofday.S rename trunk/arch/{powerpc => ppc64}/kernel/vdso64/note.S (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso64/sigtramp.S (100%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso64/vdso64.lds.S (97%) rename trunk/arch/{powerpc => ppc64}/kernel/vdso64/vdso64_wrapper.S (79%) create mode 100644 trunk/include/asm-powerpc/systemcfg.h delete mode 100644 trunk/include/asm-powerpc/vdso_datapage.h rename trunk/include/{asm-powerpc => asm-ppc64}/udbg.h (90%) rename trunk/include/{asm-powerpc => asm-ppc64}/vdso.h (100%) diff --git a/[refs] b/[refs] index 92f2590a0e59..44648ef18922 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d5eebf428ac91ad12d316a391b734670d61480d8 +refs/heads/master: 6af37fa9928a0d50cda1bad14b2eda8c1a4d1a0e diff --git a/trunk/arch/arm/common/locomo.c b/trunk/arch/arm/common/locomo.c index 557e52c1c869..ad55680726ed 100644 --- a/trunk/arch/arm/common/locomo.c +++ b/trunk/arch/arm/common/locomo.c @@ -550,9 +550,9 @@ struct locomo_save_data { u16 LCM_SPIMD; }; -static int locomo_suspend(struct platform_device *dev, pm_message_t state) +static int locomo_suspend(struct device *dev, pm_message_t state) { - struct locomo *lchip = platform_get_drvdata(dev); + struct locomo *lchip = dev_get_drvdata(dev); struct locomo_save_data *save; unsigned long flags; @@ -560,7 +560,7 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state) if (!save) return -ENOMEM; - dev->dev.power.saved_state = (void *) save; + dev->power.saved_state = (void *) save; spin_lock_irqsave(&lchip->lock, flags); @@ -594,14 +594,14 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int locomo_resume(struct platform_device *dev) +static int locomo_resume(struct device *dev) { - struct locomo *lchip = platform_get_drvdata(dev); + struct locomo *lchip = dev_get_drvdata(dev); struct locomo_save_data *save; unsigned long r; unsigned long flags; - save = (struct locomo_save_data *) dev->dev.power.saved_state; + save = (struct locomo_save_data *) dev->power.saved_state; if (!save) return 0; @@ -760,26 +760,27 @@ static void __locomo_remove(struct locomo *lchip) kfree(lchip); } -static int locomo_probe(struct platform_device *dev) +static int locomo_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct resource *mem; int irq; - mem = platform_get_resource(dev, IORESOURCE_MEM, 0); + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) return -EINVAL; - irq = platform_get_irq(dev, 0); + irq = platform_get_irq(pdev, 0); - return __locomo_probe(&dev->dev, mem, irq); + return __locomo_probe(dev, mem, irq); } -static int locomo_remove(struct platform_device *dev) +static int locomo_remove(struct device *dev) { - struct locomo *lchip = platform__get_drvdata(dev); + struct locomo *lchip = dev_get_drvdata(dev); if (lchip) { __locomo_remove(lchip); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); } return 0; @@ -791,16 +792,15 @@ static int locomo_remove(struct platform_device *dev) * the per-machine level, and then have this driver pick * up the registered devices. */ -static struct platform_driver locomo_device_driver = { +static struct device_driver locomo_device_driver = { + .name = "locomo", + .bus = &platform_bus_type, .probe = locomo_probe, .remove = locomo_remove, #ifdef CONFIG_PM .suspend = locomo_suspend, .resume = locomo_resume, #endif - .driver = { - .name = "locomo", - }, }; /* @@ -1126,13 +1126,13 @@ static int __init locomo_init(void) { int ret = bus_register(&locomo_bus_type); if (ret == 0) - platform_driver_register(&locomo_device_driver); + driver_register(&locomo_device_driver); return ret; } static void __exit locomo_exit(void) { - platform_driver_unregister(&locomo_device_driver); + driver_unregister(&locomo_device_driver); bus_unregister(&locomo_bus_type); } diff --git a/trunk/arch/arm/common/sa1111.c b/trunk/arch/arm/common/sa1111.c index 7b07acb03f3b..174aa86ee816 100644 --- a/trunk/arch/arm/common/sa1111.c +++ b/trunk/arch/arm/common/sa1111.c @@ -801,9 +801,9 @@ struct sa1111_save_data { #ifdef CONFIG_PM -static int sa1111_suspend(struct platform_device *dev, pm_message_t state) +static int sa1111_suspend(struct device *dev, pm_message_t state) { - struct sa1111 *sachip = platform_get_drvdata(dev); + struct sa1111 *sachip = dev_get_drvdata(dev); struct sa1111_save_data *save; unsigned long flags; unsigned int val; @@ -812,7 +812,7 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); if (!save) return -ENOMEM; - dev->dev.power.saved_state = save; + dev->power.saved_state = save; spin_lock_irqsave(&sachip->lock, flags); @@ -859,14 +859,14 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) * restored by their respective drivers, and must be called * via LDM after this function. */ -static int sa1111_resume(struct platform_device *dev) +static int sa1111_resume(struct device *dev) { - struct sa1111 *sachip = platform_get_drvdata(dev); + struct sa1111 *sachip = dev_get_drvdata(dev); struct sa1111_save_data *save; unsigned long flags, id; void __iomem *base; - save = (struct sa1111_save_data *)dev->dev.power.saved_state; + save = (struct sa1111_save_data *)dev->power.saved_state; if (!save) return 0; @@ -879,7 +879,7 @@ static int sa1111_resume(struct platform_device *dev) id = sa1111_readl(sachip->base + SA1111_SKID); if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { __sa1111_remove(sachip); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); kfree(save); return 0; } @@ -911,7 +911,7 @@ static int sa1111_resume(struct platform_device *dev) spin_unlock_irqrestore(&sachip->lock, flags); - dev->dev.power.saved_state = NULL; + dev->power.saved_state = NULL; kfree(save); return 0; @@ -922,8 +922,9 @@ static int sa1111_resume(struct platform_device *dev) #define sa1111_resume NULL #endif -static int sa1111_probe(struct platform_device *pdev) +static int sa1111_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct resource *mem; int irq; @@ -932,20 +933,20 @@ static int sa1111_probe(struct platform_device *pdev) return -EINVAL; irq = platform_get_irq(pdev, 0); - return __sa1111_probe(&pdev->dev, mem, irq); + return __sa1111_probe(dev, mem, irq); } -static int sa1111_remove(struct platform_device *pdev) +static int sa1111_remove(struct device *dev) { - struct sa1111 *sachip = platform_get_drvdata(pdev); + struct sa1111 *sachip = dev_get_drvdata(dev); if (sachip) { __sa1111_remove(sachip); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); #ifdef CONFIG_PM - kfree(pdev->dev.power.saved_state); - pdev->dev.power.saved_state = NULL; + kfree(dev->power.saved_state); + dev->power.saved_state = NULL; #endif } @@ -961,14 +962,13 @@ static int sa1111_remove(struct platform_device *pdev) * We also need to handle the SDRAM configuration for * PXA250/SA1110 machine classes. */ -static struct platform_driver sa1111_device_driver = { +static struct device_driver sa1111_device_driver = { + .name = "sa1111", + .bus = &platform_bus_type, .probe = sa1111_probe, .remove = sa1111_remove, .suspend = sa1111_suspend, .resume = sa1111_resume, - .driver = { - .name = "sa1111", - }, }; /* @@ -1256,13 +1256,13 @@ static int __init sa1111_init(void) { int ret = bus_register(&sa1111_bus_type); if (ret == 0) - platform_driver_register(&sa1111_device_driver); + driver_register(&sa1111_device_driver); return ret; } static void __exit sa1111_exit(void) { - platform_driver_unregister(&sa1111_device_driver); + driver_unregister(&sa1111_device_driver); bus_unregister(&sa1111_bus_type); } diff --git a/trunk/arch/arm/common/scoop.c b/trunk/arch/arm/common/scoop.c index 32924c6714fe..c7fdf390cef9 100644 --- a/trunk/arch/arm/common/scoop.c +++ b/trunk/arch/arm/common/scoop.c @@ -98,9 +98,9 @@ static void check_scoop_reg(struct scoop_dev *sdev) } #ifdef CONFIG_PM -static int scoop_suspend(struct platform_device *dev, pm_message_t state) +static int scoop_suspend(struct device *dev, pm_message_t state) { - struct scoop_dev *sdev = platform_get_drvdata(dev); + struct scoop_dev *sdev = dev_get_drvdata(dev); check_scoop_reg(sdev); sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR); @@ -109,9 +109,9 @@ static int scoop_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int scoop_resume(struct platform_device *dev) +static int scoop_resume(struct device *dev) { - struct scoop_dev *sdev = platform_get_drvdata(dev); + struct scoop_dev *sdev = dev_get_drvdata(dev); check_scoop_reg(sdev); SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; @@ -123,10 +123,11 @@ static int scoop_resume(struct platform_device *dev) #define scoop_resume NULL #endif -int __init scoop_probe(struct platform_device *pdev) +int __init scoop_probe(struct device *dev) { struct scoop_dev *devptr; struct scoop_config *inf; + struct platform_device *pdev = to_platform_device(dev); struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) @@ -140,7 +141,7 @@ int __init scoop_probe(struct platform_device *pdev) memset(devptr, 0, sizeof(struct scoop_dev)); spin_lock_init(&devptr->scoop_lock); - inf = pdev->dev.platform_data; + inf = dev->platform_data; devptr->base = ioremap(mem->start, mem->end - mem->start + 1); if (!devptr->base) { @@ -148,7 +149,7 @@ int __init scoop_probe(struct platform_device *pdev) return -ENOMEM; } - platform_set_drvdata(pdev, devptr); + dev_set_drvdata(dev, devptr); printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base); @@ -163,30 +164,29 @@ int __init scoop_probe(struct platform_device *pdev) return 0; } -static int scoop_remove(struct platform_device *pdev) +static int scoop_remove(struct device *dev) { - struct scoop_dev *sdev = platform_get_drvdata(pdev); + struct scoop_dev *sdev = dev_get_drvdata(dev); if (sdev) { iounmap(sdev->base); kfree(sdev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); } return 0; } -static struct platform_driver scoop_driver = { +static struct device_driver scoop_driver = { + .name = "sharp-scoop", + .bus = &platform_bus_type, .probe = scoop_probe, .remove = scoop_remove, .suspend = scoop_suspend, .resume = scoop_resume, - .driver = { - .name = "sharp-scoop", - }, }; int __init scoop_init(void) { - return platform_driver_register(&scoop_driver); + return driver_register(&scoop_driver); } subsys_initcall(scoop_init); diff --git a/trunk/arch/arm/mach-pxa/corgi_ssp.c b/trunk/arch/arm/mach-pxa/corgi_ssp.c index b371d723635f..bdf10cfa9440 100644 --- a/trunk/arch/arm/mach-pxa/corgi_ssp.c +++ b/trunk/arch/arm/mach-pxa/corgi_ssp.c @@ -191,7 +191,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo) ssp_machinfo = machinfo; } -static int __init corgi_ssp_probe(struct platform_device *dev) +static int __init corgi_ssp_probe(struct device *dev) { int ret; @@ -216,13 +216,13 @@ static int __init corgi_ssp_probe(struct platform_device *dev) return ret; } -static int corgi_ssp_remove(struct platform_device *dev) +static int corgi_ssp_remove(struct device *dev) { ssp_exit(&corgi_ssp_dev); return 0; } -static int corgi_ssp_suspend(struct platform_device *dev, pm_message_t state) +static int corgi_ssp_suspend(struct device *dev, pm_message_t state) { ssp_flush(&corgi_ssp_dev); ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state); @@ -230,7 +230,7 @@ static int corgi_ssp_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int corgi_ssp_resume(struct platform_device *dev) +static int corgi_ssp_resume(struct device *dev) { GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */ GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/ @@ -241,19 +241,18 @@ static int corgi_ssp_resume(struct platform_device *dev) return 0; } -static struct platform_driver corgissp_driver = { +static struct device_driver corgissp_driver = { + .name = "corgi-ssp", + .bus = &platform_bus_type, .probe = corgi_ssp_probe, .remove = corgi_ssp_remove, .suspend = corgi_ssp_suspend, .resume = corgi_ssp_resume, - .driver = { - .name = "corgi-ssp", - }, }; int __init corgi_ssp_init(void) { - return platform_driver_register(&corgissp_driver); + return driver_register(&corgissp_driver); } arch_initcall(corgi_ssp_init); diff --git a/trunk/arch/arm/mach-sa1100/neponset.c b/trunk/arch/arm/mach-sa1100/neponset.c index 9e02bc3712a0..69f1970646c6 100644 --- a/trunk/arch/arm/mach-sa1100/neponset.c +++ b/trunk/arch/arm/mach-sa1100/neponset.c @@ -137,7 +137,7 @@ static struct sa1100_port_fns neponset_port_fns __initdata = { .get_mctrl = neponset_get_mctrl, }; -static int neponset_probe(struct platform_device *dev) +static int neponset_probe(struct device *dev) { sa1100_register_uart_fns(&neponset_port_fns); @@ -178,27 +178,27 @@ static int neponset_probe(struct platform_device *dev) /* * LDM power management. */ -static int neponset_suspend(struct platform_device *dev, pm_message_t state) +static int neponset_suspend(struct device *dev, pm_message_t state) { /* * Save state. */ - if (!dev->dev.power.saved_state) - dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL); - if (!dev->dev.power.saved_state) + if (!dev->power.saved_state) + dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL); + if (!dev->power.saved_state) return -ENOMEM; - *(unsigned int *)dev->dev.power.saved_state = NCR_0; + *(unsigned int *)dev->power.saved_state = NCR_0; return 0; } -static int neponset_resume(struct platform_device *dev) +static int neponset_resume(struct device *dev) { - if (dev->dev.power.saved_state) { - NCR_0 = *(unsigned int *)dev->dev.power.saved_state; - kfree(dev->dev.power.saved_state); - dev->dev.power.saved_state = NULL; + if (dev->power.saved_state) { + NCR_0 = *(unsigned int *)dev->power.saved_state; + kfree(dev->power.saved_state); + dev->power.saved_state = NULL; } return 0; @@ -209,13 +209,12 @@ static int neponset_resume(struct platform_device *dev) #define neponset_resume NULL #endif -static struct platform_driver neponset_device_driver = { +static struct device_driver neponset_device_driver = { + .name = "neponset", + .bus = &platform_bus_type, .probe = neponset_probe, .suspend = neponset_suspend, .resume = neponset_resume, - .driver = { - .name = "neponset", - }, }; static struct resource neponset_resources[] = { @@ -294,7 +293,7 @@ static struct platform_device *devices[] __initdata = { static int __init neponset_init(void) { - platform_driver_register(&neponset_device_driver); + driver_register(&neponset_device_driver); /* * The Neponset is only present on the Assabet machine type. diff --git a/trunk/arch/powerpc/Kconfig b/trunk/arch/powerpc/Kconfig index c523029674e6..ed31062029f7 100644 --- a/trunk/arch/powerpc/Kconfig +++ b/trunk/arch/powerpc/Kconfig @@ -581,12 +581,17 @@ config ARCH_FLATMEM_ENABLE def_bool y depends on PPC64 && !NUMA -config ARCH_SPARSEMEM_ENABLE +config ARCH_DISCONTIGMEM_ENABLE def_bool y + depends on SMP && PPC_PSERIES -config ARCH_SPARSEMEM_DEFAULT +config ARCH_DISCONTIGMEM_DEFAULT def_bool y - depends on SMP && PPC_PSERIES + depends on ARCH_DISCONTIGMEM_ENABLE + +config ARCH_SPARSEMEM_ENABLE + def_bool y + depends on ARCH_DISCONTIGMEM_ENABLE source "mm/Kconfig" diff --git a/trunk/arch/powerpc/kernel/Makefile b/trunk/arch/powerpc/kernel/Makefile index 9a74b7ab03a4..c04bbd320594 100644 --- a/trunk/arch/powerpc/kernel/Makefile +++ b/trunk/arch/powerpc/kernel/Makefile @@ -12,13 +12,11 @@ CFLAGS_btext.o += -fPIC endif obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ - irq.o signal_32.o pmc.o vdso.o -obj-y += vdso32/ + irq.o signal_32.o pmc.o obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ signal_64.o ptrace32.o systbl.o \ paca.o ioctl32.o cpu_setup_power4.o \ - firmware.o sysfs.o udbg.o -obj-$(CONFIG_PPC64) += vdso64/ + firmware.o sysfs.o obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o obj-$(CONFIG_POWER4) += idle_power4.o obj-$(CONFIG_PPC_OF) += of_device.o @@ -31,10 +29,6 @@ obj-$(CONFIG_RTAS_PROC) += rtas-proc.o obj-$(CONFIG_LPARCFG) += lparcfg.o obj-$(CONFIG_IBMVIO) += vio.o obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o -obj-$(CONFIG_PPC_PSERIES) += udbg_16550.o -obj-$(CONFIG_PPC_MAPLE) += udbg_16550.o -udbgscc-$(CONFIG_PPC64) := udbg_scc.o -obj-$(CONFIG_PPC_PMAC) += $(udbgscc-y) ifeq ($(CONFIG_PPC_MERGE),y) diff --git a/trunk/arch/powerpc/kernel/asm-offsets.c b/trunk/arch/powerpc/kernel/asm-offsets.c index 4550eb4f4fbd..8793102711a8 100644 --- a/trunk/arch/powerpc/kernel/asm-offsets.c +++ b/trunk/arch/powerpc/kernel/asm-offsets.c @@ -37,12 +37,12 @@ #include #include #include -#include #ifdef CONFIG_PPC64 #include #include #include #include +#include #include #endif @@ -251,42 +251,25 @@ int main(void) DEFINE(TASK_SIZE, TASK_SIZE); DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); -#endif /* ! CONFIG_PPC64 */ +#else /* CONFIG_PPC64 */ + /* systemcfg offsets for use by vdso */ + DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct systemcfg, tb_orig_stamp)); + DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct systemcfg, tb_ticks_per_sec)); + DEFINE(CFG_TB_TO_XS, offsetof(struct systemcfg, tb_to_xs)); + DEFINE(CFG_STAMP_XSEC, offsetof(struct systemcfg, stamp_xsec)); + DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct systemcfg, tb_update_count)); + DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct systemcfg, tz_minuteswest)); + DEFINE(CFG_TZ_DSTTIME, offsetof(struct systemcfg, tz_dsttime)); + DEFINE(CFG_SYSCALL_MAP32, offsetof(struct systemcfg, syscall_map_32)); + DEFINE(CFG_SYSCALL_MAP64, offsetof(struct systemcfg, syscall_map_64)); - /* datapage offsets for use by vdso */ - DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct vdso_data, tb_orig_stamp)); - DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct vdso_data, tb_ticks_per_sec)); - DEFINE(CFG_TB_TO_XS, offsetof(struct vdso_data, tb_to_xs)); - DEFINE(CFG_STAMP_XSEC, offsetof(struct vdso_data, stamp_xsec)); - DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct vdso_data, tb_update_count)); - DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct vdso_data, tz_minuteswest)); - DEFINE(CFG_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime)); - DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32)); - DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec)); - DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); -#ifdef CONFIG_PPC64 - DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64)); + /* timeval/timezone offsets for use by vdso */ DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec)); DEFINE(TVAL64_TV_USEC, offsetof(struct timeval, tv_usec)); DEFINE(TVAL32_TV_SEC, offsetof(struct compat_timeval, tv_sec)); DEFINE(TVAL32_TV_USEC, offsetof(struct compat_timeval, tv_usec)); - DEFINE(TSPC32_TV_SEC, offsetof(struct compat_timespec, tv_sec)); - DEFINE(TSPC32_TV_NSEC, offsetof(struct compat_timespec, tv_nsec)); -#else - DEFINE(TVAL32_TV_SEC, offsetof(struct timeval, tv_sec)); - DEFINE(TVAL32_TV_USEC, offsetof(struct timeval, tv_usec)); - DEFINE(TSPEC32_TV_SEC, offsetof(struct timespec, tv_sec)); - DEFINE(TSPEC32_TV_NSEC, offsetof(struct timespec, tv_nsec)); -#endif - /* timeval/timezone offsets for use by vdso */ DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest)); DEFINE(TZONE_TZ_DSTTIME, offsetof(struct timezone, tz_dsttime)); - - /* Other bits used by the vdso */ - DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); - DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); - DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); - DEFINE(CLOCK_REALTIME_RES, TICK_NSEC); - +#endif /* CONFIG_PPC64 */ return 0; } diff --git a/trunk/arch/powerpc/kernel/head_32.S b/trunk/arch/powerpc/kernel/head_32.S index ccdf94731e30..b102e3a2415e 100644 --- a/trunk/arch/powerpc/kernel/head_32.S +++ b/trunk/arch/powerpc/kernel/head_32.S @@ -1100,7 +1100,6 @@ start_here: mr r3,r31 mr r4,r30 bl machine_init - bl __save_cpu_setup bl MMU_init #ifdef CONFIG_APUS diff --git a/trunk/arch/powerpc/kernel/lparcfg.c b/trunk/arch/powerpc/kernel/lparcfg.c index 1b3ba8a440a6..5e954fae031f 100644 --- a/trunk/arch/powerpc/kernel/lparcfg.c +++ b/trunk/arch/powerpc/kernel/lparcfg.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #define MODULE_VERS "1.6" #define MODULE_NAME "lparcfg" @@ -43,7 +43,7 @@ /* #define LPARCFG_DEBUG */ /* find a better place for this function... */ -static void log_plpar_hcall_return(unsigned long rc, char *tag) +void log_plpar_hcall_return(unsigned long rc, char *tag) { if (rc == 0) /* success, return */ return; @@ -213,10 +213,11 @@ static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) unsigned long dummy; rc = plpar_hcall(H_PIC, 0, 0, 0, 0, pool_idle_time, num_procs, &dummy); - if (rc != H_Authority) - log_plpar_hcall_return(rc, "H_PIC"); + log_plpar_hcall_return(rc, "H_PIC"); } +static unsigned long get_purr(void); + /* Track sum of all purrs across all processors. This is used to further */ /* calculate usage values by different applications */ @@ -318,6 +319,8 @@ static void parse_system_parameter_string(struct seq_file *m) kfree(local_buffer); } +static int lparcfg_count_active_processors(void); + /* Return the number of processors in the system. * This function reads through the device tree and counts * the virtual processors, this does not include threads. @@ -369,7 +372,7 @@ static int lparcfg_data(struct seq_file *m, void *v) lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", NULL); if (lrdrp == NULL) { - partition_potential_processors = vdso_data->processorCount; + partition_potential_processors = _systemcfg->processorCount; } else { partition_potential_processors = *(lrdrp + 4); } @@ -545,7 +548,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf, retval = -EIO; } -out: + out: kfree(kbuf); return retval; } @@ -558,10 +561,10 @@ static int lparcfg_open(struct inode *inode, struct file *file) } struct file_operations lparcfg_fops = { - .owner = THIS_MODULE, - .read = seq_read, - .open = lparcfg_open, - .release = single_release, + .owner = THIS_MODULE, + .read = seq_read, + .open = lparcfg_open, + .release = single_release, }; int __init lparcfg_init(void) diff --git a/trunk/arch/powerpc/kernel/paca.c b/trunk/arch/powerpc/kernel/paca.c index a7b68f911eb1..3cf2517c5f91 100644 --- a/trunk/arch/powerpc/kernel/paca.c +++ b/trunk/arch/powerpc/kernel/paca.c @@ -15,10 +15,17 @@ #include #include #include +#include #include #include #include +static union { + struct systemcfg data; + u8 page[PAGE_SIZE]; +} systemcfg_store __attribute__((__section__(".data.page.aligned"))); +struct systemcfg *_systemcfg = &systemcfg_store.data; + /* This symbol is provided by the linker - let it fill in the paca * field correctly */ diff --git a/trunk/arch/powerpc/kernel/proc_ppc64.c b/trunk/arch/powerpc/kernel/proc_ppc64.c index 7ba42a405f41..a1c19502fe8b 100644 --- a/trunk/arch/powerpc/kernel/proc_ppc64.c +++ b/trunk/arch/powerpc/kernel/proc_ppc64.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -72,7 +72,7 @@ static int __init proc_ppc64_init(void) if (!pde) return 1; pde->nlink = 1; - pde->data = vdso_data; + pde->data = _systemcfg; pde->size = PAGE_SIZE; pde->proc_fops = &page_map_fops; diff --git a/trunk/arch/powerpc/kernel/rtas-proc.c b/trunk/arch/powerpc/kernel/rtas-proc.c index 7a95b8a28354..ae1a36449ccd 100644 --- a/trunk/arch/powerpc/kernel/rtas-proc.c +++ b/trunk/arch/powerpc/kernel/rtas-proc.c @@ -32,6 +32,7 @@ #include #include /* for ppc_md */ #include +#include /* Token for Sensors */ #define KEY_SWITCH 0x0001 diff --git a/trunk/arch/powerpc/kernel/setup-common.c b/trunk/arch/powerpc/kernel/setup-common.c index 33e7f2c7f194..bae4bff138f1 100644 --- a/trunk/arch/powerpc/kernel/setup-common.c +++ b/trunk/arch/powerpc/kernel/setup-common.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -444,8 +444,10 @@ void __init check_for_initrd(void) if (initrd_start >= KERNELBASE && initrd_end >= KERNELBASE && initrd_end > initrd_start) ROOT_DEV = Root_RAM0; - else + else { + printk("Bogus initrd %08lx %08lx\n", initrd_start, initrd_end); initrd_start = initrd_end = 0; + } if (initrd_start) printk("Found initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end); @@ -564,7 +566,7 @@ void __init smp_setup_cpu_maps(void) cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]); } - vdso_data->processorCount = num_present_cpus(); + _systemcfg->processorCount = num_present_cpus(); #endif /* CONFIG_PPC64 */ } #endif /* CONFIG_SMP */ diff --git a/trunk/arch/powerpc/kernel/setup_64.c b/trunk/arch/powerpc/kernel/setup_64.c index fdbd9f9122f2..6791668213e7 100644 --- a/trunk/arch/powerpc/kernel/setup_64.c +++ b/trunk/arch/powerpc/kernel/setup_64.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -374,8 +375,9 @@ static void __init initialize_cache_info(void) DBG("Argh, can't find dcache properties ! " "sizep: %p, lsizep: %p\n", sizep, lsizep); - ppc64_caches.dsize = size; - ppc64_caches.dline_size = lsize; + _systemcfg->dcache_size = ppc64_caches.dsize = size; + _systemcfg->dcache_line_size = + ppc64_caches.dline_size = lsize; ppc64_caches.log_dline_size = __ilog2(lsize); ppc64_caches.dlines_per_page = PAGE_SIZE / lsize; @@ -391,13 +393,22 @@ static void __init initialize_cache_info(void) DBG("Argh, can't find icache properties ! " "sizep: %p, lsizep: %p\n", sizep, lsizep); - ppc64_caches.isize = size; - ppc64_caches.iline_size = lsize; + _systemcfg->icache_size = ppc64_caches.isize = size; + _systemcfg->icache_line_size = + ppc64_caches.iline_size = lsize; ppc64_caches.log_iline_size = __ilog2(lsize); ppc64_caches.ilines_per_page = PAGE_SIZE / lsize; } } + /* Add an eye catcher and the systemcfg layout version number */ + strcpy(_systemcfg->eye_catcher, "SYSTEMCFG:PPC64"); + _systemcfg->version.major = SYSTEMCFG_MAJOR; + _systemcfg->version.minor = SYSTEMCFG_MINOR; + _systemcfg->processor = mfspr(SPRN_PVR); + _systemcfg->platform = _machine; + _systemcfg->physicalMemorySize = lmb_phys_mem_size(); + DBG(" <- initialize_cache_info()\n"); } @@ -484,14 +495,15 @@ void __init setup_system(void) printk("-----------------------------------------------------\n"); printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); - printk("ppc64_interrupt_controller = 0x%ld\n", - ppc64_interrupt_controller); - printk("platform = 0x%x\n", _machine); - printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); + printk("ppc64_interrupt_controller = 0x%ld\n", ppc64_interrupt_controller); + printk("systemcfg = 0x%p\n", _systemcfg); + printk("systemcfg->platform = 0x%x\n", _systemcfg->platform); + printk("systemcfg->processorCount = 0x%lx\n", _systemcfg->processorCount); + printk("systemcfg->physicalMemorySize = 0x%lx\n", _systemcfg->physicalMemorySize); printk("ppc64_caches.dcache_line_size = 0x%x\n", - ppc64_caches.dline_size); + ppc64_caches.dline_size); printk("ppc64_caches.icache_line_size = 0x%x\n", - ppc64_caches.iline_size); + ppc64_caches.iline_size); printk("htab_address = 0x%p\n", htab_address); printk("htab_hash_mask = 0x%lx\n", htab_hash_mask); printk("-----------------------------------------------------\n"); @@ -555,6 +567,33 @@ static void __init emergency_stack_init(void) __va(lmb_alloc_base(HW_PAGE_SIZE, 128, limit)) + HW_PAGE_SIZE; } +/* + * Called from setup_arch to initialize the bitmap of available + * syscalls in the systemcfg page + */ +void __init setup_syscall_map(void) +{ + unsigned int i, count64 = 0, count32 = 0; + extern unsigned long *sys_call_table; + extern unsigned long sys_ni_syscall; + + + for (i = 0; i < __NR_syscalls; i++) { + if (sys_call_table[i*2] != sys_ni_syscall) { + count64++; + _systemcfg->syscall_map_64[i >> 5] |= + 0x80000000UL >> (i & 0x1f); + } + if (sys_call_table[i*2+1] != sys_ni_syscall) { + count32++; + _systemcfg->syscall_map_32[i >> 5] |= + 0x80000000UL >> (i & 0x1f); + } + } + printk(KERN_INFO "Syscall map setup, %d 32-bit and %d 64-bit syscalls\n", + count32, count64); +} + /* * Called into from start_kernel, after lock_kernel has been called. * Initializes bootmem, which is unsed to manage page allocation until @@ -596,6 +635,9 @@ void __init setup_arch(char **cmdline_p) do_init_bootmem(); sparse_init(); + /* initialize the syscall map in systemcfg */ + setup_syscall_map(); + #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; #endif diff --git a/trunk/arch/powerpc/kernel/signal_32.c b/trunk/arch/powerpc/kernel/signal_32.c index 8bdf95b7e420..a7c4515f320f 100644 --- a/trunk/arch/powerpc/kernel/signal_32.c +++ b/trunk/arch/powerpc/kernel/signal_32.c @@ -43,10 +43,10 @@ #include #include #include -#include #ifdef CONFIG_PPC64 #include "ppc32.h" #include +#include #else #include #include @@ -809,11 +809,14 @@ static int handle_rt_signal(unsigned long sig, struct k_sigaction *ka, /* Save user registers on the stack */ frame = &rt_sf->uc.uc_mcontext; +#ifdef CONFIG_PPC64 if (vdso32_rt_sigtramp && current->thread.vdso_base) { if (save_user_regs(regs, frame, 0)) goto badframe; regs->link = current->thread.vdso_base + vdso32_rt_sigtramp; - } else { + } else +#endif + { if (save_user_regs(regs, frame, __NR_rt_sigreturn)) goto badframe; regs->link = (unsigned long) frame->tramp; @@ -1087,11 +1090,14 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka, || __put_user(sig, &sc->signal)) goto badframe; +#ifdef CONFIG_PPC64 if (vdso32_sigtramp && current->thread.vdso_base) { if (save_user_regs(regs, &frame->mctx, 0)) goto badframe; regs->link = current->thread.vdso_base + vdso32_sigtramp; - } else { + } else +#endif + { if (save_user_regs(regs, &frame->mctx, __NR_sigreturn)) goto badframe; regs->link = (unsigned long) frame->mctx.tramp; diff --git a/trunk/arch/powerpc/kernel/smp.c b/trunk/arch/powerpc/kernel/smp.c index 62dfc5b8d765..e28a139c29d0 100644 --- a/trunk/arch/powerpc/kernel/smp.c +++ b/trunk/arch/powerpc/kernel/smp.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #ifdef CONFIG_PPC64 #include #endif @@ -371,7 +371,7 @@ int generic_cpu_disable(void) cpu_clear(cpu, cpu_online_map); #ifdef CONFIG_PPC64 - vdso_data->processorCount--; + _systemcfg->processorCount--; fixup_irqs(cpu_online_map); #endif return 0; diff --git a/trunk/arch/powerpc/kernel/sysfs.c b/trunk/arch/powerpc/kernel/sysfs.c index 0f0c3a9ae2e5..850af198fb5f 100644 --- a/trunk/arch/powerpc/kernel/sysfs.c +++ b/trunk/arch/powerpc/kernel/sysfs.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/powerpc/kernel/time.c b/trunk/arch/powerpc/kernel/time.c index 070b4b458aaf..260b6ecd26a9 100644 --- a/trunk/arch/powerpc/kernel/time.c +++ b/trunk/arch/powerpc/kernel/time.c @@ -62,8 +62,8 @@ #include #include #include -#include #ifdef CONFIG_PPC64 +#include #include #endif #ifdef CONFIG_PPC_ISERIES @@ -261,6 +261,7 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, do_gtod.varp = temp_varp; do_gtod.var_idx = temp_idx; +#ifdef CONFIG_PPC64 /* * tb_update_count is used to allow the userspace gettimeofday code * to assure itself that it sees a consistent view of the tb_to_xs and @@ -270,15 +271,14 @@ static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec, * tb_to_xs and stamp_xsec values are consistent. If not, then it * loops back and reads them again until this criteria is met. */ - ++(vdso_data->tb_update_count); + ++(_systemcfg->tb_update_count); smp_wmb(); - vdso_data->tb_orig_stamp = new_tb_stamp; - vdso_data->stamp_xsec = new_stamp_xsec; - vdso_data->tb_to_xs = new_tb_to_xs; - vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; - vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; + _systemcfg->tb_orig_stamp = new_tb_stamp; + _systemcfg->stamp_xsec = new_stamp_xsec; + _systemcfg->tb_to_xs = new_tb_to_xs; smp_wmb(); - ++(vdso_data->tb_update_count); + ++(_systemcfg->tb_update_count); +#endif } /* @@ -357,8 +357,9 @@ static void iSeries_tb_recal(void) do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; tb_to_xs = divres.result_low; do_gtod.varp->tb_to_xs = tb_to_xs; - vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; - vdso_data->tb_to_xs = tb_to_xs; + _systemcfg->tb_ticks_per_sec = + tb_ticks_per_sec; + _systemcfg->tb_to_xs = tb_to_xs; } else { printk( "Titan recalibrate: FAILED (difference > 4 percent)\n" @@ -560,8 +561,10 @@ int do_settimeofday(struct timespec *tv) new_xsec += (u64)new_sec * XSEC_PER_SEC - tb_delta_xs; update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs); - vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; - vdso_data->tz_dsttime = sys_tz.tz_dsttime; +#ifdef CONFIG_PPC64 + _systemcfg->tz_minuteswest = sys_tz.tz_minuteswest; + _systemcfg->tz_dsttime = sys_tz.tz_dsttime; +#endif write_sequnlock_irqrestore(&xtime_lock, flags); clock_was_set(); @@ -710,12 +713,13 @@ void __init time_init(void) do_gtod.tb_ticks_per_sec = tb_ticks_per_sec; do_gtod.varp->tb_to_xs = tb_to_xs; do_gtod.tb_to_us = tb_to_us; - - vdso_data->tb_orig_stamp = tb_last_jiffy; - vdso_data->tb_update_count = 0; - vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; - vdso_data->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC; - vdso_data->tb_to_xs = tb_to_xs; +#ifdef CONFIG_PPC64 + _systemcfg->tb_orig_stamp = tb_last_jiffy; + _systemcfg->tb_update_count = 0; + _systemcfg->tb_ticks_per_sec = tb_ticks_per_sec; + _systemcfg->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC; + _systemcfg->tb_to_xs = tb_to_xs; +#endif time_freq = 0; diff --git a/trunk/arch/powerpc/kernel/traps.c b/trunk/arch/powerpc/kernel/traps.c index 1511454c4690..2020bb7648fb 100644 --- a/trunk/arch/powerpc/kernel/traps.c +++ b/trunk/arch/powerpc/kernel/traps.c @@ -49,6 +49,7 @@ #ifdef CONFIG_PPC64 #include #include +#include #endif #ifdef CONFIG_PPC64 /* XXX */ diff --git a/trunk/arch/powerpc/kernel/vdso.c b/trunk/arch/powerpc/kernel/vdso.c deleted file mode 100644 index 0d4d8bec0df4..000000000000 --- a/trunk/arch/powerpc/kernel/vdso.c +++ /dev/null @@ -1,746 +0,0 @@ -/* - * linux/arch/ppc64/kernel/vdso.c - * - * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp. - * - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef DEBUG - -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -#else -#define DBG(fmt...) -#endif - -/* Max supported size for symbol names */ -#define MAX_SYMNAME 64 - -extern char vdso32_start, vdso32_end; -static void *vdso32_kbase = &vdso32_start; -unsigned int vdso32_pages; -unsigned long vdso32_sigtramp; -unsigned long vdso32_rt_sigtramp; - -#ifdef CONFIG_PPC64 -extern char vdso64_start, vdso64_end; -static void *vdso64_kbase = &vdso64_start; -unsigned int vdso64_pages; -unsigned long vdso64_rt_sigtramp; -#endif /* CONFIG_PPC64 */ - -/* - * The vdso data page (aka. systemcfg for old ppc64 fans) is here. - * Once the early boot kernel code no longer needs to muck around - * with it, it will become dynamically allocated - */ -static union { - struct vdso_data data; - u8 page[PAGE_SIZE]; -} vdso_data_store __attribute__((__section__(".data.page_aligned"))); -struct vdso_data *vdso_data = &vdso_data_store.data; - -/* Format of the patch table */ -struct vdso_patch_def -{ - unsigned long ftr_mask, ftr_value; - const char *gen_name; - const char *fix_name; -}; - -/* Table of functions to patch based on the CPU type/revision - * - * Currently, we only change sync_dicache to do nothing on processors - * with a coherent icache - */ -static struct vdso_patch_def vdso_patches[] = { - { - CPU_FTR_COHERENT_ICACHE, CPU_FTR_COHERENT_ICACHE, - "__kernel_sync_dicache", "__kernel_sync_dicache_p5" - }, - { - CPU_FTR_USE_TB, 0, - "__kernel_gettimeofday", NULL - }, -}; - -/* - * Some infos carried around for each of them during parsing at - * boot time. - */ -struct lib32_elfinfo -{ - Elf32_Ehdr *hdr; /* ptr to ELF */ - Elf32_Sym *dynsym; /* ptr to .dynsym section */ - unsigned long dynsymsize; /* size of .dynsym section */ - char *dynstr; /* ptr to .dynstr section */ - unsigned long text; /* offset of .text section in .so */ -}; - -struct lib64_elfinfo -{ - Elf64_Ehdr *hdr; - Elf64_Sym *dynsym; - unsigned long dynsymsize; - char *dynstr; - unsigned long text; -}; - - -#ifdef __DEBUG -static void dump_one_vdso_page(struct page *pg, struct page *upg) -{ - printk("kpg: %p (c:%d,f:%08lx)", __va(page_to_pfn(pg) << PAGE_SHIFT), - page_count(pg), - pg->flags); - if (upg/* && pg != upg*/) { - printk(" upg: %p (c:%d,f:%08lx)", __va(page_to_pfn(upg) - << PAGE_SHIFT), - page_count(upg), - upg->flags); - } - printk("\n"); -} - -static void dump_vdso_pages(struct vm_area_struct * vma) -{ - int i; - - if (!vma || test_thread_flag(TIF_32BIT)) { - printk("vDSO32 @ %016lx:\n", (unsigned long)vdso32_kbase); - for (i=0; ivm_mm) ? - follow_page(vma->vm_mm, vma->vm_start + - i*PAGE_SIZE, 0) - : NULL; - dump_one_vdso_page(pg, upg); - } - } - if (!vma || !test_thread_flag(TIF_32BIT)) { - printk("vDSO64 @ %016lx:\n", (unsigned long)vdso64_kbase); - for (i=0; ivm_mm) ? - follow_page(vma->vm_mm, vma->vm_start + - i*PAGE_SIZE, 0) - : NULL; - dump_one_vdso_page(pg, upg); - } - } -} -#endif /* DEBUG */ - -/* - * Keep a dummy vma_close for now, it will prevent VMA merging. - */ -static void vdso_vma_close(struct vm_area_struct * vma) -{ -} - -/* - * Our nopage() function, maps in the actual vDSO kernel pages, they will - * be mapped read-only by do_no_page(), and eventually COW'ed, either - * right away for an initial write access, or by do_wp_page(). - */ -static struct page * vdso_vma_nopage(struct vm_area_struct * vma, - unsigned long address, int *type) -{ - unsigned long offset = address - vma->vm_start; - struct page *pg; -#ifdef CONFIG_PPC64 - void *vbase = test_thread_flag(TIF_32BIT) ? - vdso32_kbase : vdso64_kbase; -#else - void *vbase = vdso32_kbase; -#endif - - DBG("vdso_vma_nopage(current: %s, address: %016lx, off: %lx)\n", - current->comm, address, offset); - - if (address < vma->vm_start || address > vma->vm_end) - return NOPAGE_SIGBUS; - - /* - * Last page is systemcfg. - */ - if ((vma->vm_end - address) <= PAGE_SIZE) - pg = virt_to_page(vdso_data); - else - pg = virt_to_page(vbase + offset); - - get_page(pg); - DBG(" ->page count: %d\n", page_count(pg)); - - return pg; -} - -static struct vm_operations_struct vdso_vmops = { - .close = vdso_vma_close, - .nopage = vdso_vma_nopage, -}; - -/* - * This is called from binfmt_elf, we create the special vma for the - * vDSO and insert it into the mm struct tree - */ -int arch_setup_additional_pages(struct linux_binprm *bprm, - int executable_stack) -{ - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; - unsigned long vdso_pages; - unsigned long vdso_base; - -#ifdef CONFIG_PPC64 - if (test_thread_flag(TIF_32BIT)) { - vdso_pages = vdso32_pages; - vdso_base = VDSO32_MBASE; - } else { - vdso_pages = vdso64_pages; - vdso_base = VDSO64_MBASE; - } -#else - vdso_pages = vdso32_pages; - vdso_base = VDSO32_MBASE; -#endif - - current->thread.vdso_base = 0; - - /* vDSO has a problem and was disabled, just don't "enable" it for the - * process - */ - if (vdso_pages == 0) - return 0; - - vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); - if (vma == NULL) - return -ENOMEM; - - memset(vma, 0, sizeof(*vma)); - - /* Add a page to the vdso size for the data page */ - vdso_pages ++; - - /* - * pick a base address for the vDSO in process space. We try to put it - * at vdso_base which is the "natural" base for it, but we might fail - * and end up putting it elsewhere. - */ - vdso_base = get_unmapped_area(NULL, vdso_base, - vdso_pages << PAGE_SHIFT, 0, 0); - if (vdso_base & ~PAGE_MASK) { - kmem_cache_free(vm_area_cachep, vma); - return (int)vdso_base; - } - - current->thread.vdso_base = vdso_base; - - vma->vm_mm = mm; - vma->vm_start = current->thread.vdso_base; - vma->vm_end = vma->vm_start + (vdso_pages << PAGE_SHIFT); - - /* - * our vma flags don't have VM_WRITE so by default, the process isn't - * allowed to write those pages. - * gdb can break that with ptrace interface, and thus trigger COW on - * those pages but it's then your responsibility to never do that on - * the "data" page of the vDSO or you'll stop getting kernel updates - * and your nice userland gettimeofday will be totally dead. - * It's fine to use that for setting breakpoints in the vDSO code - * pages though - */ - vma->vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | - VM_MAYEXEC | VM_RESERVED; - vma->vm_flags |= mm->def_flags; - vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; - vma->vm_ops = &vdso_vmops; - - down_write(&mm->mmap_sem); - if (insert_vm_struct(mm, vma)) { - up_write(&mm->mmap_sem); - kmem_cache_free(vm_area_cachep, vma); - return -ENOMEM; - } - mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; - up_write(&mm->mmap_sem); - - return 0; -} - -static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname, - unsigned long *size) -{ - Elf32_Shdr *sechdrs; - unsigned int i; - char *secnames; - - /* Grab section headers and strings so we can tell who is who */ - sechdrs = (void *)ehdr + ehdr->e_shoff; - secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; - - /* Find the section they want */ - for (i = 1; i < ehdr->e_shnum; i++) { - if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) { - if (size) - *size = sechdrs[i].sh_size; - return (void *)ehdr + sechdrs[i].sh_offset; - } - } - *size = 0; - return NULL; -} - -static Elf32_Sym * __init find_symbol32(struct lib32_elfinfo *lib, - const char *symname) -{ - unsigned int i; - char name[MAX_SYMNAME], *c; - - for (i = 0; i < (lib->dynsymsize / sizeof(Elf32_Sym)); i++) { - if (lib->dynsym[i].st_name == 0) - continue; - strlcpy(name, lib->dynstr + lib->dynsym[i].st_name, - MAX_SYMNAME); - c = strchr(name, '@'); - if (c) - *c = 0; - if (strcmp(symname, name) == 0) - return &lib->dynsym[i]; - } - return NULL; -} - -/* Note that we assume the section is .text and the symbol is relative to - * the library base - */ -static unsigned long __init find_function32(struct lib32_elfinfo *lib, - const char *symname) -{ - Elf32_Sym *sym = find_symbol32(lib, symname); - - if (sym == NULL) { - printk(KERN_WARNING "vDSO32: function %s not found !\n", - symname); - return 0; - } - return sym->st_value - VDSO32_LBASE; -} - -static int vdso_do_func_patch32(struct lib32_elfinfo *v32, - struct lib64_elfinfo *v64, - const char *orig, const char *fix) -{ - Elf32_Sym *sym32_gen, *sym32_fix; - - sym32_gen = find_symbol32(v32, orig); - if (sym32_gen == NULL) { - printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", orig); - return -1; - } - if (fix == NULL) { - sym32_gen->st_name = 0; - return 0; - } - sym32_fix = find_symbol32(v32, fix); - if (sym32_fix == NULL) { - printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", fix); - return -1; - } - sym32_gen->st_value = sym32_fix->st_value; - sym32_gen->st_size = sym32_fix->st_size; - sym32_gen->st_info = sym32_fix->st_info; - sym32_gen->st_other = sym32_fix->st_other; - sym32_gen->st_shndx = sym32_fix->st_shndx; - - return 0; -} - - -#ifdef CONFIG_PPC64 - -static void * __init find_section64(Elf64_Ehdr *ehdr, const char *secname, - unsigned long *size) -{ - Elf64_Shdr *sechdrs; - unsigned int i; - char *secnames; - - /* Grab section headers and strings so we can tell who is who */ - sechdrs = (void *)ehdr + ehdr->e_shoff; - secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; - - /* Find the section they want */ - for (i = 1; i < ehdr->e_shnum; i++) { - if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) { - if (size) - *size = sechdrs[i].sh_size; - return (void *)ehdr + sechdrs[i].sh_offset; - } - } - if (size) - *size = 0; - return NULL; -} - -static Elf64_Sym * __init find_symbol64(struct lib64_elfinfo *lib, - const char *symname) -{ - unsigned int i; - char name[MAX_SYMNAME], *c; - - for (i = 0; i < (lib->dynsymsize / sizeof(Elf64_Sym)); i++) { - if (lib->dynsym[i].st_name == 0) - continue; - strlcpy(name, lib->dynstr + lib->dynsym[i].st_name, - MAX_SYMNAME); - c = strchr(name, '@'); - if (c) - *c = 0; - if (strcmp(symname, name) == 0) - return &lib->dynsym[i]; - } - return NULL; -} - -/* Note that we assume the section is .text and the symbol is relative to - * the library base - */ -static unsigned long __init find_function64(struct lib64_elfinfo *lib, - const char *symname) -{ - Elf64_Sym *sym = find_symbol64(lib, symname); - - if (sym == NULL) { - printk(KERN_WARNING "vDSO64: function %s not found !\n", - symname); - return 0; - } -#ifdef VDS64_HAS_DESCRIPTORS - return *((u64 *)(vdso64_kbase + sym->st_value - VDSO64_LBASE)) - - VDSO64_LBASE; -#else - return sym->st_value - VDSO64_LBASE; -#endif -} - -static int vdso_do_func_patch64(struct lib32_elfinfo *v32, - struct lib64_elfinfo *v64, - const char *orig, const char *fix) -{ - Elf64_Sym *sym64_gen, *sym64_fix; - - sym64_gen = find_symbol64(v64, orig); - if (sym64_gen == NULL) { - printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", orig); - return -1; - } - if (fix == NULL) { - sym64_gen->st_name = 0; - return 0; - } - sym64_fix = find_symbol64(v64, fix); - if (sym64_fix == NULL) { - printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", fix); - return -1; - } - sym64_gen->st_value = sym64_fix->st_value; - sym64_gen->st_size = sym64_fix->st_size; - sym64_gen->st_info = sym64_fix->st_info; - sym64_gen->st_other = sym64_fix->st_other; - sym64_gen->st_shndx = sym64_fix->st_shndx; - - return 0; -} - -#endif /* CONFIG_PPC64 */ - - -static __init int vdso_do_find_sections(struct lib32_elfinfo *v32, - struct lib64_elfinfo *v64) -{ - void *sect; - - /* - * Locate symbol tables & text section - */ - - v32->dynsym = find_section32(v32->hdr, ".dynsym", &v32->dynsymsize); - v32->dynstr = find_section32(v32->hdr, ".dynstr", NULL); - if (v32->dynsym == NULL || v32->dynstr == NULL) { - printk(KERN_ERR "vDSO32: required symbol section not found\n"); - return -1; - } - sect = find_section32(v32->hdr, ".text", NULL); - if (sect == NULL) { - printk(KERN_ERR "vDSO32: the .text section was not found\n"); - return -1; - } - v32->text = sect - vdso32_kbase; - -#ifdef CONFIG_PPC64 - v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize); - v64->dynstr = find_section64(v64->hdr, ".dynstr", NULL); - if (v64->dynsym == NULL || v64->dynstr == NULL) { - printk(KERN_ERR "vDSO64: required symbol section not found\n"); - return -1; - } - sect = find_section64(v64->hdr, ".text", NULL); - if (sect == NULL) { - printk(KERN_ERR "vDSO64: the .text section was not found\n"); - return -1; - } - v64->text = sect - vdso64_kbase; -#endif /* CONFIG_PPC64 */ - - return 0; -} - -static __init void vdso_setup_trampolines(struct lib32_elfinfo *v32, - struct lib64_elfinfo *v64) -{ - /* - * Find signal trampolines - */ - -#ifdef CONFIG_PPC64 - vdso64_rt_sigtramp = find_function64(v64, "__kernel_sigtramp_rt64"); -#endif - vdso32_sigtramp = find_function32(v32, "__kernel_sigtramp32"); - vdso32_rt_sigtramp = find_function32(v32, "__kernel_sigtramp_rt32"); -} - -static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32, - struct lib64_elfinfo *v64) -{ - Elf32_Sym *sym32; -#ifdef CONFIG_PPC64 - Elf64_Sym *sym64; - - sym64 = find_symbol64(v64, "__kernel_datapage_offset"); - if (sym64 == NULL) { - printk(KERN_ERR "vDSO64: Can't find symbol " - "__kernel_datapage_offset !\n"); - return -1; - } - *((int *)(vdso64_kbase + sym64->st_value - VDSO64_LBASE)) = - (vdso64_pages << PAGE_SHIFT) - - (sym64->st_value - VDSO64_LBASE); -#endif /* CONFIG_PPC64 */ - - sym32 = find_symbol32(v32, "__kernel_datapage_offset"); - if (sym32 == NULL) { - printk(KERN_ERR "vDSO32: Can't find symbol " - "__kernel_datapage_offset !\n"); - return -1; - } - *((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) = - (vdso32_pages << PAGE_SHIFT) - - (sym32->st_value - VDSO32_LBASE); - - return 0; -} - -static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32, - struct lib64_elfinfo *v64) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(vdso_patches); i++) { - struct vdso_patch_def *patch = &vdso_patches[i]; - int match = (cur_cpu_spec->cpu_features & patch->ftr_mask) - == patch->ftr_value; - if (!match) - continue; - - DBG("replacing %s with %s...\n", patch->gen_name, - patch->fix_name ? "NONE" : patch->fix_name); - - /* - * Patch the 32 bits and 64 bits symbols. Note that we do not - * patch the "." symbol on 64 bits. - * It would be easy to do, but doesn't seem to be necessary, - * patching the OPD symbol is enough. - */ - vdso_do_func_patch32(v32, v64, patch->gen_name, - patch->fix_name); -#ifdef CONFIG_PPC64 - vdso_do_func_patch64(v32, v64, patch->gen_name, - patch->fix_name); -#endif /* CONFIG_PPC64 */ - } - - return 0; -} - - -static __init int vdso_setup(void) -{ - struct lib32_elfinfo v32; - struct lib64_elfinfo v64; - - v32.hdr = vdso32_kbase; -#ifdef CONFIG_PPC64 - v64.hdr = vdso64_kbase; -#endif - if (vdso_do_find_sections(&v32, &v64)) - return -1; - - if (vdso_fixup_datapage(&v32, &v64)) - return -1; - - if (vdso_fixup_alt_funcs(&v32, &v64)) - return -1; - - vdso_setup_trampolines(&v32, &v64); - - return 0; -} - -/* - * Called from setup_arch to initialize the bitmap of available - * syscalls in the systemcfg page - */ -static void __init vdso_setup_syscall_map(void) -{ - unsigned int i; - extern unsigned long *sys_call_table; - extern unsigned long sys_ni_syscall; - - - for (i = 0; i < __NR_syscalls; i++) { -#ifdef CONFIG_PPC64 - if (sys_call_table[i*2] != sys_ni_syscall) - vdso_data->syscall_map_64[i >> 5] |= - 0x80000000UL >> (i & 0x1f); - if (sys_call_table[i*2+1] != sys_ni_syscall) - vdso_data->syscall_map_32[i >> 5] |= - 0x80000000UL >> (i & 0x1f); -#else /* CONFIG_PPC64 */ - if (sys_call_table[i] != sys_ni_syscall) - vdso_data->syscall_map_32[i >> 5] |= - 0x80000000UL >> (i & 0x1f); -#endif /* CONFIG_PPC64 */ - } -} - - -void __init vdso_init(void) -{ - int i; - -#ifdef CONFIG_PPC64 - /* - * Fill up the "systemcfg" stuff for backward compatiblity - */ - strcpy(vdso_data->eye_catcher, "SYSTEMCFG:PPC64"); - vdso_data->version.major = SYSTEMCFG_MAJOR; - vdso_data->version.minor = SYSTEMCFG_MINOR; - vdso_data->processor = mfspr(SPRN_PVR); - vdso_data->platform = _machine; - vdso_data->physicalMemorySize = lmb_phys_mem_size(); - vdso_data->dcache_size = ppc64_caches.dsize; - vdso_data->dcache_line_size = ppc64_caches.dline_size; - vdso_data->icache_size = ppc64_caches.isize; - vdso_data->icache_line_size = ppc64_caches.iline_size; - - /* - * Calculate the size of the 64 bits vDSO - */ - vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT; - DBG("vdso64_kbase: %p, 0x%x pages\n", vdso64_kbase, vdso64_pages); -#endif /* CONFIG_PPC64 */ - - - /* - * Calculate the size of the 32 bits vDSO - */ - vdso32_pages = (&vdso32_end - &vdso32_start) >> PAGE_SHIFT; - DBG("vdso32_kbase: %p, 0x%x pages\n", vdso32_kbase, vdso32_pages); - - - /* - * Setup the syscall map in the vDOS - */ - vdso_setup_syscall_map(); - /* - * Initialize the vDSO images in memory, that is do necessary - * fixups of vDSO symbols, locate trampolines, etc... - */ - if (vdso_setup()) { - printk(KERN_ERR "vDSO setup failure, not enabled !\n"); - vdso32_pages = 0; -#ifdef CONFIG_PPC64 - vdso64_pages = 0; -#endif - return; - } - - /* Make sure pages are in the correct state */ - for (i = 0; i < vdso32_pages; i++) { - struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE); - ClearPageReserved(pg); - get_page(pg); - - } -#ifdef CONFIG_PPC64 - for (i = 0; i < vdso64_pages; i++) { - struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE); - ClearPageReserved(pg); - get_page(pg); - } -#endif /* CONFIG_PPC64 */ - - get_page(virt_to_page(vdso_data)); -} - -int in_gate_area_no_task(unsigned long addr) -{ - return 0; -} - -int in_gate_area(struct task_struct *task, unsigned long addr) -{ - return 0; -} - -struct vm_area_struct *get_gate_vma(struct task_struct *tsk) -{ - return NULL; -} - diff --git a/trunk/arch/powerpc/kernel/vdso32/gettimeofday.S b/trunk/arch/powerpc/kernel/vdso32/gettimeofday.S deleted file mode 100644 index aeb5fc9b87b3..000000000000 --- a/trunk/arch/powerpc/kernel/vdso32/gettimeofday.S +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Userland implementation of gettimeofday() for 32 bits processes in a - * ppc64 kernel for use in the vDSO - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org, - * IBM Corp. - * - * 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. - */ -#include -#include -#include -#include -#include -#include - - .text -/* - * Exact prototype of gettimeofday - * - * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); - * - */ -V_FUNCTION_BEGIN(__kernel_gettimeofday) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - - mr r10,r3 /* r10 saves tv */ - mr r11,r4 /* r11 saves tz */ - bl __get_datapage@local /* get data page */ - mr r9, r3 /* datapage ptr in r9 */ - bl __do_get_xsec@local /* get xsec from tb & kernel */ - bne- 2f /* out of line -> do syscall */ - - /* seconds are xsec >> 20 */ - rlwinm r5,r4,12,20,31 - rlwimi r5,r3,12,0,19 - stw r5,TVAL32_TV_SEC(r10) - - /* get remaining xsec and convert to usec. we scale - * up remaining xsec by 12 bits and get the top 32 bits - * of the multiplication - */ - rlwinm r5,r4,12,0,19 - lis r6,1000000@h - ori r6,r6,1000000@l - mulhwu r5,r5,r6 - stw r5,TVAL32_TV_USEC(r10) - - cmpli cr0,r11,0 /* check if tz is NULL */ - beq 1f - lwz r4,CFG_TZ_MINUTEWEST(r9)/* fill tz */ - lwz r5,CFG_TZ_DSTTIME(r9) - stw r4,TZONE_TZ_MINWEST(r11) - stw r5,TZONE_TZ_DSTTIME(r11) - -1: mtlr r12 - li r3,0 - blr - -2: - mtlr r12 - mr r3,r10 - mr r4,r11 - li r0,__NR_gettimeofday - sc - blr - .cfi_endproc -V_FUNCTION_END(__kernel_gettimeofday) - -/* - * Exact prototype of clock_gettime() - * - * int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_gettime) - .cfi_startproc - /* Check for supported clock IDs */ - cmpli cr0,r3,CLOCK_REALTIME - cmpli cr1,r3,CLOCK_MONOTONIC - cror cr0,cr0,cr1 - bne cr0,99f - - mflr r12 /* r12 saves lr */ - .cfi_register lr,r12 - mr r10,r3 /* r10 saves id */ - mr r11,r4 /* r11 saves tp */ - bl __get_datapage@local /* get data page */ - mr r9, r3 /* datapage ptr in r9 */ - beq cr1,50f /* if monotonic -> jump there */ - - /* - * CLOCK_REALTIME - */ - - bl __do_get_xsec@local /* get xsec from tb & kernel */ - bne- 98f /* out of line -> do syscall */ - - /* seconds are xsec >> 20 */ - rlwinm r5,r4,12,20,31 - rlwimi r5,r3,12,0,19 - stw r5,TSPC32_TV_SEC(r11) - - /* get remaining xsec and convert to nsec. we scale - * up remaining xsec by 12 bits and get the top 32 bits - * of the multiplication, then we multiply by 1000 - */ - rlwinm r5,r4,12,0,19 - lis r6,1000000@h - ori r6,r6,1000000@l - mulhwu r5,r5,r6 - mulli r5,r5,1000 - stw r5,TSPC32_TV_NSEC(r11) - mtlr r12 - li r3,0 - blr - - /* - * CLOCK_MONOTONIC - */ - -50: bl __do_get_xsec@local /* get xsec from tb & kernel */ - bne- 98f /* out of line -> do syscall */ - - /* seconds are xsec >> 20 */ - rlwinm r6,r4,12,20,31 - rlwimi r6,r3,12,0,19 - - /* get remaining xsec and convert to nsec. we scale - * up remaining xsec by 12 bits and get the top 32 bits - * of the multiplication, then we multiply by 1000 - */ - rlwinm r7,r4,12,0,19 - lis r5,1000000@h - ori r5,r5,1000000@l - mulhwu r7,r7,r5 - mulli r7,r7,1000 - - /* now we must fixup using wall to monotonic. We need to snapshot - * that value and do the counter trick again. Fortunately, we still - * have the counter value in r8 that was returned by __do_get_xsec. - * At this point, r6,r7 contain our sec/nsec values, r3,r4 and r5 - * can be used - */ - - lwz r3,WTOM_CLOCK_SEC(r9) - lwz r4,WTOM_CLOCK_NSEC(r9) - - /* We now have our result in r3,r4. We create a fake dependency - * on that result and re-check the counter - */ - or r5,r4,r3 - xor r0,r5,r5 - add r9,r9,r0 -#ifdef CONFIG_PPC64 - lwz r0,(CFG_TB_UPDATE_COUNT+4)(r9) -#else - lwz r0,(CFG_TB_UPDATE_COUNT)(r9) -#endif - cmpl cr0,r8,r0 /* check if updated */ - bne- 50b - - /* Calculate and store result. Note that this mimmics the C code, - * which may cause funny results if nsec goes negative... is that - * possible at all ? - */ - add r3,r3,r6 - add r4,r4,r7 - lis r5,NSEC_PER_SEC@h - ori r5,r5,NSEC_PER_SEC@l - cmpli cr0,r4,r5 - blt 1f - subf r4,r5,r4 - addi r3,r3,1 -1: stw r3,TSPC32_TV_SEC(r11) - stw r4,TSPC32_TV_NSEC(r11) - - mtlr r12 - li r3,0 - blr - - /* - * syscall fallback - */ -98: - mtlr r12 - mr r3,r10 - mr r4,r11 -99: - li r0,__NR_clock_gettime - sc - blr - .cfi_endproc -V_FUNCTION_END(__kernel_clock_gettime) - - -/* - * Exact prototype of clock_getres() - * - * int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_getres) - .cfi_startproc - /* Check for supported clock IDs */ - cmpwi cr0,r3,CLOCK_REALTIME - cmpwi cr1,r3,CLOCK_MONOTONIC - cror cr0,cr0,cr1 - bne cr0,99f - - li r3,0 - cmpli cr0,r4,0 - beqlr - lis r5,CLOCK_REALTIME_RES@h - ori r5,r5,CLOCK_REALTIME_RES@l - stw r3,TSPC32_TV_SEC(r4) - stw r5,TSPC32_TV_NSEC(r4) - blr - - /* - * syscall fallback - */ -99: - li r0,__NR_clock_getres - sc - blr - .cfi_endproc -V_FUNCTION_END(__kernel_clock_getres) - - -/* - * This is the core of gettimeofday() & friends, it returns the xsec - * value in r3 & r4 and expects the datapage ptr (non clobbered) - * in r9. clobbers r0,r4,r5,r6,r7,r8. - * When returning, r8 contains the counter value that can be reused - * by the monotonic clock implementation - */ -__do_get_xsec: - .cfi_startproc - /* Check for update count & load values. We use the low - * order 32 bits of the update count - */ -#ifdef CONFIG_PPC64 -1: lwz r8,(CFG_TB_UPDATE_COUNT+4)(r9) -#else -1: lwz r8,(CFG_TB_UPDATE_COUNT)(r9) -#endif - andi. r0,r8,1 /* pending update ? loop */ - bne- 1b - xor r0,r8,r8 /* create dependency */ - add r9,r9,r0 - - /* Load orig stamp (offset to TB) */ - lwz r5,CFG_TB_ORIG_STAMP(r9) - lwz r6,(CFG_TB_ORIG_STAMP+4)(r9) - - /* Get a stable TB value */ -2: mftbu r3 - mftbl r4 - mftbu r0 - cmpl cr0,r3,r0 - bne- 2b - - /* Substract tb orig stamp. If the high part is non-zero, we jump to - * the slow path which call the syscall. - * If it's ok, then we have our 32 bits tb_ticks value in r7 - */ - subfc r7,r6,r4 - subfe. r0,r5,r3 - bne- 3f - - /* Load scale factor & do multiplication */ - lwz r5,CFG_TB_TO_XS(r9) /* load values */ - lwz r6,(CFG_TB_TO_XS+4)(r9) - mulhwu r4,r7,r5 - mulhwu r6,r7,r6 - mullw r0,r7,r5 - addc r6,r6,r0 - - /* At this point, we have the scaled xsec value in r4 + XER:CA - * we load & add the stamp since epoch - */ - lwz r5,CFG_STAMP_XSEC(r9) - lwz r6,(CFG_STAMP_XSEC+4)(r9) - adde r4,r4,r6 - addze r3,r5 - - /* We now have our result in r3,r4. We create a fake dependency - * on that result and re-check the counter - */ - or r6,r4,r3 - xor r0,r6,r6 - add r9,r9,r0 -#ifdef CONFIG_PPC64 - lwz r0,(CFG_TB_UPDATE_COUNT+4)(r9) -#else - lwz r0,(CFG_TB_UPDATE_COUNT)(r9) -#endif - cmpl cr0,r8,r0 /* check if updated */ - bne- 1b - - /* Warning ! The caller expects CR:EQ to be set to indicate a - * successful calculation (so it won't fallback to the syscall - * method). We have overriden that CR bit in the counter check, - * but fortunately, the loop exit condition _is_ CR:EQ set, so - * we can exit safely here. If you change this code, be careful - * of that side effect. - */ -3: blr - .cfi_endproc diff --git a/trunk/arch/powerpc/kernel/vdso64/gettimeofday.S b/trunk/arch/powerpc/kernel/vdso64/gettimeofday.S deleted file mode 100644 index d371c02a8c0e..000000000000 --- a/trunk/arch/powerpc/kernel/vdso64/gettimeofday.S +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Userland implementation of gettimeofday() for 64 bits processes in a - * ppc64 kernel for use in the vDSO - * - * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), - * IBM Corp. - * - * 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. - */ -#include -#include -#include -#include -#include -#include - - .text -/* - * Exact prototype of gettimeofday - * - * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); - * - */ -V_FUNCTION_BEGIN(__kernel_gettimeofday) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - - mr r11,r3 /* r11 holds tv */ - mr r10,r4 /* r10 holds tz */ - bl V_LOCAL_FUNC(__get_datapage) /* get data page */ - bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ - lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */ - ori r7,r7,16960 - rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */ - rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */ - std r5,TVAL64_TV_SEC(r11) /* store sec in tv */ - subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */ - mulld r0,r0,r7 /* usec = (xsec * USEC_PER_SEC) / - * XSEC_PER_SEC - */ - rldicl r0,r0,44,20 - cmpldi cr0,r10,0 /* check if tz is NULL */ - std r0,TVAL64_TV_USEC(r11) /* store usec in tv */ - beq 1f - lwz r4,CFG_TZ_MINUTEWEST(r3)/* fill tz */ - lwz r5,CFG_TZ_DSTTIME(r3) - stw r4,TZONE_TZ_MINWEST(r10) - stw r5,TZONE_TZ_DSTTIME(r10) -1: mtlr r12 - li r3,0 /* always success */ - blr - .cfi_endproc -V_FUNCTION_END(__kernel_gettimeofday) - - -/* - * Exact prototype of clock_gettime() - * - * int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_gettime) - .cfi_startproc - /* Check for supported clock IDs */ - cmpwi cr0,r3,CLOCK_REALTIME - cmpwi cr1,r3,CLOCK_MONOTONIC - cror cr0,cr0,cr1 - bne cr0,99f - - mflr r12 /* r12 saves lr */ - .cfi_register lr,r12 - mr r10,r3 /* r10 saves id */ - mr r11,r4 /* r11 saves tp */ - bl V_LOCAL_FUNC(__get_datapage) /* get data page */ - beq cr1,50f /* if monotonic -> jump there */ - - /* - * CLOCK_REALTIME - */ - - bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ - - lis r7,0x3b9a /* r7 = 1000000000 = NSEC_PER_SEC */ - ori r7,r7,0xca00 - rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */ - rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */ - std r5,TSPC64_TV_SEC(r11) /* store sec in tv */ - subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */ - mulld r0,r0,r7 /* nsec = (xsec * NSEC_PER_SEC) / - * XSEC_PER_SEC - */ - rldicl r0,r0,44,20 - std r0,TSPC64_TV_NSEC(r11) /* store nsec in tp */ - - mtlr r12 - li r3,0 - blr - - /* - * CLOCK_MONOTONIC - */ - -50: bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ - - lis r7,0x3b9a /* r7 = 1000000000 = NSEC_PER_SEC */ - ori r7,r7,0xca00 - rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */ - rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */ - subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */ - mulld r0,r0,r7 /* nsec = (xsec * NSEC_PER_SEC) / - * XSEC_PER_SEC - */ - rldicl r6,r0,44,20 - - /* now we must fixup using wall to monotonic. We need to snapshot - * that value and do the counter trick again. Fortunately, we still - * have the counter value in r8 that was returned by __do_get_xsec. - * At this point, r5,r6 contain our sec/nsec values. - * can be used - */ - - lwz r4,WTOM_CLOCK_SEC(r9) - lwz r7,WTOM_CLOCK_NSEC(r9) - - /* We now have our result in r4,r7. We create a fake dependency - * on that result and re-check the counter - */ - or r9,r4,r7 - xor r0,r9,r9 - add r3,r3,r0 - ld r0,CFG_TB_UPDATE_COUNT(r3) - cmpld cr0,r0,r8 /* check if updated */ - bne- 50b - - /* Calculate and store result. Note that this mimmics the C code, - * which may cause funny results if nsec goes negative... is that - * possible at all ? - */ - add r4,r4,r5 - add r7,r7,r6 - lis r9,NSEC_PER_SEC@h - ori r9,r9,NSEC_PER_SEC@l - cmpli cr0,r7,r9 - blt 1f - subf r7,r9,r7 - addi r4,r4,1 -1: std r4,TSPC64_TV_SEC(r11) - std r7,TSPC64_TV_NSEC(r11) - - mtlr r12 - li r3,0 - blr - - /* - * syscall fallback - */ -98: - mtlr r12 - mr r3,r10 - mr r4,r11 -99: - li r0,__NR_clock_gettime - sc - blr - .cfi_endproc -V_FUNCTION_END(__kernel_clock_gettime) - - -/* - * Exact prototype of clock_getres() - * - * int __kernel_clock_getres(clockid_t clock_id, struct timespec *res); - * - */ -V_FUNCTION_BEGIN(__kernel_clock_getres) - .cfi_startproc - /* Check for supported clock IDs */ - cmpwi cr0,r3,CLOCK_REALTIME - cmpwi cr1,r3,CLOCK_MONOTONIC - cror cr0,cr0,cr1 - bne cr0,99f - - li r3,0 - cmpli cr0,r4,0 - beqlr - lis r5,CLOCK_REALTIME_RES@h - ori r5,r5,CLOCK_REALTIME_RES@l - std r3,TSPC64_TV_SEC(r4) - std r5,TSPC64_TV_NSEC(r4) - blr - - /* - * syscall fallback - */ -99: - li r0,__NR_clock_getres - sc - blr - .cfi_endproc -V_FUNCTION_END(__kernel_clock_getres) - - -/* - * This is the core of gettimeofday(), it returns the xsec - * value in r4 and expects the datapage ptr (non clobbered) - * in r3. clobbers r0,r4,r5,r6,r7,r8 - * When returning, r8 contains the counter value that can be reused - */ -V_FUNCTION_BEGIN(__do_get_xsec) - .cfi_startproc - /* check for update count & load values */ -1: ld r8,CFG_TB_UPDATE_COUNT(r3) - andi. r0,r4,1 /* pending update ? loop */ - bne- 1b - xor r0,r4,r4 /* create dependency */ - add r3,r3,r0 - - /* Get TB & offset it */ - mftb r7 - ld r9,CFG_TB_ORIG_STAMP(r3) - subf r7,r9,r7 - - /* Scale result */ - ld r5,CFG_TB_TO_XS(r3) - mulhdu r7,r7,r5 - - /* Add stamp since epoch */ - ld r6,CFG_STAMP_XSEC(r3) - add r4,r6,r7 - - xor r0,r4,r4 - add r3,r3,r0 - ld r0,CFG_TB_UPDATE_COUNT(r3) - cmpld cr0,r0,r8 /* check if updated */ - bne- 1b - blr - .cfi_endproc -V_FUNCTION_END(__do_get_xsec) diff --git a/trunk/arch/powerpc/mm/mem.c b/trunk/arch/powerpc/mm/mem.c index e2c95fcb8055..1dd3cc69a490 100644 --- a/trunk/arch/powerpc/mm/mem.c +++ b/trunk/arch/powerpc/mm/mem.c @@ -46,7 +46,9 @@ #include #include #include +#ifdef CONFIG_PPC64 #include +#endif #include "mmu_decl.h" @@ -395,8 +397,10 @@ void __init mem_init(void) mem_init_done = 1; +#ifdef CONFIG_PPC64 /* Initialize the vDSO */ vdso_init(); +#endif } /* diff --git a/trunk/arch/powerpc/mm/numa.c b/trunk/arch/powerpc/mm/numa.c index bd2cf1336885..da09ba03c424 100644 --- a/trunk/arch/powerpc/mm/numa.c +++ b/trunk/arch/powerpc/mm/numa.c @@ -17,8 +17,9 @@ #include #include #include -#include #include +#include +#include #include #include @@ -27,113 +28,45 @@ static int numa_enabled = 1; static int numa_debug; #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); } -int numa_cpu_lookup_table[NR_CPUS]; -cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES]; -struct pglist_data *node_data[MAX_NUMNODES]; +#ifdef DEBUG_NUMA +#define ARRAY_INITIALISER -1 +#else +#define ARRAY_INITIALISER 0 +#endif -EXPORT_SYMBOL(numa_cpu_lookup_table); -EXPORT_SYMBOL(numa_cpumask_lookup_table); -EXPORT_SYMBOL(node_data); +int numa_cpu_lookup_table[NR_CPUS] = { [ 0 ... (NR_CPUS - 1)] = + ARRAY_INITIALISER}; +char *numa_memory_lookup_table; +cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES]; +int nr_cpus_in_node[MAX_NUMNODES] = { [0 ... (MAX_NUMNODES -1)] = 0}; -static bootmem_data_t __initdata plat_node_bdata[MAX_NUMNODES]; +struct pglist_data *node_data[MAX_NUMNODES]; +bootmem_data_t __initdata plat_node_bdata[MAX_NUMNODES]; static int min_common_depth; /* - * We need somewhere to store start/end/node for each region until we have + * We need somewhere to store start/span for each node until we have * allocated the real node_data structures. */ -#define MAX_REGIONS (MAX_LMB_REGIONS*2) static struct { - unsigned long start_pfn; - unsigned long end_pfn; - int nid; -} init_node_data[MAX_REGIONS] __initdata; - -int __init early_pfn_to_nid(unsigned long pfn) -{ - unsigned int i; - - for (i = 0; init_node_data[i].end_pfn; i++) { - unsigned long start_pfn = init_node_data[i].start_pfn; - unsigned long end_pfn = init_node_data[i].end_pfn; - - if ((start_pfn <= pfn) && (pfn < end_pfn)) - return init_node_data[i].nid; - } - - return -1; -} - -void __init add_region(unsigned int nid, unsigned long start_pfn, - unsigned long pages) -{ - unsigned int i; - - dbg("add_region nid %d start_pfn 0x%lx pages 0x%lx\n", - nid, start_pfn, pages); - - for (i = 0; init_node_data[i].end_pfn; i++) { - if (init_node_data[i].nid != nid) - continue; - if (init_node_data[i].end_pfn == start_pfn) { - init_node_data[i].end_pfn += pages; - return; - } - if (init_node_data[i].start_pfn == (start_pfn + pages)) { - init_node_data[i].start_pfn -= pages; - return; - } - } - - /* - * Leave last entry NULL so we dont iterate off the end (we use - * entry.end_pfn to terminate the walk). - */ - if (i >= (MAX_REGIONS - 1)) { - printk(KERN_ERR "WARNING: too many memory regions in " - "numa code, truncating\n"); - return; - } - - init_node_data[i].start_pfn = start_pfn; - init_node_data[i].end_pfn = start_pfn + pages; - init_node_data[i].nid = nid; -} - -/* We assume init_node_data has no overlapping regions */ -void __init get_region(unsigned int nid, unsigned long *start_pfn, - unsigned long *end_pfn, unsigned long *pages_present) -{ - unsigned int i; - - *start_pfn = -1UL; - *end_pfn = *pages_present = 0; - - for (i = 0; init_node_data[i].end_pfn; i++) { - if (init_node_data[i].nid != nid) - continue; - - *pages_present += init_node_data[i].end_pfn - - init_node_data[i].start_pfn; - - if (init_node_data[i].start_pfn < *start_pfn) - *start_pfn = init_node_data[i].start_pfn; + unsigned long node_start_pfn; + unsigned long node_end_pfn; + unsigned long node_present_pages; +} init_node_data[MAX_NUMNODES] __initdata; - if (init_node_data[i].end_pfn > *end_pfn) - *end_pfn = init_node_data[i].end_pfn; - } - - /* We didnt find a matching region, return start/end as 0 */ - if (*start_pfn == -1UL) - start_pfn = 0; -} +EXPORT_SYMBOL(node_data); +EXPORT_SYMBOL(numa_cpu_lookup_table); +EXPORT_SYMBOL(numa_memory_lookup_table); +EXPORT_SYMBOL(numa_cpumask_lookup_table); +EXPORT_SYMBOL(nr_cpus_in_node); static inline void map_cpu_to_node(int cpu, int node) { numa_cpu_lookup_table[cpu] = node; - - if (!(cpu_isset(cpu, numa_cpumask_lookup_table[node]))) + if (!(cpu_isset(cpu, numa_cpumask_lookup_table[node]))) { cpu_set(cpu, numa_cpumask_lookup_table[node]); + nr_cpus_in_node[node]++; + } } #ifdef CONFIG_HOTPLUG_CPU @@ -145,6 +78,7 @@ static void unmap_cpu_from_node(unsigned long cpu) if (cpu_isset(cpu, numa_cpumask_lookup_table[node])) { cpu_clear(cpu, numa_cpumask_lookup_table[node]); + nr_cpus_in_node[node]--; } else { printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n", cpu, node); @@ -152,7 +86,7 @@ static void unmap_cpu_from_node(unsigned long cpu) } #endif /* CONFIG_HOTPLUG_CPU */ -static struct device_node *find_cpu_node(unsigned int cpu) +static struct device_node * __devinit find_cpu_node(unsigned int cpu) { unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); struct device_node *cpu_node = NULL; @@ -279,7 +213,7 @@ static int __init get_mem_size_cells(void) return rc; } -static unsigned long __init read_n_cells(int n, unsigned int **buf) +static unsigned long read_n_cells(int n, unsigned int **buf) { unsigned long result = 0; @@ -361,8 +295,7 @@ static int cpu_numa_callback(struct notifier_block *nfb, * or zero. If the returned value of size is 0 the region should be * discarded as it lies wholy above the memory limit. */ -static unsigned long __init numa_enforce_memory_limit(unsigned long start, - unsigned long size) +static unsigned long __init numa_enforce_memory_limit(unsigned long start, unsigned long size) { /* * We use lmb_end_of_DRAM() in here instead of memory_limit because @@ -387,7 +320,8 @@ static int __init parse_numa_properties(void) struct device_node *cpu = NULL; struct device_node *memory = NULL; int addr_cells, size_cells; - int max_domain; + int max_domain = 0; + long entries = lmb_end_of_DRAM() >> MEMORY_INCREMENT_SHIFT; unsigned long i; if (numa_enabled == 0) { @@ -395,6 +329,13 @@ static int __init parse_numa_properties(void) return -1; } + numa_memory_lookup_table = + (char *)abs_to_virt(lmb_alloc(entries * sizeof(char), 1)); + memset(numa_memory_lookup_table, 0, entries * sizeof(char)); + + for (i = 0; i < entries ; i++) + numa_memory_lookup_table[i] = ARRAY_INITIALISER; + min_common_depth = find_min_common_depth(); dbg("NUMA associativity depth for CPU/Memory: %d\n", min_common_depth); @@ -446,6 +387,9 @@ static int __init parse_numa_properties(void) start = read_n_cells(addr_cells, &memcell_buf); size = read_n_cells(size_cells, &memcell_buf); + start = _ALIGN_DOWN(start, MEMORY_INCREMENT); + size = _ALIGN_UP(size, MEMORY_INCREMENT); + numa_domain = of_node_numa_domain(memory); if (numa_domain >= MAX_NUMNODES) { @@ -459,15 +403,44 @@ static int __init parse_numa_properties(void) if (max_domain < numa_domain) max_domain = numa_domain; - if (!(size = numa_enforce_memory_limit(start, size))) { + if (! (size = numa_enforce_memory_limit(start, size))) { if (--ranges) goto new_range; else continue; } - add_region(numa_domain, start >> PAGE_SHIFT, - size >> PAGE_SHIFT); + /* + * Initialize new node struct, or add to an existing one. + */ + if (init_node_data[numa_domain].node_end_pfn) { + if ((start / PAGE_SIZE) < + init_node_data[numa_domain].node_start_pfn) + init_node_data[numa_domain].node_start_pfn = + start / PAGE_SIZE; + if (((start / PAGE_SIZE) + (size / PAGE_SIZE)) > + init_node_data[numa_domain].node_end_pfn) + init_node_data[numa_domain].node_end_pfn = + (start / PAGE_SIZE) + + (size / PAGE_SIZE); + + init_node_data[numa_domain].node_present_pages += + size / PAGE_SIZE; + } else { + node_set_online(numa_domain); + + init_node_data[numa_domain].node_start_pfn = + start / PAGE_SIZE; + init_node_data[numa_domain].node_end_pfn = + init_node_data[numa_domain].node_start_pfn + + size / PAGE_SIZE; + init_node_data[numa_domain].node_present_pages = + size / PAGE_SIZE; + } + + for (i = start ; i < (start+size); i += MEMORY_INCREMENT) + numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = + numa_domain; if (--ranges) goto new_range; @@ -483,15 +456,32 @@ static void __init setup_nonnuma(void) { unsigned long top_of_ram = lmb_end_of_DRAM(); unsigned long total_ram = lmb_phys_mem_size(); + unsigned long i; printk(KERN_INFO "Top of RAM: 0x%lx, Total RAM: 0x%lx\n", top_of_ram, total_ram); printk(KERN_INFO "Memory hole size: %ldMB\n", (top_of_ram - total_ram) >> 20); + if (!numa_memory_lookup_table) { + long entries = top_of_ram >> MEMORY_INCREMENT_SHIFT; + numa_memory_lookup_table = + (char *)abs_to_virt(lmb_alloc(entries * sizeof(char), 1)); + memset(numa_memory_lookup_table, 0, entries * sizeof(char)); + for (i = 0; i < entries ; i++) + numa_memory_lookup_table[i] = ARRAY_INITIALISER; + } + map_cpu_to_node(boot_cpuid, 0); - add_region(0, 0, lmb_end_of_DRAM() >> PAGE_SHIFT); + node_set_online(0); + + init_node_data[0].node_start_pfn = 0; + init_node_data[0].node_end_pfn = lmb_end_of_DRAM() / PAGE_SIZE; + init_node_data[0].node_present_pages = total_ram / PAGE_SIZE; + + for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT) + numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0; } static void __init dump_numa_topology(void) @@ -509,9 +499,8 @@ static void __init dump_numa_topology(void) count = 0; - for (i = 0; i < lmb_end_of_DRAM(); - i += (1 << SECTION_SIZE_BITS)) { - if (early_pfn_to_nid(i >> PAGE_SHIFT) == node) { + for (i = 0; i < lmb_end_of_DRAM(); i += MEMORY_INCREMENT) { + if (numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] == node) { if (count == 0) printk(" 0x%lx", i); ++count; @@ -536,12 +525,10 @@ static void __init dump_numa_topology(void) * * Returns the physical address of the memory. */ -static void __init *careful_allocation(int nid, unsigned long size, - unsigned long align, - unsigned long end_pfn) +static unsigned long careful_allocation(int nid, unsigned long size, + unsigned long align, unsigned long end) { - int new_nid; - unsigned long ret = lmb_alloc_base(size, align, end_pfn << PAGE_SHIFT); + unsigned long ret = lmb_alloc_base(size, align, end); /* retry over all memory */ if (!ret) @@ -555,27 +542,28 @@ static void __init *careful_allocation(int nid, unsigned long size, * If the memory came from a previously allocated node, we must * retry with the bootmem allocator. */ - new_nid = early_pfn_to_nid(ret >> PAGE_SHIFT); - if (new_nid < nid) { - ret = (unsigned long)__alloc_bootmem_node(NODE_DATA(new_nid), + if (pa_to_nid(ret) < nid) { + nid = pa_to_nid(ret); + ret = (unsigned long)__alloc_bootmem_node(NODE_DATA(nid), size, align, 0); if (!ret) panic("numa.c: cannot allocate %lu bytes on node %d", - size, new_nid); + size, nid); - ret = __pa(ret); + ret = virt_to_abs(ret); dbg("alloc_bootmem %lx %lx\n", ret, size); } - return (void *)ret; + return ret; } void __init do_init_bootmem(void) { int nid; - unsigned int i; + int addr_cells, size_cells; + struct device_node *memory = NULL; static struct notifier_block ppc64_numa_nb = { .notifier_call = cpu_numa_callback, .priority = 1 /* Must run before sched domains notifier. */ @@ -593,66 +581,99 @@ void __init do_init_bootmem(void) register_cpu_notifier(&ppc64_numa_nb); for_each_online_node(nid) { - unsigned long start_pfn, end_pfn, pages_present; + unsigned long start_paddr, end_paddr; + int i; unsigned long bootmem_paddr; unsigned long bootmap_pages; - get_region(nid, &start_pfn, &end_pfn, &pages_present); + start_paddr = init_node_data[nid].node_start_pfn * PAGE_SIZE; + end_paddr = init_node_data[nid].node_end_pfn * PAGE_SIZE; /* Allocate the node structure node local if possible */ - NODE_DATA(nid) = careful_allocation(nid, + NODE_DATA(nid) = (struct pglist_data *)careful_allocation(nid, sizeof(struct pglist_data), - SMP_CACHE_BYTES, end_pfn); - NODE_DATA(nid) = __va(NODE_DATA(nid)); + SMP_CACHE_BYTES, end_paddr); + NODE_DATA(nid) = abs_to_virt(NODE_DATA(nid)); memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); dbg("node %d\n", nid); dbg("NODE_DATA() = %p\n", NODE_DATA(nid)); NODE_DATA(nid)->bdata = &plat_node_bdata[nid]; - NODE_DATA(nid)->node_start_pfn = start_pfn; - NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; + NODE_DATA(nid)->node_start_pfn = + init_node_data[nid].node_start_pfn; + NODE_DATA(nid)->node_spanned_pages = + end_paddr - start_paddr; if (NODE_DATA(nid)->node_spanned_pages == 0) continue; - dbg("start_paddr = %lx\n", start_pfn << PAGE_SHIFT); - dbg("end_paddr = %lx\n", end_pfn << PAGE_SHIFT); + dbg("start_paddr = %lx\n", start_paddr); + dbg("end_paddr = %lx\n", end_paddr); - bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); - bootmem_paddr = (unsigned long)careful_allocation(nid, - bootmap_pages << PAGE_SHIFT, - PAGE_SIZE, end_pfn); - memset(__va(bootmem_paddr), 0, bootmap_pages << PAGE_SHIFT); + bootmap_pages = bootmem_bootmap_pages((end_paddr - start_paddr) >> PAGE_SHIFT); + bootmem_paddr = careful_allocation(nid, + bootmap_pages << PAGE_SHIFT, + PAGE_SIZE, end_paddr); + memset(abs_to_virt(bootmem_paddr), 0, + bootmap_pages << PAGE_SHIFT); dbg("bootmap_paddr = %lx\n", bootmem_paddr); init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT, - start_pfn, end_pfn); + start_paddr >> PAGE_SHIFT, + end_paddr >> PAGE_SHIFT); - /* Add free regions on this node */ - for (i = 0; init_node_data[i].end_pfn; i++) { - unsigned long start, end; + /* + * We need to do another scan of all memory sections to + * associate memory with the correct node. + */ + addr_cells = get_mem_addr_cells(); + size_cells = get_mem_size_cells(); + memory = NULL; + while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { + unsigned long mem_start, mem_size; + int numa_domain, ranges; + unsigned int *memcell_buf; + unsigned int len; + + memcell_buf = (unsigned int *)get_property(memory, "reg", &len); + if (!memcell_buf || len <= 0) + continue; - if (init_node_data[i].nid != nid) + ranges = memory->n_addrs; /* ranges in cell */ +new_range: + mem_start = read_n_cells(addr_cells, &memcell_buf); + mem_size = read_n_cells(size_cells, &memcell_buf); + if (numa_enabled) { + numa_domain = of_node_numa_domain(memory); + if (numa_domain >= MAX_NUMNODES) + numa_domain = 0; + } else + numa_domain = 0; + + if (numa_domain != nid) continue; - start = init_node_data[i].start_pfn << PAGE_SHIFT; - end = init_node_data[i].end_pfn << PAGE_SHIFT; + mem_size = numa_enforce_memory_limit(mem_start, mem_size); + if (mem_size) { + dbg("free_bootmem %lx %lx\n", mem_start, mem_size); + free_bootmem_node(NODE_DATA(nid), mem_start, mem_size); + } - dbg("free_bootmem %lx %lx\n", start, end - start); - free_bootmem_node(NODE_DATA(nid), start, end - start); + if (--ranges) /* process all ranges in cell */ + goto new_range; } - /* Mark reserved regions on this node */ + /* + * Mark reserved regions on this node + */ for (i = 0; i < lmb.reserved.cnt; i++) { unsigned long physbase = lmb.reserved.region[i].base; unsigned long size = lmb.reserved.region[i].size; - unsigned long start_paddr = start_pfn << PAGE_SHIFT; - unsigned long end_paddr = end_pfn << PAGE_SHIFT; - if (early_pfn_to_nid(physbase >> PAGE_SHIFT) != nid && - early_pfn_to_nid((physbase+size-1) >> PAGE_SHIFT) != nid) + if (pa_to_nid(physbase) != nid && + pa_to_nid(physbase+size-1) != nid) continue; if (physbase < end_paddr && @@ -672,19 +693,46 @@ void __init do_init_bootmem(void) size); } } + /* + * This loop may look famaliar, but we have to do it again + * after marking our reserved memory to mark memory present + * for sparsemem. + */ + addr_cells = get_mem_addr_cells(); + size_cells = get_mem_size_cells(); + memory = NULL; + while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { + unsigned long mem_start, mem_size; + int numa_domain, ranges; + unsigned int *memcell_buf; + unsigned int len; + + memcell_buf = (unsigned int *)get_property(memory, "reg", &len); + if (!memcell_buf || len <= 0) + continue; - /* Add regions into sparsemem */ - for (i = 0; init_node_data[i].end_pfn; i++) { - unsigned long start, end; - - if (init_node_data[i].nid != nid) + ranges = memory->n_addrs; /* ranges in cell */ +new_range2: + mem_start = read_n_cells(addr_cells, &memcell_buf); + mem_size = read_n_cells(size_cells, &memcell_buf); + if (numa_enabled) { + numa_domain = of_node_numa_domain(memory); + if (numa_domain >= MAX_NUMNODES) + numa_domain = 0; + } else + numa_domain = 0; + + if (numa_domain != nid) continue; - start = init_node_data[i].start_pfn; - end = init_node_data[i].end_pfn; + mem_size = numa_enforce_memory_limit(mem_start, mem_size); + memory_present(numa_domain, mem_start >> PAGE_SHIFT, + (mem_start + mem_size) >> PAGE_SHIFT); - memory_present(nid, start, end); + if (--ranges) /* process all ranges in cell */ + goto new_range2; } + } } @@ -698,18 +746,21 @@ void __init paging_init(void) memset(zholes_size, 0, sizeof(zholes_size)); for_each_online_node(nid) { - unsigned long start_pfn, end_pfn, pages_present; + unsigned long start_pfn; + unsigned long end_pfn; - get_region(nid, &start_pfn, &end_pfn, &pages_present); + start_pfn = init_node_data[nid].node_start_pfn; + end_pfn = init_node_data[nid].node_end_pfn; zones_size[ZONE_DMA] = end_pfn - start_pfn; - zholes_size[ZONE_DMA] = zones_size[ZONE_DMA] - pages_present; + zholes_size[ZONE_DMA] = zones_size[ZONE_DMA] - + init_node_data[nid].node_present_pages; dbg("free_area_init node %d %lx %lx (hole: %lx)\n", nid, zones_size[ZONE_DMA], start_pfn, zholes_size[ZONE_DMA]); - free_area_init_node(nid, NODE_DATA(nid), zones_size, start_pfn, - zholes_size); + free_area_init_node(nid, NODE_DATA(nid), zones_size, + start_pfn, zholes_size); } } diff --git a/trunk/arch/powerpc/oprofile/op_model_power4.c b/trunk/arch/powerpc/oprofile/op_model_power4.c index a3401b46f3ba..e3a024e324b6 100644 --- a/trunk/arch/powerpc/oprofile/op_model_power4.c +++ b/trunk/arch/powerpc/oprofile/op_model_power4.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/powerpc/platforms/pseries/rtasd.c b/trunk/arch/powerpc/platforms/pseries/rtasd.c index a6f628d4c9dc..00cf331a1dc4 100644 --- a/trunk/arch/powerpc/platforms/pseries/rtasd.c +++ b/trunk/arch/powerpc/platforms/pseries/rtasd.c @@ -27,6 +27,7 @@ #include #include #include +#include #if 0 #define DEBUG(A...) printk(KERN_ERR A) diff --git a/trunk/arch/powerpc/platforms/pseries/setup.c b/trunk/arch/powerpc/platforms/pseries/setup.c index 31990829310c..e94247c28d42 100644 --- a/trunk/arch/powerpc/platforms/pseries/setup.c +++ b/trunk/arch/powerpc/platforms/pseries/setup.c @@ -306,7 +306,9 @@ static void __init fw_feature_init(void) } of_node_put(dn); -no_rtas: + no_rtas: + printk(KERN_INFO "firmware_features = 0x%lx\n", + ppc64_firmware_features); DBG(" <- fw_feature_init()\n"); } diff --git a/trunk/arch/powerpc/platforms/pseries/smp.c b/trunk/arch/powerpc/platforms/pseries/smp.c index 5800cde7d5ad..3ba794ca3288 100644 --- a/trunk/arch/powerpc/platforms/pseries/smp.c +++ b/trunk/arch/powerpc/platforms/pseries/smp.c @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include "plpar_wrappers.h" @@ -97,7 +97,7 @@ int pSeries_cpu_disable(void) int cpu = smp_processor_id(); cpu_clear(cpu, cpu_online_map); - vdso_data->processorCount--; + _systemcfg->processorCount--; /*fix boot_cpuid here*/ if (cpu == boot_cpuid) diff --git a/trunk/arch/powerpc/xmon/xmon.c b/trunk/arch/powerpc/xmon/xmon.c index ef4356b29a97..cfcb2a56d662 100644 --- a/trunk/arch/powerpc/xmon/xmon.c +++ b/trunk/arch/powerpc/xmon/xmon.c @@ -1467,23 +1467,17 @@ read_spr(int n) { unsigned int instrs[2]; unsigned long (*code)(void); - unsigned long ret = -1UL; -#ifdef CONFIG_PPC64 unsigned long opd[3]; + unsigned long ret = -1UL; + instrs[0] = 0x7c6002a6 + ((n & 0x1F) << 16) + ((n & 0x3e0) << 6); + instrs[1] = 0x4e800020; opd[0] = (unsigned long)instrs; opd[1] = 0; opd[2] = 0; - code = (unsigned long (*)(void)) opd; -#else - code = (unsigned long (*)(void)) instrs; -#endif - - /* mfspr r3,n; blr */ - instrs[0] = 0x7c6002a6 + ((n & 0x1F) << 16) + ((n & 0x3e0) << 6); - instrs[1] = 0x4e800020; store_inst(instrs); store_inst(instrs+1); + code = (unsigned long (*)(void)) opd; if (setjmp(bus_error_jmp) == 0) { catch_memory_errors = 1; @@ -1505,21 +1499,16 @@ write_spr(int n, unsigned long val) { unsigned int instrs[2]; unsigned long (*code)(unsigned long); -#ifdef CONFIG_PPC64 unsigned long opd[3]; + instrs[0] = 0x7c6003a6 + ((n & 0x1F) << 16) + ((n & 0x3e0) << 6); + instrs[1] = 0x4e800020; opd[0] = (unsigned long)instrs; opd[1] = 0; opd[2] = 0; - code = (unsigned long (*)(unsigned long)) opd; -#else - code = (unsigned long (*)(unsigned long)) instrs; -#endif - - instrs[0] = 0x7c6003a6 + ((n & 0x1F) << 16) + ((n & 0x3e0) << 6); - instrs[1] = 0x4e800020; store_inst(instrs); store_inst(instrs+1); + code = (unsigned long (*)(unsigned long)) opd; if (setjmp(bus_error_jmp) == 0) { catch_memory_errors = 1; diff --git a/trunk/arch/ppc/kernel/asm-offsets.c b/trunk/arch/ppc/kernel/asm-offsets.c index fe0e767fb94e..968261d69572 100644 --- a/trunk/arch/ppc/kernel/asm-offsets.c +++ b/trunk/arch/ppc/kernel/asm-offsets.c @@ -25,7 +25,6 @@ #include #include #include -#include #define DEFINE(sym, val) \ asm volatile("\n->" #sym " %0 " #val : : "i" (val)) @@ -144,32 +143,5 @@ main(void) DEFINE(TASK_SIZE, TASK_SIZE); DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); - - /* datapage offsets for use by vdso */ - DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct vdso_data, tb_orig_stamp)); - DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct vdso_data, tb_ticks_per_sec)); - DEFINE(CFG_TB_TO_XS, offsetof(struct vdso_data, tb_to_xs)); - DEFINE(CFG_STAMP_XSEC, offsetof(struct vdso_data, stamp_xsec)); - DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct vdso_data, tb_update_count)); - DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct vdso_data, tz_minuteswest)); - DEFINE(CFG_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime)); - DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32)); - DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec)); - DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); - DEFINE(TVAL32_TV_SEC, offsetof(struct timeval, tv_sec)); - DEFINE(TVAL32_TV_USEC, offsetof(struct timeval, tv_usec)); - DEFINE(TSPEC32_TV_SEC, offsetof(struct timespec, tv_sec)); - DEFINE(TSPEC32_TV_NSEC, offsetof(struct timespec, tv_nsec)); - - /* timeval/timezone offsets for use by vdso */ - DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest)); - DEFINE(TZONE_TZ_DSTTIME, offsetof(struct timezone, tz_dsttime)); - - /* Other bits used by the vdso */ - DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); - DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); - DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); - DEFINE(CLOCK_REALTIME_RES, TICK_NSEC); - return 0; } diff --git a/trunk/arch/ppc/syslib/cpm2_pic.c b/trunk/arch/ppc/syslib/cpm2_pic.c index 29d95d415ceb..c867be6981cb 100644 --- a/trunk/arch/ppc/syslib/cpm2_pic.c +++ b/trunk/arch/ppc/syslib/cpm2_pic.c @@ -37,7 +37,7 @@ static u_char irq_to_siureg[] = { static u_char irq_to_siubit[] = { 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, - 2, 1, 0, 14, 13, 12, 11, 10, + 2, 1, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 0, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, diff --git a/trunk/arch/ppc64/Kconfig b/trunk/arch/ppc64/Kconfig index 9d10c12e87fe..c9d32db9d76a 100644 --- a/trunk/arch/ppc64/Kconfig +++ b/trunk/arch/ppc64/Kconfig @@ -279,12 +279,17 @@ config ARCH_FLATMEM_ENABLE def_bool y depends on !NUMA -config ARCH_SPARSEMEM_ENABLE +config ARCH_DISCONTIGMEM_ENABLE + def_bool y + depends on SMP && PPC_PSERIES + +config ARCH_DISCONTIGMEM_DEFAULT def_bool y + depends on ARCH_DISCONTIGMEM_ENABLE -config ARCH_SPARSEMEM_DEFAULT +config ARCH_SPARSEMEM_ENABLE def_bool y - depends on NUMA + depends on ARCH_DISCONTIGMEM_ENABLE source "mm/Kconfig" diff --git a/trunk/arch/ppc64/kernel/Makefile b/trunk/arch/ppc64/kernel/Makefile index dac4cc20fa93..58b19f107656 100644 --- a/trunk/arch/ppc64/kernel/Makefile +++ b/trunk/arch/ppc64/kernel/Makefile @@ -13,8 +13,10 @@ endif obj-y += idle.o dma.o \ align.o \ + udbg.o \ rtc.o \ - iommu.o + iommu.o vdso.o +obj-y += vdso32/ vdso64/ pci-obj-$(CONFIG_PPC_MULTIPLATFORM) += pci_dn.o pci_direct_iommu.o @@ -25,6 +27,8 @@ ifneq ($(CONFIG_PPC_MERGE),y) obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o endif +obj-$(CONFIG_PPC_PSERIES) += udbg_16550.o + obj-$(CONFIG_KEXEC) += machine_kexec.o obj-$(CONFIG_MODULES) += module.o ifneq ($(CONFIG_PPC_MERGE),y) @@ -36,6 +40,10 @@ obj-$(CONFIG_BOOTX_TEXT) += btext.o endif obj-$(CONFIG_HVCS) += hvcserver.o +obj-$(CONFIG_PPC_PMAC) += udbg_scc.o + +obj-$(CONFIG_PPC_MAPLE) += udbg_16550.o + obj-$(CONFIG_KPROBES) += kprobes.o ifneq ($(CONFIG_PPC_MERGE),y) diff --git a/trunk/arch/ppc64/kernel/misc.S b/trunk/arch/ppc64/kernel/misc.S index 5e089deb0a2b..492bca6137eb 100644 --- a/trunk/arch/ppc64/kernel/misc.S +++ b/trunk/arch/ppc64/kernel/misc.S @@ -186,8 +186,7 @@ _KPROBE(__flush_icache_range) bdnz 2b isync blr - - .text + .previous .text /* * Like above, but only do the D-cache. * diff --git a/trunk/arch/powerpc/kernel/udbg.c b/trunk/arch/ppc64/kernel/udbg.c similarity index 100% rename from trunk/arch/powerpc/kernel/udbg.c rename to trunk/arch/ppc64/kernel/udbg.c diff --git a/trunk/arch/powerpc/kernel/udbg_16550.c b/trunk/arch/ppc64/kernel/udbg_16550.c similarity index 100% rename from trunk/arch/powerpc/kernel/udbg_16550.c rename to trunk/arch/ppc64/kernel/udbg_16550.c diff --git a/trunk/arch/powerpc/kernel/udbg_scc.c b/trunk/arch/ppc64/kernel/udbg_scc.c similarity index 100% rename from trunk/arch/powerpc/kernel/udbg_scc.c rename to trunk/arch/ppc64/kernel/udbg_scc.c diff --git a/trunk/arch/powerpc/kernel/vdso32/Makefile b/trunk/arch/ppc64/kernel/vdso32/Makefile similarity index 91% rename from trunk/arch/powerpc/kernel/vdso32/Makefile rename to trunk/arch/ppc64/kernel/vdso32/Makefile index 8a3bed5f143a..0b1b0df973eb 100644 --- a/trunk/arch/powerpc/kernel/vdso32/Makefile +++ b/trunk/arch/ppc64/kernel/vdso32/Makefile @@ -5,10 +5,6 @@ obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o # Build rules -ifeq ($(CONFIG_PPC32),y) -CROSS32CC := $(CC) -endif - targets := $(obj-vdso32) vdso32.so obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) @@ -19,7 +15,7 @@ EXTRA_AFLAGS := -D__VDSO32__ -s obj-y += vdso32_wrapper.o extra-y += vdso32.lds -CPPFLAGS_vdso32.lds += -P -C -Upowerpc +CPPFLAGS_vdso32.lds += -P -C -U$(ARCH) # Force dependency (incbin is bad) $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so diff --git a/trunk/arch/powerpc/kernel/vdso32/cacheflush.S b/trunk/arch/ppc64/kernel/vdso32/cacheflush.S similarity index 100% rename from trunk/arch/powerpc/kernel/vdso32/cacheflush.S rename to trunk/arch/ppc64/kernel/vdso32/cacheflush.S diff --git a/trunk/arch/powerpc/kernel/vdso32/datapage.S b/trunk/arch/ppc64/kernel/vdso32/datapage.S similarity index 82% rename from trunk/arch/powerpc/kernel/vdso32/datapage.S rename to trunk/arch/ppc64/kernel/vdso32/datapage.S index a08c26e87835..4f4eb0be3992 100644 --- a/trunk/arch/powerpc/kernel/vdso32/datapage.S +++ b/trunk/arch/ppc64/kernel/vdso32/datapage.S @@ -66,19 +66,3 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map) blr .cfi_endproc V_FUNCTION_END(__kernel_get_syscall_map) - -/* - * void unsigned long long __kernel_get_tbfreq(void); - * - * returns the timebase frequency in HZ - */ -V_FUNCTION_BEGIN(__kernel_get_tbfreq) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - bl __get_datapage@local - lwz r3,CFG_TB_TICKS_PER_SEC(r3) - lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) - mtlr r12 - .cfi_endproc -V_FUNCTION_END(__kernel_get_tbfreq) diff --git a/trunk/arch/ppc64/kernel/vdso32/gettimeofday.S b/trunk/arch/ppc64/kernel/vdso32/gettimeofday.S new file mode 100644 index 000000000000..e243c1d24af7 --- /dev/null +++ b/trunk/arch/ppc64/kernel/vdso32/gettimeofday.S @@ -0,0 +1,140 @@ +/* + * Userland implementation of gettimeofday() for 32 bits processes in a + * ppc64 kernel for use in the vDSO + * + * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp. + * + * 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. + */ +#include +#include +#include +#include +#include +#include + + .text +/* + * Exact prototype of gettimeofday + * + * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); + * + */ +V_FUNCTION_BEGIN(__kernel_gettimeofday) + .cfi_startproc + mflr r12 + .cfi_register lr,r12 + + mr r10,r3 /* r10 saves tv */ + mr r11,r4 /* r11 saves tz */ + bl __get_datapage@local /* get data page */ + mr r9, r3 /* datapage ptr in r9 */ + bl __do_get_xsec@local /* get xsec from tb & kernel */ + bne- 2f /* out of line -> do syscall */ + + /* seconds are xsec >> 20 */ + rlwinm r5,r4,12,20,31 + rlwimi r5,r3,12,0,19 + stw r5,TVAL32_TV_SEC(r10) + + /* get remaining xsec and convert to usec. we scale + * up remaining xsec by 12 bits and get the top 32 bits + * of the multiplication + */ + rlwinm r5,r4,12,0,19 + lis r6,1000000@h + ori r6,r6,1000000@l + mulhwu r5,r5,r6 + stw r5,TVAL32_TV_USEC(r10) + + cmpli cr0,r11,0 /* check if tz is NULL */ + beq 1f + lwz r4,CFG_TZ_MINUTEWEST(r9)/* fill tz */ + lwz r5,CFG_TZ_DSTTIME(r9) + stw r4,TZONE_TZ_MINWEST(r11) + stw r5,TZONE_TZ_DSTTIME(r11) + +1: mtlr r12 + li r3,0 + blr + +2: mr r3,r10 + mr r4,r11 + li r0,__NR_gettimeofday + sc + b 1b + .cfi_endproc +V_FUNCTION_END(__kernel_gettimeofday) + +/* + * This is the core of gettimeofday(), it returns the xsec + * value in r3 & r4 and expects the datapage ptr (non clobbered) + * in r9. clobbers r0,r4,r5,r6,r7,r8 +*/ +__do_get_xsec: + .cfi_startproc + /* Check for update count & load values. We use the low + * order 32 bits of the update count + */ +1: lwz r8,(CFG_TB_UPDATE_COUNT+4)(r9) + andi. r0,r8,1 /* pending update ? loop */ + bne- 1b + xor r0,r8,r8 /* create dependency */ + add r9,r9,r0 + + /* Load orig stamp (offset to TB) */ + lwz r5,CFG_TB_ORIG_STAMP(r9) + lwz r6,(CFG_TB_ORIG_STAMP+4)(r9) + + /* Get a stable TB value */ +2: mftbu r3 + mftbl r4 + mftbu r0 + cmpl cr0,r3,r0 + bne- 2b + + /* Substract tb orig stamp. If the high part is non-zero, we jump to the + * slow path which call the syscall. If it's ok, then we have our 32 bits + * tb_ticks value in r7 + */ + subfc r7,r6,r4 + subfe. r0,r5,r3 + bne- 3f + + /* Load scale factor & do multiplication */ + lwz r5,CFG_TB_TO_XS(r9) /* load values */ + lwz r6,(CFG_TB_TO_XS+4)(r9) + mulhwu r4,r7,r5 + mulhwu r6,r7,r6 + mullw r0,r7,r5 + addc r6,r6,r0 + + /* At this point, we have the scaled xsec value in r4 + XER:CA + * we load & add the stamp since epoch + */ + lwz r5,CFG_STAMP_XSEC(r9) + lwz r6,(CFG_STAMP_XSEC+4)(r9) + adde r4,r4,r6 + addze r3,r5 + + /* We now have our result in r3,r4. We create a fake dependency + * on that result and re-check the counter + */ + xor r0,r4,r4 + add r9,r9,r0 + lwz r0,(CFG_TB_UPDATE_COUNT+4)(r9) + cmpl cr0,r8,r0 /* check if updated */ + bne- 1b + + /* Warning ! The caller expects CR:EQ to be set to indicate a + * successful calculation (so it won't fallback to the syscall + * method). We have overriden that CR bit in the counter check, + * but fortunately, the loop exit condition _is_ CR:EQ set, so + * we can exit safely here. If you change this code, be careful + * of that side effect. + */ +3: blr + .cfi_endproc diff --git a/trunk/arch/powerpc/kernel/vdso32/note.S b/trunk/arch/ppc64/kernel/vdso32/note.S similarity index 100% rename from trunk/arch/powerpc/kernel/vdso32/note.S rename to trunk/arch/ppc64/kernel/vdso32/note.S diff --git a/trunk/arch/powerpc/kernel/vdso32/sigtramp.S b/trunk/arch/ppc64/kernel/vdso32/sigtramp.S similarity index 100% rename from trunk/arch/powerpc/kernel/vdso32/sigtramp.S rename to trunk/arch/ppc64/kernel/vdso32/sigtramp.S diff --git a/trunk/arch/powerpc/kernel/vdso32/vdso32.lds.S b/trunk/arch/ppc64/kernel/vdso32/vdso32.lds.S similarity index 97% rename from trunk/arch/powerpc/kernel/vdso32/vdso32.lds.S rename to trunk/arch/ppc64/kernel/vdso32/vdso32.lds.S index f4bad720cb0a..6f87a916a394 100644 --- a/trunk/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ b/trunk/arch/ppc64/kernel/vdso32/vdso32.lds.S @@ -102,12 +102,9 @@ VERSION { VDSO_VERSION_STRING { global: - __kernel_datapage_offset; /* Has to be there for the kernel to find */ + __kernel_datapage_offset; /* Has to be there for the kernel to find it */ __kernel_get_syscall_map; __kernel_gettimeofday; - __kernel_clock_gettime; - __kernel_clock_getres; - __kernel_get_tbfreq; __kernel_sync_dicache; __kernel_sync_dicache_p5; __kernel_sigtramp32; diff --git a/trunk/arch/powerpc/kernel/vdso32/vdso32_wrapper.S b/trunk/arch/ppc64/kernel/vdso32/vdso32_wrapper.S similarity index 79% rename from trunk/arch/powerpc/kernel/vdso32/vdso32_wrapper.S rename to trunk/arch/ppc64/kernel/vdso32/vdso32_wrapper.S index 556f0caa5d84..76ca28e09d29 100644 --- a/trunk/arch/powerpc/kernel/vdso32/vdso32_wrapper.S +++ b/trunk/arch/ppc64/kernel/vdso32/vdso32_wrapper.S @@ -6,7 +6,7 @@ .globl vdso32_start, vdso32_end .balign PAGE_SIZE vdso32_start: - .incbin "arch/powerpc/kernel/vdso32/vdso32.so" + .incbin "arch/ppc64/kernel/vdso32/vdso32.so" .balign PAGE_SIZE vdso32_end: diff --git a/trunk/arch/powerpc/kernel/vdso64/Makefile b/trunk/arch/ppc64/kernel/vdso64/Makefile similarity index 100% rename from trunk/arch/powerpc/kernel/vdso64/Makefile rename to trunk/arch/ppc64/kernel/vdso64/Makefile diff --git a/trunk/arch/powerpc/kernel/vdso64/cacheflush.S b/trunk/arch/ppc64/kernel/vdso64/cacheflush.S similarity index 100% rename from trunk/arch/powerpc/kernel/vdso64/cacheflush.S rename to trunk/arch/ppc64/kernel/vdso64/cacheflush.S diff --git a/trunk/arch/powerpc/kernel/vdso64/datapage.S b/trunk/arch/ppc64/kernel/vdso64/datapage.S similarity index 84% rename from trunk/arch/powerpc/kernel/vdso64/datapage.S rename to trunk/arch/ppc64/kernel/vdso64/datapage.S index e67eda0f8cda..ed6e599ae824 100644 --- a/trunk/arch/powerpc/kernel/vdso64/datapage.S +++ b/trunk/arch/ppc64/kernel/vdso64/datapage.S @@ -66,19 +66,3 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map) blr .cfi_endproc V_FUNCTION_END(__kernel_get_syscall_map) - - -/* - * void unsigned long __kernel_get_tbfreq(void); - * - * returns the timebase frequency in HZ - */ -V_FUNCTION_BEGIN(__kernel_get_tbfreq) - .cfi_startproc - mflr r12 - .cfi_register lr,r12 - bl V_LOCAL_FUNC(__get_datapage) - ld r3,CFG_TB_TICKS_PER_SEC(r3) - mtlr r12 - .cfi_endproc -V_FUNCTION_END(__kernel_get_tbfreq) diff --git a/trunk/arch/ppc64/kernel/vdso64/gettimeofday.S b/trunk/arch/ppc64/kernel/vdso64/gettimeofday.S new file mode 100644 index 000000000000..f6df8028570a --- /dev/null +++ b/trunk/arch/ppc64/kernel/vdso64/gettimeofday.S @@ -0,0 +1,91 @@ +/* + * Userland implementation of gettimeofday() for 64 bits processes in a + * ppc64 kernel for use in the vDSO + * + * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), + * IBM Corp. + * + * 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. + */ +#include +#include +#include +#include +#include + + .text +/* + * Exact prototype of gettimeofday + * + * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz); + * + */ +V_FUNCTION_BEGIN(__kernel_gettimeofday) + .cfi_startproc + mflr r12 + .cfi_register lr,r12 + + mr r11,r3 /* r11 holds tv */ + mr r10,r4 /* r10 holds tz */ + bl V_LOCAL_FUNC(__get_datapage) /* get data page */ + bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ + lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */ + ori r7,r7,16960 + rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */ + rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */ + std r5,TVAL64_TV_SEC(r11) /* store sec in tv */ + subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */ + mulld r0,r0,r7 /* usec = (xsec * USEC_PER_SEC) / XSEC_PER_SEC */ + rldicl r0,r0,44,20 + cmpldi cr0,r10,0 /* check if tz is NULL */ + std r0,TVAL64_TV_USEC(r11) /* store usec in tv */ + beq 1f + lwz r4,CFG_TZ_MINUTEWEST(r3)/* fill tz */ + lwz r5,CFG_TZ_DSTTIME(r3) + stw r4,TZONE_TZ_MINWEST(r10) + stw r5,TZONE_TZ_DSTTIME(r10) +1: mtlr r12 + li r3,0 /* always success */ + blr + .cfi_endproc +V_FUNCTION_END(__kernel_gettimeofday) + + +/* + * This is the core of gettimeofday(), it returns the xsec + * value in r4 and expects the datapage ptr (non clobbered) + * in r3. clobbers r0,r4,r5,r6,r7,r8 +*/ +V_FUNCTION_BEGIN(__do_get_xsec) + .cfi_startproc + /* check for update count & load values */ +1: ld r7,CFG_TB_UPDATE_COUNT(r3) + andi. r0,r4,1 /* pending update ? loop */ + bne- 1b + xor r0,r4,r4 /* create dependency */ + add r3,r3,r0 + + /* Get TB & offset it */ + mftb r8 + ld r9,CFG_TB_ORIG_STAMP(r3) + subf r8,r9,r8 + + /* Scale result */ + ld r5,CFG_TB_TO_XS(r3) + mulhdu r8,r8,r5 + + /* Add stamp since epoch */ + ld r6,CFG_STAMP_XSEC(r3) + add r4,r6,r8 + + xor r0,r4,r4 + add r3,r3,r0 + ld r0,CFG_TB_UPDATE_COUNT(r3) + cmpld cr0,r0,r7 /* check if updated */ + bne- 1b + blr + .cfi_endproc +V_FUNCTION_END(__do_get_xsec) diff --git a/trunk/arch/powerpc/kernel/vdso64/note.S b/trunk/arch/ppc64/kernel/vdso64/note.S similarity index 100% rename from trunk/arch/powerpc/kernel/vdso64/note.S rename to trunk/arch/ppc64/kernel/vdso64/note.S diff --git a/trunk/arch/powerpc/kernel/vdso64/sigtramp.S b/trunk/arch/ppc64/kernel/vdso64/sigtramp.S similarity index 100% rename from trunk/arch/powerpc/kernel/vdso64/sigtramp.S rename to trunk/arch/ppc64/kernel/vdso64/sigtramp.S diff --git a/trunk/arch/powerpc/kernel/vdso64/vdso64.lds.S b/trunk/arch/ppc64/kernel/vdso64/vdso64.lds.S similarity index 97% rename from trunk/arch/powerpc/kernel/vdso64/vdso64.lds.S rename to trunk/arch/ppc64/kernel/vdso64/vdso64.lds.S index 4bdf224464ab..9cb28181da80 100644 --- a/trunk/arch/powerpc/kernel/vdso64/vdso64.lds.S +++ b/trunk/arch/ppc64/kernel/vdso64/vdso64.lds.S @@ -102,12 +102,9 @@ VERSION { VDSO_VERSION_STRING { global: - __kernel_datapage_offset; /* Has to be there for the kernel to find */ + __kernel_datapage_offset; /* Has to be there for the kernel to find it */ __kernel_get_syscall_map; __kernel_gettimeofday; - __kernel_clock_gettime; - __kernel_clock_getres; - __kernel_get_tbfreq; __kernel_sync_dicache; __kernel_sync_dicache_p5; __kernel_sigtramp_rt64; diff --git a/trunk/arch/powerpc/kernel/vdso64/vdso64_wrapper.S b/trunk/arch/ppc64/kernel/vdso64/vdso64_wrapper.S similarity index 79% rename from trunk/arch/powerpc/kernel/vdso64/vdso64_wrapper.S rename to trunk/arch/ppc64/kernel/vdso64/vdso64_wrapper.S index 0529cb9e3b97..771c2741c492 100644 --- a/trunk/arch/powerpc/kernel/vdso64/vdso64_wrapper.S +++ b/trunk/arch/ppc64/kernel/vdso64/vdso64_wrapper.S @@ -6,7 +6,7 @@ .globl vdso64_start, vdso64_end .balign PAGE_SIZE vdso64_start: - .incbin "arch/powerpc/kernel/vdso64/vdso64.so" + .incbin "arch/ppc64/kernel/vdso64/vdso64.so" .balign PAGE_SIZE vdso64_end: diff --git a/trunk/arch/um/drivers/net_kern.c b/trunk/arch/um/drivers/net_kern.c index 84c73a300acb..4cf31a2ae19c 100644 --- a/trunk/arch/um/drivers/net_kern.c +++ b/trunk/arch/um/drivers/net_kern.c @@ -268,10 +268,9 @@ void uml_net_user_timer_expire(unsigned long _conn) static DEFINE_SPINLOCK(devices_lock); static struct list_head devices = LIST_HEAD_INIT(devices); -static struct platform_driver uml_net_driver = { - .driver = { - .name = DRIVER_NAME, - }, +static struct device_driver uml_net_driver = { + .name = DRIVER_NAME, + .bus = &platform_bus_type, }; static int driver_registered; @@ -318,7 +317,7 @@ static int eth_configure(int n, void *init, char *mac, /* sysfs register */ if (!driver_registered) { - platform_driver_register(¨_net_driver); + driver_register(¨_net_driver); driver_registered = 1; } device->pdev.id = n; diff --git a/trunk/arch/um/drivers/ubd_kern.c b/trunk/arch/um/drivers/ubd_kern.c index 93898917cbe5..b2c86257b0f8 100644 --- a/trunk/arch/um/drivers/ubd_kern.c +++ b/trunk/arch/um/drivers/ubd_kern.c @@ -823,10 +823,9 @@ static int ubd_mc_init(void) __initcall(ubd_mc_init); -static struct platform_driver ubd_driver = { - .driver = { - .name = DRIVER_NAME, - }, +static struct device_driver ubd_driver = { + .name = DRIVER_NAME, + .bus = &platform_bus_type, }; int ubd_init(void) @@ -851,7 +850,7 @@ int ubd_init(void) if (register_blkdev(fake_major, "ubd")) return -1; } - platform_driver_register(&ubd_driver); + driver_register(&ubd_driver); for (i = 0; i < MAX_DEV; i++) ubd_add(i); return 0; diff --git a/trunk/arch/xtensa/platform-iss/network.c b/trunk/arch/xtensa/platform-iss/network.c index 0dc55cc8691b..96b9bb4a478d 100644 --- a/trunk/arch/xtensa/platform-iss/network.c +++ b/trunk/arch/xtensa/platform-iss/network.c @@ -616,10 +616,9 @@ void iss_net_user_timer_expire(unsigned long _conn) } -static struct platform_driver iss_net_driver = { - .driver = { - .name = DRIVER_NAME, - }, +static struct device_driver iss_net_driver = { + .name = DRIVER_NAME, + .bus = &platform_bus_type, }; static int driver_registered; @@ -670,7 +669,7 @@ static int iss_net_configure(int index, char *init) /* sysfs register */ if (!driver_registered) { - platform_driver_register(&iss_net_driver); + driver_register(&iss_net_driver); driver_registered = 1; } diff --git a/trunk/drivers/base/platform.c b/trunk/drivers/base/platform.c index 8827dafba945..6d4736e89f1a 100644 --- a/trunk/drivers/base/platform.c +++ b/trunk/drivers/base/platform.c @@ -20,8 +20,6 @@ #include "base.h" -#define to_platform_driver(drv) (container_of((drv), struct platform_driver, driver)) - struct device platform_bus = { .bus_id = "platform", }; @@ -356,77 +354,6 @@ struct platform_device *platform_device_register_simple(char *name, unsigned int return ERR_PTR(retval); } -static int platform_drv_probe(struct device *_dev) -{ - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); - - return drv->probe(dev); -} - -static int platform_drv_remove(struct device *_dev) -{ - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); - - return drv->remove(dev); -} - -static void platform_drv_shutdown(struct device *_dev) -{ - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); - - drv->shutdown(dev); -} - -static int platform_drv_suspend(struct device *_dev, pm_message_t state) -{ - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); - - return drv->suspend(dev, state); -} - -static int platform_drv_resume(struct device *_dev) -{ - struct platform_driver *drv = to_platform_driver(_dev->driver); - struct platform_device *dev = to_platform_device(_dev); - - return drv->resume(dev); -} - -/** - * platform_driver_register - * @drv: platform driver structure - */ -int platform_driver_register(struct platform_driver *drv) -{ - drv->driver.bus = &platform_bus_type; - if (drv->probe) - drv->driver.probe = platform_drv_probe; - if (drv->remove) - drv->driver.remove = platform_drv_remove; - if (drv->shutdown) - drv->driver.shutdown = platform_drv_shutdown; - if (drv->suspend) - drv->driver.suspend = platform_drv_suspend; - if (drv->resume) - drv->driver.resume = platform_drv_resume; - return driver_register(&drv->driver); -} -EXPORT_SYMBOL_GPL(platform_driver_register); - -/** - * platform_driver_unregister - * @drv: platform driver structure - */ -void platform_driver_unregister(struct platform_driver *drv) -{ - driver_unregister(&drv->driver); -} -EXPORT_SYMBOL_GPL(platform_driver_unregister); - /** * platform_match - bind platform device to platform driver. diff --git a/trunk/drivers/char/ipmi/ipmi_msghandler.c b/trunk/drivers/char/ipmi/ipmi_msghandler.c index d16bd4b5c117..c1d06ba449b6 100644 --- a/trunk/drivers/char/ipmi/ipmi_msghandler.c +++ b/trunk/drivers/char/ipmi/ipmi_msghandler.c @@ -2648,7 +2648,7 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, spin_lock_irqsave(&intf->waiting_msgs_lock, flags); if (!list_empty(&intf->waiting_msgs)) { list_add_tail(&msg->link, &intf->waiting_msgs); - spin_unlock_irqrestore(&intf->waiting_msgs_lock, flags); + spin_unlock(&intf->waiting_msgs_lock); goto out; } spin_unlock_irqrestore(&intf->waiting_msgs_lock, flags); @@ -2657,9 +2657,9 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, if (rv > 0) { /* Could not handle the message now, just add it to a list to handle later. */ - spin_lock_irqsave(&intf->waiting_msgs_lock, flags); + spin_lock(&intf->waiting_msgs_lock); list_add_tail(&msg->link, &intf->waiting_msgs); - spin_unlock_irqrestore(&intf->waiting_msgs_lock, flags); + spin_unlock(&intf->waiting_msgs_lock); } else if (rv == 0) { ipmi_free_smi_msg(msg); } diff --git a/trunk/drivers/char/s3c2410-rtc.c b/trunk/drivers/char/s3c2410-rtc.c index 3df7a574267b..d724c0de4f28 100644 --- a/trunk/drivers/char/s3c2410-rtc.c +++ b/trunk/drivers/char/s3c2410-rtc.c @@ -382,7 +382,7 @@ static struct rtc_ops s3c2410_rtcops = { .proc = s3c2410_rtc_proc, }; -static void s3c2410_rtc_enable(struct platform_device *pdev, int en) +static void s3c2410_rtc_enable(struct device *dev, int en) { unsigned int tmp; @@ -399,21 +399,21 @@ static void s3c2410_rtc_enable(struct platform_device *pdev, int en) /* re-enable the device, and check it is ok */ if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ - dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); + dev_info(dev, "rtc disabled, re-enabling\n"); tmp = readb(S3C2410_RTCCON); writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON); } if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ - dev_info(&pdev->dev, "removing S3C2410_RTCCON_CNTSEL\n"); + dev_info(dev, "removing S3C2410_RTCCON_CNTSEL\n"); tmp = readb(S3C2410_RTCCON); writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON); } if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ - dev_info(&pdev->dev, "removing S3C2410_RTCCON_CLKRST\n"); + dev_info(dev, "removing S3C2410_RTCCON_CLKRST\n"); tmp = readb(S3C2410_RTCCON); writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON); @@ -421,7 +421,7 @@ static void s3c2410_rtc_enable(struct platform_device *pdev, int en) } } -static int s3c2410_rtc_remove(struct platform_device *dev) +static int s3c2410_rtc_remove(struct device *dev) { unregister_rtc(&s3c2410_rtcops); @@ -438,24 +438,25 @@ static int s3c2410_rtc_remove(struct platform_device *dev) return 0; } -static int s3c2410_rtc_probe(struct platform_device *pdev) +static int s3c2410_rtc_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct resource *res; int ret; - pr_debug("%s: probe=%p\n", __FUNCTION__, pdev); + pr_debug("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); /* find the IRQs */ s3c2410_rtc_tickno = platform_get_irq(pdev, 1); if (s3c2410_rtc_tickno <= 0) { - dev_err(&pdev->dev, "no irq for rtc tick\n"); + dev_err(dev, "no irq for rtc tick\n"); return -ENOENT; } s3c2410_rtc_alarmno = platform_get_irq(pdev, 0); if (s3c2410_rtc_alarmno <= 0) { - dev_err(&pdev->dev, "no irq for alarm\n"); + dev_err(dev, "no irq for alarm\n"); return -ENOENT; } @@ -466,7 +467,7 @@ static int s3c2410_rtc_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { - dev_err(&pdev->dev, "failed to get memory region resource\n"); + dev_err(dev, "failed to get memory region resource\n"); return -ENOENT; } @@ -474,14 +475,14 @@ static int s3c2410_rtc_probe(struct platform_device *pdev) pdev->name); if (s3c2410_rtc_mem == NULL) { - dev_err(&pdev->dev, "failed to reserve memory region\n"); + dev_err(dev, "failed to reserve memory region\n"); ret = -ENOENT; goto exit_err; } s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1); if (s3c2410_rtc_base == NULL) { - dev_err(&pdev->dev, "failed ioremap()\n"); + dev_err(dev, "failed ioremap()\n"); ret = -EINVAL; goto exit_err; } @@ -493,7 +494,7 @@ static int s3c2410_rtc_probe(struct platform_device *pdev) /* check to see if everything is setup correctly */ - s3c2410_rtc_enable(pdev, 1); + s3c2410_rtc_enable(dev, 1); pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON)); @@ -505,7 +506,7 @@ static int s3c2410_rtc_probe(struct platform_device *pdev) return 0; exit_err: - dev_err(&pdev->dev, "error %d during initialisation\n", ret); + dev_err(dev, "error %d during initialisation\n", ret); return ret; } @@ -518,7 +519,7 @@ static struct timespec s3c2410_rtc_delta; static int ticnt_save; -static int s3c2410_rtc_suspend(struct platform_device *pdev, pm_message_t state) +static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state) { struct rtc_time tm; struct timespec time; @@ -534,19 +535,19 @@ static int s3c2410_rtc_suspend(struct platform_device *pdev, pm_message_t state) s3c2410_rtc_gettime(&tm); rtc_tm_to_time(&tm, &time.tv_sec); save_time_delta(&s3c2410_rtc_delta, &time); - s3c2410_rtc_enable(pdev, 0); + s3c2410_rtc_enable(dev, 0); return 0; } -static int s3c2410_rtc_resume(struct platform_device *pdev) +static int s3c2410_rtc_resume(struct device *dev) { struct rtc_time tm; struct timespec time; time.tv_nsec = 0; - s3c2410_rtc_enable(pdev, 1); + s3c2410_rtc_enable(dev, 1); s3c2410_rtc_gettime(&tm); rtc_tm_to_time(&tm, &time.tv_sec); restore_time_delta(&s3c2410_rtc_delta, &time); @@ -559,15 +560,14 @@ static int s3c2410_rtc_resume(struct platform_device *pdev) #define s3c2410_rtc_resume NULL #endif -static struct platform_driver s3c2410_rtcdrv = { +static struct device_driver s3c2410_rtcdrv = { + .name = "s3c2410-rtc", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = s3c2410_rtc_probe, .remove = s3c2410_rtc_remove, .suspend = s3c2410_rtc_suspend, .resume = s3c2410_rtc_resume, - .driver = { - .name = "s3c2410-rtc", - .owner = THIS_MODULE, - }, }; static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; @@ -575,12 +575,12 @@ static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; static int __init s3c2410_rtc_init(void) { printk(banner); - return platform_driver_register(&s3c2410_rtcdrv); + return driver_register(&s3c2410_rtcdrv); } static void __exit s3c2410_rtc_exit(void) { - platform_driver_unregister(&s3c2410_rtcdrv); + driver_unregister(&s3c2410_rtcdrv); } module_init(s3c2410_rtc_init); diff --git a/trunk/drivers/char/sonypi.c b/trunk/drivers/char/sonypi.c index 51a07370e636..d05067dcea01 100644 --- a/trunk/drivers/char/sonypi.c +++ b/trunk/drivers/char/sonypi.c @@ -1168,7 +1168,7 @@ static int sonypi_disable(void) #ifdef CONFIG_PM static int old_camera_power; -static int sonypi_suspend(struct platform_device *dev, pm_message_t state) +static int sonypi_suspend(struct device *dev, pm_message_t state) { old_camera_power = sonypi_device.camera_power; sonypi_disable(); @@ -1176,27 +1176,26 @@ static int sonypi_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int sonypi_resume(struct platform_device *dev) +static int sonypi_resume(struct device *dev) { sonypi_enable(old_camera_power); return 0; } #endif -static void sonypi_shutdown(struct platform_device *dev) +static void sonypi_shutdown(struct device *dev) { sonypi_disable(); } -static struct platform_driver sonypi_driver = { +static struct device_driver sonypi_driver = { + .name = "sonypi", + .bus = &platform_bus_type, #ifdef CONFIG_PM .suspend = sonypi_suspend, .resume = sonypi_resume, #endif .shutdown = sonypi_shutdown, - .driver = { - .name = "sonypi", - }, }; static int __devinit sonypi_create_input_devices(void) @@ -1456,20 +1455,20 @@ static int __init sonypi_init(void) if (!dmi_check_system(sonypi_dmi_table)) return -ENODEV; - ret = platform_driver_register(&sonypi_driver); + ret = driver_register(&sonypi_driver); if (ret) return ret; ret = sonypi_probe(); if (ret) - platform_driver_unregister(&sonypi_driver); + driver_unregister(&sonypi_driver); return ret; } static void __exit sonypi_exit(void) { - platform_driver_unregister(&sonypi_driver); + driver_unregister(&sonypi_driver); sonypi_remove(); } diff --git a/trunk/drivers/char/tb0219.c b/trunk/drivers/char/tb0219.c index b3d411a756fe..24355b23b2ca 100644 --- a/trunk/drivers/char/tb0219.c +++ b/trunk/drivers/char/tb0219.c @@ -283,7 +283,7 @@ static void tb0219_pci_irq_init(void) vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW); } -static int tb0219_probe(struct platform_device *dev) +static int tb0219_probe(struct device *dev) { int retval; @@ -319,7 +319,7 @@ static int tb0219_probe(struct platform_device *dev) return 0; } -static int tb0219_remove(struct platform_device *dev) +static int tb0219_remove(struct device *dev) { _machine_restart = old_machine_restart; @@ -333,12 +333,11 @@ static int tb0219_remove(struct platform_device *dev) static struct platform_device *tb0219_platform_device; -static struct platform_driver tb0219_device_driver = { +static struct device_driver tb0219_device_driver = { + .name = "TB0219", + .bus = &platform_bus_type, .probe = tb0219_probe, .remove = tb0219_remove, - .driver = { - .name = "TB0219", - }, }; static int __devinit tanbac_tb0219_init(void) @@ -349,7 +348,7 @@ static int __devinit tanbac_tb0219_init(void) if (IS_ERR(tb0219_platform_device)) return PTR_ERR(tb0219_platform_device); - retval = platform_driver_register(&tb0219_device_driver); + retval = driver_register(&tb0219_device_driver); if (retval < 0) platform_device_unregister(tb0219_platform_device); @@ -358,7 +357,7 @@ static int __devinit tanbac_tb0219_init(void) static void __devexit tanbac_tb0219_exit(void) { - platform_driver_unregister(&tb0219_device_driver); + driver_unregister(&tb0219_device_driver); platform_device_unregister(tb0219_platform_device); } diff --git a/trunk/drivers/char/vr41xx_giu.c b/trunk/drivers/char/vr41xx_giu.c index 9ac6d43437b3..94641085faf8 100644 --- a/trunk/drivers/char/vr41xx_giu.c +++ b/trunk/drivers/char/vr41xx_giu.c @@ -613,7 +613,7 @@ static struct file_operations gpio_fops = { .release = gpio_release, }; -static int giu_probe(struct platform_device *dev) +static int giu_probe(struct device *dev) { unsigned long start, size, flags = 0; unsigned int nr_pins = 0; @@ -697,7 +697,7 @@ static int giu_probe(struct platform_device *dev) return cascade_irq(GIUINT_IRQ, giu_get_irq); } -static int giu_remove(struct platform_device *dev) +static int giu_remove(struct device *dev) { iounmap(giu_base); @@ -710,12 +710,11 @@ static int giu_remove(struct platform_device *dev) static struct platform_device *giu_platform_device; -static struct platform_driver giu_device_driver = { +static struct device_driver giu_device_driver = { + .name = "GIU", + .bus = &platform_bus_type, .probe = giu_probe, .remove = giu_remove, - .driver = { - .name = "GIU", - }, }; static int __devinit vr41xx_giu_init(void) @@ -726,7 +725,7 @@ static int __devinit vr41xx_giu_init(void) if (IS_ERR(giu_platform_device)) return PTR_ERR(giu_platform_device); - retval = platform_driver_register(&giu_device_driver); + retval = driver_register(&giu_device_driver); if (retval < 0) platform_device_unregister(giu_platform_device); @@ -735,7 +734,7 @@ static int __devinit vr41xx_giu_init(void) static void __devexit vr41xx_giu_exit(void) { - platform_driver_unregister(&giu_device_driver); + driver_unregister(&giu_device_driver); platform_device_unregister(giu_platform_device); } diff --git a/trunk/drivers/char/vr41xx_rtc.c b/trunk/drivers/char/vr41xx_rtc.c index 435b30748e23..5e3292df69d8 100644 --- a/trunk/drivers/char/vr41xx_rtc.c +++ b/trunk/drivers/char/vr41xx_rtc.c @@ -560,11 +560,13 @@ static struct miscdevice rtc_miscdevice = { .fops = &rtc_fops, }; -static int rtc_probe(struct platform_device *pdev) +static int rtc_probe(struct device *dev) { + struct platform_device *pdev; unsigned int irq; int retval; + pdev = to_platform_device(dev); if (pdev->num_resources != 2) return -EBUSY; @@ -633,7 +635,7 @@ static int rtc_probe(struct platform_device *pdev) return 0; } -static int rtc_remove(struct platform_device *dev) +static int rtc_remove(struct device *dev) { int retval; @@ -653,12 +655,11 @@ static int rtc_remove(struct platform_device *dev) static struct platform_device *rtc_platform_device; -static struct platform_driver rtc_device_driver = { +static struct device_driver rtc_device_driver = { + .name = rtc_name, + .bus = &platform_bus_type, .probe = rtc_probe, .remove = rtc_remove, - .driver = { - .name = rtc_name, - }, }; static int __devinit vr41xx_rtc_init(void) @@ -690,7 +691,7 @@ static int __devinit vr41xx_rtc_init(void) if (IS_ERR(rtc_platform_device)) return PTR_ERR(rtc_platform_device); - retval = platform_driver_register(&rtc_device_driver); + retval = driver_register(&rtc_device_driver); if (retval < 0) platform_device_unregister(rtc_platform_device); @@ -699,7 +700,7 @@ static int __devinit vr41xx_rtc_init(void) static void __devexit vr41xx_rtc_exit(void) { - platform_driver_unregister(&rtc_device_driver); + driver_unregister(&rtc_device_driver); platform_device_unregister(rtc_platform_device); } diff --git a/trunk/drivers/char/watchdog/mpcore_wdt.c b/trunk/drivers/char/watchdog/mpcore_wdt.c index 9defcf861b67..da631c114fd1 100644 --- a/trunk/drivers/char/watchdog/mpcore_wdt.c +++ b/trunk/drivers/char/watchdog/mpcore_wdt.c @@ -139,7 +139,7 @@ static int mpcore_wdt_set_heartbeat(int t) */ static int mpcore_wdt_open(struct inode *inode, struct file *file) { - struct mpcore_wdt *wdt = platform_get_drvdata(mpcore_wdt_dev); + struct mpcore_wdt *wdt = dev_get_drvdata(&mpcore_wdt_dev->dev); if (test_and_set_bit(0, &wdt->timer_alive)) return -EBUSY; @@ -291,9 +291,9 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file, * System shutdown handler. Turn off the watchdog if we're * restarting or halting the system. */ -static void mpcore_wdt_shutdown(struct platform_device *dev) +static void mpcore_wdt_shutdown(struct device *_dev) { - struct mpcore_wdt *wdt = platform_get_drvdata(dev); + struct mpcore_wdt *wdt = dev_get_drvdata(_dev); if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) mpcore_wdt_stop(wdt); @@ -317,8 +317,9 @@ static struct miscdevice mpcore_wdt_miscdev = { .fops = &mpcore_wdt_fops, }; -static int __devinit mpcore_wdt_probe(struct platform_device *dev) +static int __devinit mpcore_wdt_probe(struct device *_dev) { + struct platform_device *dev = to_platform_device(_dev); struct mpcore_wdt *wdt; struct resource *res; int ret; @@ -363,7 +364,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) } mpcore_wdt_stop(wdt); - platform_set_drvdata(&dev->dev, wdt); + dev_set_drvdata(&dev->dev, wdt); mpcore_wdt_dev = dev; return 0; @@ -378,11 +379,11 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) return ret; } -static int __devexit mpcore_wdt_remove(struct platform_device *dev) +static int __devexit mpcore_wdt_remove(struct device *dev) { - struct mpcore_wdt *wdt = platform_get_drvdata(dev); + struct mpcore_wdt *wdt = dev_get_drvdata(dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); misc_deregister(&mpcore_wdt_miscdev); @@ -394,14 +395,13 @@ static int __devexit mpcore_wdt_remove(struct platform_device *dev) return 0; } -static struct platform_driver mpcore_wdt_driver = { +static struct device_driver mpcore_wdt_driver = { + .owner = THIS_MODULE, + .name = "mpcore_wdt", + .bus = &platform_bus_type, .probe = mpcore_wdt_probe, .remove = __devexit_p(mpcore_wdt_remove), .shutdown = mpcore_wdt_shutdown, - .driver = { - .owner = THIS_MODULE, - .name = "mpcore_wdt", - }, }; static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n"; @@ -420,12 +420,12 @@ static int __init mpcore_wdt_init(void) printk(banner, mpcore_noboot, mpcore_margin, nowayout); - return platform_driver_register(&mpcore_wdt_driver); + return driver_register(&mpcore_wdt_driver); } static void __exit mpcore_wdt_exit(void) { - platform_driver_unregister(&mpcore_wdt_driver); + driver_unregister(&mpcore_wdt_driver); } module_init(mpcore_wdt_init); diff --git a/trunk/drivers/char/watchdog/mv64x60_wdt.c b/trunk/drivers/char/watchdog/mv64x60_wdt.c index 00d9ef04a369..119b3c541d95 100644 --- a/trunk/drivers/char/watchdog/mv64x60_wdt.c +++ b/trunk/drivers/char/watchdog/mv64x60_wdt.c @@ -182,9 +182,10 @@ static struct miscdevice mv64x60_wdt_miscdev = { .fops = &mv64x60_wdt_fops, }; -static int __devinit mv64x60_wdt_probe(struct platform_device *dev) +static int __devinit mv64x60_wdt_probe(struct device *dev) { - struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data; + struct platform_device *pd = to_platform_device(dev); + struct mv64x60_wdt_pdata *pdata = pd->dev.platform_data; int bus_clk = 133; mv64x60_wdt_timeout = 10; @@ -201,7 +202,7 @@ static int __devinit mv64x60_wdt_probe(struct platform_device *dev) return misc_register(&mv64x60_wdt_miscdev); } -static int __devexit mv64x60_wdt_remove(struct platform_device *dev) +static int __devexit mv64x60_wdt_remove(struct device *dev) { misc_deregister(&mv64x60_wdt_miscdev); @@ -211,13 +212,12 @@ static int __devexit mv64x60_wdt_remove(struct platform_device *dev) return 0; } -static struct platform_driver mv64x60_wdt_driver = { +static struct device_driver mv64x60_wdt_driver = { + .owner = THIS_MODULE, + .name = MV64x60_WDT_NAME, + .bus = &platform_bus_type, .probe = mv64x60_wdt_probe, .remove = __devexit_p(mv64x60_wdt_remove), - .driver = { - .owner = THIS_MODULE, - .name = MV64x60_WDT_NAME, - }, }; static struct platform_device *mv64x60_wdt_dev; @@ -235,14 +235,14 @@ static int __init mv64x60_wdt_init(void) goto out; } - ret = platform_driver_register(&mv64x60_wdt_driver); + ret = driver_register(&mv64x60_wdt_driver); out: return ret; } static void __exit mv64x60_wdt_exit(void) { - platform_driver_unregister(&mv64x60_wdt_driver); + driver_unregister(&mv64x60_wdt_driver); platform_device_unregister(mv64x60_wdt_dev); } diff --git a/trunk/drivers/char/watchdog/s3c2410_wdt.c b/trunk/drivers/char/watchdog/s3c2410_wdt.c index eb667daee19b..751cb77b0715 100644 --- a/trunk/drivers/char/watchdog/s3c2410_wdt.c +++ b/trunk/drivers/char/watchdog/s3c2410_wdt.c @@ -347,14 +347,15 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param, } /* device interface */ -static int s3c2410wdt_probe(struct platform_device *pdev) +static int s3c2410wdt_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct resource *res; int started = 0; int ret; int size; - DBG("%s: probe=%p\n", __FUNCTION__, pdev); + DBG("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); /* get the memory region for the watchdog timer */ @@ -385,13 +386,13 @@ static int s3c2410wdt_probe(struct platform_device *pdev) return -ENOENT; } - ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev); + ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, dev); if (ret != 0) { printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); return ret; } - wdt_clock = clk_get(&pdev->dev, "watchdog"); + wdt_clock = clk_get(dev, "watchdog"); if (wdt_clock == NULL) { printk(KERN_INFO PFX "failed to find watchdog clock source\n"); return -ENOENT; @@ -429,7 +430,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) return 0; } -static int s3c2410wdt_remove(struct platform_device *dev) +static int s3c2410wdt_remove(struct device *dev) { if (wdt_mem != NULL) { release_resource(wdt_mem); @@ -453,7 +454,7 @@ static int s3c2410wdt_remove(struct platform_device *dev) return 0; } -static void s3c2410wdt_shutdown(struct platform_device *dev) +static void s3c2410wdt_shutdown(struct device *dev) { s3c2410wdt_stop(); } @@ -463,7 +464,7 @@ static void s3c2410wdt_shutdown(struct platform_device *dev) static unsigned long wtcon_save; static unsigned long wtdat_save; -static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) +static int s3c2410wdt_suspend(struct device *dev, pm_message_t state) { /* Save watchdog state, and turn it off. */ wtcon_save = readl(wdt_base + S3C2410_WTCON); @@ -475,7 +476,7 @@ static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int s3c2410wdt_resume(struct platform_device *dev) +static int s3c2410wdt_resume(struct device *dev) { /* Restore watchdog state. */ @@ -495,16 +496,15 @@ static int s3c2410wdt_resume(struct platform_device *dev) #endif /* CONFIG_PM */ -static struct platform_driver s3c2410wdt_driver = { +static struct device_driver s3c2410wdt_driver = { + .owner = THIS_MODULE, + .name = "s3c2410-wdt", + .bus = &platform_bus_type, .probe = s3c2410wdt_probe, .remove = s3c2410wdt_remove, .shutdown = s3c2410wdt_shutdown, .suspend = s3c2410wdt_suspend, .resume = s3c2410wdt_resume, - .driver = { - .owner = THIS_MODULE, - .name = "s3c2410-wdt", - }, }; @@ -513,12 +513,12 @@ static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Si static int __init watchdog_init(void) { printk(banner); - return platform_driver_register(&s3c2410wdt_driver); + return driver_register(&s3c2410wdt_driver); } static void __exit watchdog_exit(void) { - platform_driver_unregister(&s3c2410wdt_driver); + driver_unregister(&s3c2410wdt_driver); } module_init(watchdog_init); diff --git a/trunk/drivers/hwmon/hdaps.c b/trunk/drivers/hwmon/hdaps.c index c81bd4bce1b8..1e5dfc7805e2 100644 --- a/trunk/drivers/hwmon/hdaps.c +++ b/trunk/drivers/hwmon/hdaps.c @@ -60,11 +60,9 @@ #define HDAPS_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ #define HDAPS_INPUT_FUZZ 4 /* input event threshold */ -#define HDAPS_INPUT_FLAT 4 static struct timer_list hdaps_timer; static struct platform_device *pdev; -static struct input_dev *hdaps_idev; static unsigned int hdaps_invert; static u8 km_activity; static int rest_x; @@ -286,7 +284,7 @@ static int hdaps_device_init(void) /* Device model stuff */ -static int hdaps_probe(struct platform_device *dev) +static int hdaps_probe(struct device *dev) { int ret; @@ -298,18 +296,29 @@ static int hdaps_probe(struct platform_device *dev) return 0; } -static int hdaps_resume(struct platform_device *dev) +static int hdaps_resume(struct device *dev) { return hdaps_device_init(); } -static struct platform_driver hdaps_driver = { +static struct device_driver hdaps_driver = { + .name = "hdaps", + .bus = &platform_bus_type, + .owner = THIS_MODULE, .probe = hdaps_probe, - .resume = hdaps_resume, - .driver = { - .name = "hdaps", - .owner = THIS_MODULE, - }, + .resume = hdaps_resume +}; + +/* Input class stuff */ + +static struct input_dev hdaps_idev = { + .name = "hdaps", + .evbit = { BIT(EV_ABS) }, + .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, + .absmin = { [ABS_X] = -256, [ABS_Y] = -256 }, + .absmax = { [ABS_X] = 256, [ABS_Y] = 256 }, + .absfuzz = { [ABS_X] = HDAPS_INPUT_FUZZ, [ABS_Y] = HDAPS_INPUT_FUZZ }, + .absflat = { [ABS_X] = HDAPS_INPUT_FUZZ, [ABS_Y] = HDAPS_INPUT_FUZZ }, }; /* @@ -333,9 +342,9 @@ static void hdaps_mousedev_poll(unsigned long unused) if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) goto out; - input_report_abs(hdaps_idev, ABS_X, x - rest_x); - input_report_abs(hdaps_idev, ABS_Y, y - rest_y); - input_sync(hdaps_idev); + input_report_abs(&hdaps_idev, ABS_X, x - rest_x); + input_report_abs(&hdaps_idev, ABS_Y, y - rest_y); + input_sync(&hdaps_idev); mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD); @@ -541,7 +550,7 @@ static int __init hdaps_init(void) goto out; } - ret = platform_driver_register(&hdaps_driver); + ret = driver_register(&hdaps_driver); if (ret) goto out_region; @@ -555,25 +564,12 @@ static int __init hdaps_init(void) if (ret) goto out_device; - hdaps_idev = input_allocate_device(); - if (!hdaps_idev) { - ret = -ENOMEM; - goto out_group; - } - /* initial calibrate for the input device */ hdaps_calibrate(); /* initialize the input class */ - hdaps_idev->name = "hdaps"; - hdaps_idev->cdev.dev = &pdev->dev; - hdaps_idev->evbit[0] = BIT(EV_ABS); - input_set_abs_params(hdaps_idev, ABS_X, - -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); - input_set_abs_params(hdaps_idev, ABS_X, - -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); - - input_register_device(hdaps_idev); + hdaps_idev.dev = &pdev->dev; + input_register_device(&hdaps_idev); /* start up our timer for the input device */ init_timer(&hdaps_timer); @@ -584,12 +580,10 @@ static int __init hdaps_init(void) printk(KERN_INFO "hdaps: driver successfully loaded.\n"); return 0; -out_group: - sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); out_device: platform_device_unregister(pdev); out_driver: - platform_driver_unregister(&hdaps_driver); + driver_unregister(&hdaps_driver); out_region: release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); out: @@ -600,10 +594,10 @@ static int __init hdaps_init(void) static void __exit hdaps_exit(void) { del_timer_sync(&hdaps_timer); - input_unregister_device(hdaps_idev); + input_unregister_device(&hdaps_idev); sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); platform_device_unregister(pdev); - platform_driver_unregister(&hdaps_driver); + driver_unregister(&hdaps_driver); release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); printk(KERN_INFO "hdaps: driver unloaded.\n"); diff --git a/trunk/drivers/i2c/busses/i2c-iop3xx.c b/trunk/drivers/i2c/busses/i2c-iop3xx.c index 1414851a17b8..cfae4ad00fae 100644 --- a/trunk/drivers/i2c/busses/i2c-iop3xx.c +++ b/trunk/drivers/i2c/busses/i2c-iop3xx.c @@ -405,9 +405,10 @@ static struct i2c_algorithm iop3xx_i2c_algo = { }; static int -iop3xx_i2c_remove(struct platform_device *pdev) +iop3xx_i2c_remove(struct device *device) { - struct i2c_adapter *padapter = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(device); + struct i2c_adapter *padapter = dev_get_drvdata(&pdev->dev); struct i2c_algo_iop3xx_data *adapter_data = (struct i2c_algo_iop3xx_data *)padapter->algo_data; struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -425,14 +426,15 @@ iop3xx_i2c_remove(struct platform_device *pdev) kfree(adapter_data); kfree(padapter); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(&pdev->dev, NULL); return 0; } static int -iop3xx_i2c_probe(struct platform_device *pdev) +iop3xx_i2c_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct resource *res; int ret; struct i2c_adapter *new_adapter; @@ -497,7 +499,7 @@ iop3xx_i2c_probe(struct platform_device *pdev) iop3xx_i2c_set_slave_addr(adapter_data); iop3xx_i2c_enable(adapter_data); - platform_set_drvdata(pdev, new_adapter); + dev_set_drvdata(&pdev->dev, new_adapter); new_adapter->algo_data = adapter_data; i2c_add_adapter(new_adapter); @@ -521,25 +523,24 @@ iop3xx_i2c_probe(struct platform_device *pdev) } -static struct platform_driver iop3xx_i2c_driver = { +static struct device_driver iop3xx_i2c_driver = { + .owner = THIS_MODULE, + .name = "IOP3xx-I2C", + .bus = &platform_bus_type, .probe = iop3xx_i2c_probe, - .remove = iop3xx_i2c_remove, - .driver = { - .owner = THIS_MODULE, - .name = "IOP3xx-I2C", - }, + .remove = iop3xx_i2c_remove }; static int __init i2c_iop3xx_init (void) { - return platform_driver_register(&iop3xx_i2c_driver); + return driver_register(&iop3xx_i2c_driver); } static void __exit i2c_iop3xx_exit (void) { - platform_driver_unregister(&iop3xx_i2c_driver); + driver_unregister(&iop3xx_i2c_driver); return; } diff --git a/trunk/drivers/i2c/busses/i2c-ixp2000.c b/trunk/drivers/i2c/busses/i2c-ixp2000.c index cef024a7d048..64552a376f2d 100644 --- a/trunk/drivers/i2c/busses/i2c-ixp2000.c +++ b/trunk/drivers/i2c/busses/i2c-ixp2000.c @@ -86,11 +86,12 @@ struct ixp2000_i2c_data { struct i2c_algo_bit_data algo_data; }; -static int ixp2000_i2c_remove(struct platform_device *plat_dev) +static int ixp2000_i2c_remove(struct device *dev) { - struct ixp2000_i2c_data *drv_data = platform_get_drvdata(plat_dev); + struct platform_device *plat_dev = to_platform_device(dev); + struct ixp2000_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev); - platform_set_drvdata(plat_dev, NULL); + dev_set_drvdata(&plat_dev->dev, NULL); i2c_bit_del_bus(&drv_data->adapter); @@ -99,9 +100,10 @@ static int ixp2000_i2c_remove(struct platform_device *plat_dev) return 0; } -static int ixp2000_i2c_probe(struct platform_device *plat_dev) +static int ixp2000_i2c_probe(struct device *dev) { int err; + struct platform_device *plat_dev = to_platform_device(dev); struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; struct ixp2000_i2c_data *drv_data = kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); @@ -137,28 +139,27 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) return err; } - platform_set_drvdata(plat_dev, drv_data); + dev_set_drvdata(&plat_dev->dev, drv_data); return 0; } -static struct platform_driver ixp2000_i2c_driver = { +static struct device_driver ixp2000_i2c_driver = { + .owner = THIS_MODULE, + .name = "IXP2000-I2C", + .bus = &platform_bus_type, .probe = ixp2000_i2c_probe, .remove = ixp2000_i2c_remove, - .driver = { - .name = "IXP2000-I2C", - .owner = THIS_MODULE, - }, }; static int __init ixp2000_i2c_init(void) { - return platform_driver_register(&ixp2000_i2c_driver); + return driver_register(&ixp2000_i2c_driver); } static void __exit ixp2000_i2c_exit(void) { - platform_driver_unregister(&ixp2000_i2c_driver); + driver_unregister(&ixp2000_i2c_driver); } module_init(ixp2000_i2c_init); diff --git a/trunk/drivers/i2c/busses/i2c-ixp4xx.c b/trunk/drivers/i2c/busses/i2c-ixp4xx.c index aa36855fa995..cc652c350814 100644 --- a/trunk/drivers/i2c/busses/i2c-ixp4xx.c +++ b/trunk/drivers/i2c/busses/i2c-ixp4xx.c @@ -87,11 +87,12 @@ struct ixp4xx_i2c_data { struct i2c_algo_bit_data algo_data; }; -static int ixp4xx_i2c_remove(struct platform_device *plat_dev) +static int ixp4xx_i2c_remove(struct device *dev) { - struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev); + struct platform_device *plat_dev = to_platform_device(dev); + struct ixp4xx_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev); - platform_set_drvdata(plat_dev, NULL); + dev_set_drvdata(&plat_dev->dev, NULL); i2c_bit_del_bus(&drv_data->adapter); @@ -100,9 +101,10 @@ static int ixp4xx_i2c_remove(struct platform_device *plat_dev) return 0; } -static int ixp4xx_i2c_probe(struct platform_device *plat_dev) +static int ixp4xx_i2c_probe(struct device *dev) { int err; + struct platform_device *plat_dev = to_platform_device(dev); struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; struct ixp4xx_i2c_data *drv_data = kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); @@ -146,28 +148,27 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) return err; } - platform_set_drvdata(plat_dev, drv_data); + dev_set_drvdata(&plat_dev->dev, drv_data); return 0; } -static struct platform_driver ixp4xx_i2c_driver = { +static struct device_driver ixp4xx_i2c_driver = { + .owner = THIS_MODULE, + .name = "IXP4XX-I2C", + .bus = &platform_bus_type, .probe = ixp4xx_i2c_probe, .remove = ixp4xx_i2c_remove, - .driver = { - .name = "IXP4XX-I2C", - .owner = THIS_MODULE, - }, }; static int __init ixp4xx_i2c_init(void) { - return platform_driver_register(&ixp4xx_i2c_driver); + return driver_register(&ixp4xx_i2c_driver); } static void __exit ixp4xx_i2c_exit(void) { - platform_driver_unregister(&ixp4xx_i2c_driver); + driver_unregister(&ixp4xx_i2c_driver); } module_init(ixp4xx_i2c_init); diff --git a/trunk/drivers/i2c/busses/i2c-mpc.c b/trunk/drivers/i2c/busses/i2c-mpc.c index 5ccd338a9dc9..65b939a059e9 100644 --- a/trunk/drivers/i2c/busses/i2c-mpc.c +++ b/trunk/drivers/i2c/busses/i2c-mpc.c @@ -288,10 +288,11 @@ static struct i2c_adapter mpc_ops = { .retries = 1 }; -static int fsl_i2c_probe(struct platform_device *pdev) +static int fsl_i2c_probe(struct device *device) { int result = 0; struct mpc_i2c *i2c; + struct platform_device *pdev = to_platform_device(device); struct fsl_i2c_platform_data *pdata; struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -322,7 +323,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) } mpc_i2c_setclock(i2c); - platform_set_drvdata(pdev, i2c); + dev_set_drvdata(device, i2c); i2c->adap = mpc_ops; i2c_set_adapdata(&i2c->adap, i2c); @@ -344,12 +345,12 @@ static int fsl_i2c_probe(struct platform_device *pdev) return result; }; -static int fsl_i2c_remove(struct platform_device *pdev) +static int fsl_i2c_remove(struct device *device) { - struct mpc_i2c *i2c = platform_get_drvdata(pdev); + struct mpc_i2c *i2c = dev_get_drvdata(device); i2c_del_adapter(&i2c->adap); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(device, NULL); if (i2c->irq != 0) free_irq(i2c->irq, i2c); @@ -360,23 +361,22 @@ static int fsl_i2c_remove(struct platform_device *pdev) }; /* Structure for a device driver */ -static struct platform_driver fsl_i2c_driver = { +static struct device_driver fsl_i2c_driver = { + .owner = THIS_MODULE, + .name = "fsl-i2c", + .bus = &platform_bus_type, .probe = fsl_i2c_probe, .remove = fsl_i2c_remove, - .driver = { - .owner = THIS_MODULE, - .name = "fsl-i2c", - }, }; static int __init fsl_i2c_init(void) { - return platform_driver_register(&fsl_i2c_driver); + return driver_register(&fsl_i2c_driver); } static void __exit fsl_i2c_exit(void) { - platform_driver_unregister(&fsl_i2c_driver); + driver_unregister(&fsl_i2c_driver); } module_init(fsl_i2c_init); diff --git a/trunk/drivers/i2c/busses/i2c-mv64xxx.c b/trunk/drivers/i2c/busses/i2c-mv64xxx.c index afd7634e5cc9..6b48027b2ee3 100644 --- a/trunk/drivers/i2c/busses/i2c-mv64xxx.c +++ b/trunk/drivers/i2c/busses/i2c-mv64xxx.c @@ -492,10 +492,11 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data) } static int __devinit -mv64xxx_i2c_probe(struct platform_device *pd) +mv64xxx_i2c_probe(struct device *dev) { + struct platform_device *pd = to_platform_device(dev); struct mv64xxx_i2c_data *drv_data; - struct mv64xxx_i2c_pdata *pdata = pd->dev.platform_data; + struct mv64xxx_i2c_pdata *pdata = dev->platform_data; int rc; if ((pd->id != 0) || !pdata) @@ -525,7 +526,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) drv_data->adapter.class = I2C_CLASS_HWMON; drv_data->adapter.timeout = pdata->timeout; drv_data->adapter.retries = pdata->retries; - platform_set_drvdata(pd, drv_data); + dev_set_drvdata(dev, drv_data); i2c_set_adapdata(&drv_data->adapter, drv_data); if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, @@ -554,9 +555,9 @@ mv64xxx_i2c_probe(struct platform_device *pd) } static int __devexit -mv64xxx_i2c_remove(struct platform_device *dev) +mv64xxx_i2c_remove(struct device *dev) { - struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev); + struct mv64xxx_i2c_data *drv_data = dev_get_drvdata(dev); int rc; rc = i2c_del_adapter(&drv_data->adapter); @@ -567,25 +568,24 @@ mv64xxx_i2c_remove(struct platform_device *dev) return rc; } -static struct platform_driver mv64xxx_i2c_driver = { +static struct device_driver mv64xxx_i2c_driver = { + .owner = THIS_MODULE, + .name = MV64XXX_I2C_CTLR_NAME, + .bus = &platform_bus_type, .probe = mv64xxx_i2c_probe, .remove = mv64xxx_i2c_remove, - .driver = { - .owner = THIS_MODULE, - .name = MV64XXX_I2C_CTLR_NAME, - }, }; static int __init mv64xxx_i2c_init(void) { - return platform_driver_register(&mv64xxx_i2c_driver); + return driver_register(&mv64xxx_i2c_driver); } static void __exit mv64xxx_i2c_exit(void) { - platform_driver_unregister(&mv64xxx_i2c_driver); + driver_unregister(&mv64xxx_i2c_driver); } module_init(mv64xxx_i2c_init); diff --git a/trunk/drivers/i2c/busses/i2c-pxa.c b/trunk/drivers/i2c/busses/i2c-pxa.c index 70f7ab829d36..67ccbea24ba4 100644 --- a/trunk/drivers/i2c/busses/i2c-pxa.c +++ b/trunk/drivers/i2c/busses/i2c-pxa.c @@ -936,10 +936,10 @@ static struct pxa_i2c i2c_pxa = { }, }; -static int i2c_pxa_probe(struct platform_device *dev) +static int i2c_pxa_probe(struct device *dev) { struct pxa_i2c *i2c = &i2c_pxa; - struct i2c_pxa_platform_data *plat = dev->dev.platform_data; + struct i2c_pxa_platform_data *plat = dev->platform_data; int ret; #ifdef CONFIG_PXA27x @@ -968,7 +968,7 @@ static int i2c_pxa_probe(struct platform_device *dev) i2c_pxa_reset(i2c); i2c->adap.algo_data = i2c; - i2c->adap.dev.parent = &dev->dev; + i2c->adap.dev.parent = dev; ret = i2c_add_adapter(&i2c->adap); if (ret < 0) { @@ -976,7 +976,7 @@ static int i2c_pxa_probe(struct platform_device *dev) goto err_irq; } - platform_set_drvdata(dev, i2c); + dev_set_drvdata(dev, i2c); #ifdef CONFIG_I2C_PXA_SLAVE printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", @@ -993,11 +993,11 @@ static int i2c_pxa_probe(struct platform_device *dev) return ret; } -static int i2c_pxa_remove(struct platform_device *dev) +static int i2c_pxa_remove(struct device *dev) { - struct pxa_i2c *i2c = platform_get_drvdata(dev); + struct pxa_i2c *i2c = dev_get_drvdata(dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); i2c_del_adapter(&i2c->adap); free_irq(IRQ_I2C, i2c); @@ -1006,22 +1006,21 @@ static int i2c_pxa_remove(struct platform_device *dev) return 0; } -static struct platform_driver i2c_pxa_driver = { +static struct device_driver i2c_pxa_driver = { + .name = "pxa2xx-i2c", + .bus = &platform_bus_type, .probe = i2c_pxa_probe, .remove = i2c_pxa_remove, - .driver = { - .name = "pxa2xx-i2c", - }, }; static int __init i2c_adap_pxa_init(void) { - return platform_driver_register(&i2c_pxa_driver); + return driver_register(&i2c_pxa_driver); } static void i2c_adap_pxa_exit(void) { - return platform_driver_unregister(&i2c_pxa_driver); + return driver_unregister(&i2c_pxa_driver); } module_init(i2c_adap_pxa_init); diff --git a/trunk/drivers/i2c/busses/i2c-s3c2410.c b/trunk/drivers/i2c/busses/i2c-s3c2410.c index 58cfd3111ef6..1b582262e677 100644 --- a/trunk/drivers/i2c/busses/i2c-s3c2410.c +++ b/trunk/drivers/i2c/busses/i2c-s3c2410.c @@ -760,23 +760,24 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c) * called by the bus driver when a suitable device is found */ -static int s3c24xx_i2c_probe(struct platform_device *pdev) +static int s3c24xx_i2c_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct s3c24xx_i2c *i2c = &s3c24xx_i2c; struct resource *res; int ret; /* find the clock and enable it */ - i2c->dev = &pdev->dev; - i2c->clk = clk_get(&pdev->dev, "i2c"); + i2c->dev = dev; + i2c->clk = clk_get(dev, "i2c"); if (IS_ERR(i2c->clk)) { - dev_err(&pdev->dev, "cannot get clock\n"); + dev_err(dev, "cannot get clock\n"); ret = -ENOENT; goto out; } - dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk); + dev_dbg(dev, "clock source %p\n", i2c->clk); clk_use(i2c->clk); clk_enable(i2c->clk); @@ -785,7 +786,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { - dev_err(&pdev->dev, "cannot find IO resource\n"); + dev_err(dev, "cannot find IO resource\n"); ret = -ENOENT; goto out; } @@ -794,7 +795,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) pdev->name); if (i2c->ioarea == NULL) { - dev_err(&pdev->dev, "cannot request IO\n"); + dev_err(dev, "cannot request IO\n"); ret = -ENXIO; goto out; } @@ -802,17 +803,17 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) i2c->regs = ioremap(res->start, (res->end-res->start)+1); if (i2c->regs == NULL) { - dev_err(&pdev->dev, "cannot map IO\n"); + dev_err(dev, "cannot map IO\n"); ret = -ENXIO; goto out; } - dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); + dev_dbg(dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); /* setup info block for the i2c core */ i2c->adap.algo_data = i2c; - i2c->adap.dev.parent = &pdev->dev; + i2c->adap.dev.parent = dev; /* initialise the i2c controller */ @@ -826,7 +827,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (res == NULL) { - dev_err(&pdev->dev, "cannot find IRQ\n"); + dev_err(dev, "cannot find IRQ\n"); ret = -ENOENT; goto out; } @@ -835,23 +836,23 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) pdev->name, i2c); if (ret != 0) { - dev_err(&pdev->dev, "cannot claim IRQ\n"); + dev_err(dev, "cannot claim IRQ\n"); goto out; } i2c->irq = res; - dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start); + dev_dbg(dev, "irq resource %p (%ld)\n", res, res->start); ret = i2c_add_adapter(&i2c->adap); if (ret < 0) { - dev_err(&pdev->dev, "failed to add bus to i2c core\n"); + dev_err(dev, "failed to add bus to i2c core\n"); goto out; } - platform_set_drvdata(pdev, i2c); + dev_set_drvdata(dev, i2c); - dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); + dev_info(dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); out: if (ret < 0) @@ -865,22 +866,22 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) * called when device is removed from the bus */ -static int s3c24xx_i2c_remove(struct platform_device *pdev) +static int s3c24xx_i2c_remove(struct device *dev) { - struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); + struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); if (i2c != NULL) { s3c24xx_i2c_free(i2c); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); } return 0; } #ifdef CONFIG_PM -static int s3c24xx_i2c_resume(struct platform_device *dev) +static int s3c24xx_i2c_resume(struct device *dev) { - struct s3c24xx_i2c *i2c = platform_get_drvdata(dev); + struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); if (i2c != NULL) s3c24xx_i2c_init(i2c); @@ -894,35 +895,33 @@ static int s3c24xx_i2c_resume(struct platform_device *dev) /* device driver for platform bus bits */ -static struct platform_driver s3c2410_i2c_driver = { +static struct device_driver s3c2410_i2c_driver = { + .owner = THIS_MODULE, + .name = "s3c2410-i2c", + .bus = &platform_bus_type, .probe = s3c24xx_i2c_probe, .remove = s3c24xx_i2c_remove, .resume = s3c24xx_i2c_resume, - .driver = { - .owner = THIS_MODULE, - .name = "s3c2410-i2c", - }, }; -static struct platform_driver s3c2440_i2c_driver = { +static struct device_driver s3c2440_i2c_driver = { + .owner = THIS_MODULE, + .name = "s3c2440-i2c", + .bus = &platform_bus_type, .probe = s3c24xx_i2c_probe, .remove = s3c24xx_i2c_remove, .resume = s3c24xx_i2c_resume, - .driver = { - .owner = THIS_MODULE, - .name = "s3c2440-i2c", - }, }; static int __init i2c_adap_s3c_init(void) { int ret; - ret = platform_driver_register(&s3c2410_i2c_driver); + ret = driver_register(&s3c2410_i2c_driver); if (ret == 0) { - ret = platform_driver_register(&s3c2440_i2c_driver); + ret = driver_register(&s3c2440_i2c_driver); if (ret) - platform_driver_unregister(&s3c2410_i2c_driver); + driver_unregister(&s3c2410_i2c_driver); } return ret; @@ -930,8 +929,8 @@ static int __init i2c_adap_s3c_init(void) static void __exit i2c_adap_s3c_exit(void) { - platform_driver_unregister(&s3c2410_i2c_driver); - platform_driver_unregister(&s3c2440_i2c_driver); + driver_unregister(&s3c2410_i2c_driver); + driver_unregister(&s3c2440_i2c_driver); } module_init(i2c_adap_s3c_init); diff --git a/trunk/drivers/i2c/chips/isp1301_omap.c b/trunk/drivers/i2c/chips/isp1301_omap.c index d2a100d77839..9dbb72fffbe2 100644 --- a/trunk/drivers/i2c/chips/isp1301_omap.c +++ b/trunk/drivers/i2c/chips/isp1301_omap.c @@ -873,27 +873,26 @@ static int otg_init(struct isp1301 *isp) return 0; } -static int otg_probe(struct platform_device *dev) +static int otg_probe(struct device *dev) { // struct omap_usb_config *config = dev->platform_data; - otg_dev = dev; + otg_dev = to_platform_device(dev); return 0; } -static int otg_remove(struct platform_device *dev) +static int otg_remove(struct device *dev) { otg_dev = 0; return 0; } -struct platform_driver omap_otg_driver = { +struct device_driver omap_otg_driver = { + .owner = THIS_MODULE, + .name = "omap_otg", + .bus = &platform_bus_type, .probe = otg_probe, - .remove = otg_remove, - .driver = { - .owner = THIS_MODULE, - .name = "omap_otg", - }, + .remove = otg_remove, }; static int otg_bind(struct isp1301 *isp) @@ -903,7 +902,7 @@ static int otg_bind(struct isp1301 *isp) if (otg_dev) return -EBUSY; - status = platform_driver_register(&omap_otg_driver); + status = driver_register(&omap_otg_driver); if (status < 0) return status; @@ -914,7 +913,7 @@ static int otg_bind(struct isp1301 *isp) status = -ENODEV; if (status < 0) - platform_driver_unregister(&omap_otg_driver); + driver_unregister(&omap_otg_driver); return status; } diff --git a/trunk/drivers/input/keyboard/corgikbd.c b/trunk/drivers/input/keyboard/corgikbd.c index 64672d491222..d00d14bb637a 100644 --- a/trunk/drivers/input/keyboard/corgikbd.c +++ b/trunk/drivers/input/keyboard/corgikbd.c @@ -259,17 +259,17 @@ static void corgikbd_hinge_timer(unsigned long data) } #ifdef CONFIG_PM -static int corgikbd_suspend(struct platform_device *dev, pm_message_t state) +static int corgikbd_suspend(struct device *dev, pm_message_t state) { - struct corgikbd *corgikbd = platform_get_drvdata(dev); + struct corgikbd *corgikbd = dev_get_drvdata(dev); corgikbd->suspended = 1; return 0; } -static int corgikbd_resume(struct platform_device *dev) +static int corgikbd_resume(struct device *dev) { - struct corgikbd *corgikbd = platform_get_drvdata(dev); + struct corgikbd *corgikbd = dev_get_drvdata(dev); /* Upon resume, ignore the suspend key for a short while */ corgikbd->suspend_jiffies=jiffies; @@ -282,7 +282,7 @@ static int corgikbd_resume(struct platform_device *dev) #define corgikbd_resume NULL #endif -static int __init corgikbd_probe(struct platform_device *pdev) +static int __init corgikbd_probe(struct device *dev) { struct corgikbd *corgikbd; struct input_dev *input_dev; @@ -296,7 +296,7 @@ static int __init corgikbd_probe(struct platform_device *pdev) return -ENOMEM; } - platform_set_drvdata(pdev, corgikbd); + dev_set_drvdata(dev, corgikbd); corgikbd->input = input_dev; spin_lock_init(&corgikbd->lock); @@ -321,7 +321,7 @@ static int __init corgikbd_probe(struct platform_device *pdev) input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &pdev->dev; + input_dev->cdev.dev = dev; input_dev->private = corgikbd; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); @@ -356,10 +356,10 @@ static int __init corgikbd_probe(struct platform_device *pdev) return 0; } -static int corgikbd_remove(struct platform_device *pdev) +static int corgikbd_remove(struct device *dev) { int i; - struct corgikbd *corgikbd = platform_get_drvdata(pdev); + struct corgikbd *corgikbd = dev_get_drvdata(dev); for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd); @@ -374,24 +374,23 @@ static int corgikbd_remove(struct platform_device *pdev) return 0; } -static struct platform_driver corgikbd_driver = { +static struct device_driver corgikbd_driver = { + .name = "corgi-keyboard", + .bus = &platform_bus_type, .probe = corgikbd_probe, .remove = corgikbd_remove, .suspend = corgikbd_suspend, .resume = corgikbd_resume, - .driver = { - .name = "corgi-keyboard", - }, }; static int __devinit corgikbd_init(void) { - return platform_driver_register(&corgikbd_driver); + return driver_register(&corgikbd_driver); } static void __exit corgikbd_exit(void) { - platform_driver_unregister(&corgikbd_driver); + driver_unregister(&corgikbd_driver); } module_init(corgikbd_init); diff --git a/trunk/drivers/input/keyboard/spitzkbd.c b/trunk/drivers/input/keyboard/spitzkbd.c index 6a15fe3bc527..0fa38a559cdf 100644 --- a/trunk/drivers/input/keyboard/spitzkbd.c +++ b/trunk/drivers/input/keyboard/spitzkbd.c @@ -309,10 +309,10 @@ static void spitzkbd_hinge_timer(unsigned long data) } #ifdef CONFIG_PM -static int spitzkbd_suspend(struct platform_device *dev, pm_message_t state) +static int spitzkbd_suspend(struct device *dev, pm_message_t state) { int i; - struct spitzkbd *spitzkbd = platform_get_drvdata(dev); + struct spitzkbd *spitzkbd = dev_get_drvdata(dev); spitzkbd->suspended = 1; /* Set Strobe lines as inputs - *except* strobe line 0 leave this @@ -323,10 +323,10 @@ static int spitzkbd_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int spitzkbd_resume(struct platform_device *dev) +static int spitzkbd_resume(struct device *dev) { int i; - struct spitzkbd *spitzkbd = platform_get_drvdata(dev); + struct spitzkbd *spitzkbd = dev_get_drvdata(dev); for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++) pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH); @@ -342,7 +342,7 @@ static int spitzkbd_resume(struct platform_device *dev) #define spitzkbd_resume NULL #endif -static int __init spitzkbd_probe(struct platform_device *dev) +static int __init spitzkbd_probe(struct device *dev) { struct spitzkbd *spitzkbd; struct input_dev *input_dev; @@ -358,7 +358,7 @@ static int __init spitzkbd_probe(struct platform_device *dev) return -ENOMEM; } - platform_set_drvdata(dev, spitzkbd); + dev_set_drvdata(dev, spitzkbd); strcpy(spitzkbd->phys, "spitzkbd/input0"); spin_lock_init(&spitzkbd->lock); @@ -380,7 +380,7 @@ static int __init spitzkbd_probe(struct platform_device *dev) input_dev->private = spitzkbd; input_dev->name = "Spitz Keyboard"; input_dev->phys = spitzkbd->phys; - input_dev->cdev.dev = &dev->dev; + input_dev->cdev.dev = dev; input_dev->id.bustype = BUS_HOST; input_dev->id.vendor = 0x0001; @@ -437,10 +437,10 @@ static int __init spitzkbd_probe(struct platform_device *dev) return 0; } -static int spitzkbd_remove(struct platform_device *dev) +static int spitzkbd_remove(struct device *dev) { int i; - struct spitzkbd *spitzkbd = platform_get_drvdata(dev); + struct spitzkbd *spitzkbd = dev_get_drvdata(dev); for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd); @@ -460,24 +460,23 @@ static int spitzkbd_remove(struct platform_device *dev) return 0; } -static struct platform_driver spitzkbd_driver = { +static struct device_driver spitzkbd_driver = { + .name = "spitz-keyboard", + .bus = &platform_bus_type, .probe = spitzkbd_probe, .remove = spitzkbd_remove, .suspend = spitzkbd_suspend, .resume = spitzkbd_resume, - .driver = { - .name = "spitz-keyboard", - }, }; static int __devinit spitzkbd_init(void) { - return platform_driver_register(&spitzkbd_driver); + return driver_register(&spitzkbd_driver); } static void __exit spitzkbd_exit(void) { - platform_driver_unregister(&spitzkbd_driver); + driver_unregister(&spitzkbd_driver); } module_init(spitzkbd_init); diff --git a/trunk/drivers/input/serio/i8042.c b/trunk/drivers/input/serio/i8042.c index ac86c1d1d83e..01e186422021 100644 --- a/trunk/drivers/input/serio/i8042.c +++ b/trunk/drivers/input/serio/i8042.c @@ -912,7 +912,7 @@ static long i8042_panic_blink(long count) * Here we try to restore the original BIOS settings */ -static int i8042_suspend(struct platform_device *dev, pm_message_t state) +static int i8042_suspend(struct device *dev, pm_message_t state) { del_timer_sync(&i8042_timer); i8042_controller_reset(); @@ -925,7 +925,7 @@ static int i8042_suspend(struct platform_device *dev, pm_message_t state) * Here we try to reset everything back to a state in which suspended */ -static int i8042_resume(struct platform_device *dev) +static int i8042_resume(struct device *dev) { int i; @@ -964,18 +964,17 @@ static int i8042_resume(struct platform_device *dev) * because otherwise BIOSes will be confused. */ -static void i8042_shutdown(struct platform_device *dev) +static void i8042_shutdown(struct device *dev) { i8042_controller_cleanup(); } -static struct platform_driver i8042_driver = { +static struct device_driver i8042_driver = { + .name = "i8042", + .bus = &platform_bus_type, .suspend = i8042_suspend, .resume = i8042_resume, .shutdown = i8042_shutdown, - .driver = { - .name = "i8042", - }, }; static int __init i8042_create_kbd_port(void) @@ -1079,7 +1078,7 @@ static int __init i8042_init(void) goto err_platform_exit; } - err = platform_driver_register(&i8042_driver); + err = driver_register(&i8042_driver); if (err) goto err_controller_cleanup; @@ -1127,7 +1126,7 @@ static int __init i8042_init(void) err_unregister_device: platform_device_unregister(i8042_platform_device); err_unregister_driver: - platform_driver_unregister(&i8042_driver); + driver_unregister(&i8042_driver); err_controller_cleanup: i8042_controller_cleanup(); err_platform_exit: @@ -1149,7 +1148,7 @@ static void __exit i8042_exit(void) del_timer_sync(&i8042_timer); platform_device_unregister(i8042_platform_device); - platform_driver_unregister(&i8042_driver); + driver_unregister(&i8042_driver); i8042_platform_exit(); diff --git a/trunk/drivers/input/serio/rpckbd.c b/trunk/drivers/input/serio/rpckbd.c index a3bd11589bc3..52c49258f8a4 100644 --- a/trunk/drivers/input/serio/rpckbd.c +++ b/trunk/drivers/input/serio/rpckbd.c @@ -107,7 +107,7 @@ static void rpckbd_close(struct serio *port) * Allocate and initialize serio structure for subsequent registration * with serio core. */ -static int __devinit rpckbd_probe(struct platform_device *dev) +static int __devinit rpckbd_probe(struct device *dev) { struct serio *serio; @@ -120,38 +120,37 @@ static int __devinit rpckbd_probe(struct platform_device *dev) serio->write = rpckbd_write; serio->open = rpckbd_open; serio->close = rpckbd_close; - serio->dev.parent = &dev->dev; + serio->dev.parent = dev; strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); - platform_set_drvdata(dev, serio); + dev_set_drvdata(dev, serio); serio_register_port(serio); return 0; } -static int __devexit rpckbd_remove(struct platform_device *dev) +static int __devexit rpckbd_remove(struct device *dev) { - struct serio *serio = platform_get_drvdata(dev); + struct serio *serio = dev_get_drvdata(dev); serio_unregister_port(serio); return 0; } -static struct platform_driver rpckbd_driver = { +static struct device_driver rpckbd_driver = { + .name = "kart", + .bus = &platform_bus_type, .probe = rpckbd_probe, .remove = __devexit_p(rpckbd_remove), - .driver = { - .name = "kart", - }, }; static int __init rpckbd_init(void) { - return platform_driver_register(&rpckbd_driver); + return driver_register(&rpckbd_driver); } static void __exit rpckbd_exit(void) { - platform_driver_unregister(&rpckbd_driver); + driver_unregister(&rpckbd_driver); } module_init(rpckbd_init); diff --git a/trunk/drivers/input/touchscreen/corgi_ts.c b/trunk/drivers/input/touchscreen/corgi_ts.c index 1042987856f7..15e88eeae8d6 100644 --- a/trunk/drivers/input/touchscreen/corgi_ts.c +++ b/trunk/drivers/input/touchscreen/corgi_ts.c @@ -231,9 +231,9 @@ static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs) } #ifdef CONFIG_PM -static int corgits_suspend(struct platform_device *dev, pm_message_t state) +static int corgits_suspend(struct device *dev, pm_message_t state) { - struct corgi_ts *corgi_ts = platform_get_drvdata(dev); + struct corgi_ts *corgi_ts = dev_get_drvdata(dev); if (corgi_ts->pendown) { del_timer_sync(&corgi_ts->timer); @@ -248,9 +248,9 @@ static int corgits_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int corgits_resume(struct platform_device *dev) +static int corgits_resume(struct device *dev) { - struct corgi_ts *corgi_ts = platform_get_drvdata(dev); + struct corgi_ts *corgi_ts = dev_get_drvdata(dev); corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS); /* Enable Falling Edge */ @@ -264,9 +264,10 @@ static int corgits_resume(struct platform_device *dev) #define corgits_resume NULL #endif -static int __init corgits_probe(struct platform_device *pdev) +static int __init corgits_probe(struct device *dev) { struct corgi_ts *corgi_ts; + struct platform_device *pdev = to_platform_device(dev); struct input_dev *input_dev; int err = -ENOMEM; @@ -275,9 +276,9 @@ static int __init corgits_probe(struct platform_device *pdev) if (!corgi_ts || !input_dev) goto fail; - platform_set_drvdata(pdev, corgi_ts); + dev_set_drvdata(dev, corgi_ts); - corgi_ts->machinfo = pdev->dev.platform_data; + corgi_ts->machinfo = dev->platform_data; corgi_ts->irq_gpio = platform_get_irq(pdev, 0); if (corgi_ts->irq_gpio < 0) { @@ -297,7 +298,7 @@ static int __init corgits_probe(struct platform_device *pdev) input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0002; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &pdev->dev; + input_dev->cdev.dev = dev; input_dev->private = corgi_ts; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); @@ -338,9 +339,9 @@ static int __init corgits_probe(struct platform_device *pdev) } -static int corgits_remove(struct platform_device *pdev) +static int corgits_remove(struct device *dev) { - struct corgi_ts *corgi_ts = platform_get_drvdata(pdev); + struct corgi_ts *corgi_ts = dev_get_drvdata(dev); free_irq(corgi_ts->irq_gpio, NULL); del_timer_sync(&corgi_ts->timer); @@ -350,24 +351,23 @@ static int corgits_remove(struct platform_device *pdev) return 0; } -static struct platform_driver corgits_driver = { +static struct device_driver corgits_driver = { + .name = "corgi-ts", + .bus = &platform_bus_type, .probe = corgits_probe, .remove = corgits_remove, .suspend = corgits_suspend, .resume = corgits_resume, - .driver = { - .name = "corgi-ts", - }, }; static int __devinit corgits_init(void) { - return platform_driver_register(&corgits_driver); + return driver_register(&corgits_driver); } static void __exit corgits_exit(void) { - platform_driver_unregister(&corgits_driver); + driver_unregister(&corgits_driver); } module_init(corgits_init); diff --git a/trunk/drivers/mfd/mcp-sa11x0.c b/trunk/drivers/mfd/mcp-sa11x0.c index 1eab7cffceaa..7daa0ed7331c 100644 --- a/trunk/drivers/mfd/mcp-sa11x0.c +++ b/trunk/drivers/mfd/mcp-sa11x0.c @@ -138,8 +138,9 @@ static struct mcp_ops mcp_sa11x0 = { .disable = mcp_sa11x0_disable, }; -static int mcp_sa11x0_probe(struct platform_device *pdev) +static int mcp_sa11x0_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct mcp_plat_data *data = pdev->dev.platform_data; struct mcp *mcp; int ret; @@ -164,7 +165,7 @@ static int mcp_sa11x0_probe(struct platform_device *pdev) mcp->dma_telco_rd = DMA_Ser4MCP1Rd; mcp->dma_telco_wr = DMA_Ser4MCP1Wr; - platform_set_drvdata(pdev, mcp); + dev_set_drvdata(dev, mcp); if (machine_is_assabet()) { ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); @@ -201,26 +202,26 @@ static int mcp_sa11x0_probe(struct platform_device *pdev) release: release_mem_region(0x80060000, 0x60); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); out: return ret; } -static int mcp_sa11x0_remove(struct platform_device *dev) +static int mcp_sa11x0_remove(struct device *dev) { - struct mcp *mcp = platform_get_drvdata(dev); + struct mcp *mcp = dev_get_drvdata(dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); mcp_host_unregister(mcp); release_mem_region(0x80060000, 0x60); return 0; } -static int mcp_sa11x0_suspend(struct platform_device *dev, pm_message_t state) +static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state) { - struct mcp *mcp = platform_get_drvdata(dev); + struct mcp *mcp = dev_get_drvdata(dev); priv(mcp)->mccr0 = Ser4MCCR0; priv(mcp)->mccr1 = Ser4MCCR1; @@ -229,9 +230,9 @@ static int mcp_sa11x0_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int mcp_sa11x0_resume(struct platform_device *dev) +static int mcp_sa11x0_resume(struct device *dev) { - struct mcp *mcp = platform_get_drvdata(dev); + struct mcp *mcp = dev_get_drvdata(dev); Ser4MCCR1 = priv(mcp)->mccr1; Ser4MCCR0 = priv(mcp)->mccr0; @@ -242,14 +243,13 @@ static int mcp_sa11x0_resume(struct platform_device *dev) /* * The driver for the SA11x0 MCP port. */ -static struct platform_driver mcp_sa11x0_driver = { +static struct device_driver mcp_sa11x0_driver = { + .name = "sa11x0-mcp", + .bus = &platform_bus_type, .probe = mcp_sa11x0_probe, .remove = mcp_sa11x0_remove, .suspend = mcp_sa11x0_suspend, .resume = mcp_sa11x0_resume, - .driver = { - .name = "sa11x0-mcp", - }, }; /* @@ -257,12 +257,12 @@ static struct platform_driver mcp_sa11x0_driver = { */ static int __init mcp_sa11x0_init(void) { - return platform_driver_register(&mcp_sa11x0_driver); + return driver_register(&mcp_sa11x0_driver); } static void __exit mcp_sa11x0_exit(void) { - platform_driver_unregister(&mcp_sa11x0_driver); + driver_unregister(&mcp_sa11x0_driver); } module_init(mcp_sa11x0_init); diff --git a/trunk/drivers/misc/hdpuftrs/hdpu_cpustate.c b/trunk/drivers/misc/hdpuftrs/hdpu_cpustate.c index 11a801be71c8..bc2b72b32905 100644 --- a/trunk/drivers/misc/hdpuftrs/hdpu_cpustate.c +++ b/trunk/drivers/misc/hdpuftrs/hdpu_cpustate.c @@ -26,8 +26,8 @@ #define SKY_CPUSTATE_VERSION "1.1" -static int hdpu_cpustate_probe(struct platform_device *pdev); -static int hdpu_cpustate_remove(struct platform_device *pdev); +static int hdpu_cpustate_probe(struct device *ddev); +static int hdpu_cpustate_remove(struct device *ddev); struct cpustate_t cpustate; @@ -158,12 +158,11 @@ static int cpustate_read_proc(char *page, char **start, off_t off, return len; } -static struct platform_driver hdpu_cpustate_driver = { +static struct device_driver hdpu_cpustate_driver = { + .name = HDPU_CPUSTATE_NAME, + .bus = &platform_bus_type, .probe = hdpu_cpustate_probe, .remove = hdpu_cpustate_remove, - .driver = { - .name = HDPU_CPUSTATE_NAME, - }, }; /* @@ -188,8 +187,9 @@ static struct miscdevice cpustate_dev = { &cpustate_fops }; -static int hdpu_cpustate_probe(struct platform_device *pdev) +static int hdpu_cpustate_probe(struct device *ddev) { + struct platform_device *pdev = to_platform_device(ddev); struct resource *res; struct proc_dir_entry *proc_de; int ret; @@ -217,7 +217,7 @@ static int hdpu_cpustate_probe(struct platform_device *pdev) return 0; } -static int hdpu_cpustate_remove(struct platform_device *pdev) +static int hdpu_cpustate_remove(struct device *ddev) { cpustate.set_addr = NULL; @@ -232,13 +232,13 @@ static int hdpu_cpustate_remove(struct platform_device *pdev) static int __init cpustate_init(void) { int rc; - rc = platform_driver_register(&hdpu_cpustate_driver); + rc = driver_register(&hdpu_cpustate_driver); return rc; } static void __exit cpustate_exit(void) { - platform_driver_unregister(&hdpu_cpustate_driver); + driver_unregister(&hdpu_cpustate_driver); } module_init(cpustate_init); diff --git a/trunk/drivers/misc/hdpuftrs/hdpu_nexus.c b/trunk/drivers/misc/hdpuftrs/hdpu_nexus.c index ea9d5f233c83..4bb461793851 100644 --- a/trunk/drivers/misc/hdpuftrs/hdpu_nexus.c +++ b/trunk/drivers/misc/hdpuftrs/hdpu_nexus.c @@ -22,20 +22,19 @@ #include -static int hdpu_nexus_probe(struct platform_device *pdev); -static int hdpu_nexus_remove(struct platform_device *pdev); +static int hdpu_nexus_probe(struct device *ddev); +static int hdpu_nexus_remove(struct device *ddev); static struct proc_dir_entry *hdpu_slot_id; static struct proc_dir_entry *hdpu_chassis_id; static int slot_id = -1; static int chassis_id = -1; -static struct platform_driver hdpu_nexus_driver = { +static struct device_driver hdpu_nexus_driver = { + .name = HDPU_NEXUS_NAME, + .bus = &platform_bus_type, .probe = hdpu_nexus_probe, .remove = hdpu_nexus_remove, - .driver = { - .name = HDPU_NEXUS_NAME, - }, }; int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, @@ -56,8 +55,9 @@ int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset, return sprintf(buffer, "%d\n", chassis_id); } -static int hdpu_nexus_probe(struct platform_device *pdev) +static int hdpu_nexus_probe(struct device *ddev) { + struct platform_device *pdev = to_platform_device(ddev); struct resource *res; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -80,7 +80,7 @@ static int hdpu_nexus_probe(struct platform_device *pdev) return 0; } -static int hdpu_nexus_remove(struct platform_device *pdev) +static int hdpu_nexus_remove(struct device *ddev) { slot_id = -1; chassis_id = -1; @@ -94,13 +94,13 @@ static int hdpu_nexus_remove(struct platform_device *pdev) static int __init nexus_init(void) { int rc; - rc = platform_driver_register(&hdpu_nexus_driver); + rc = driver_register(&hdpu_nexus_driver); return rc; } static void __exit nexus_exit(void) { - platform_driver_unregister(&hdpu_nexus_driver); + driver_unregister(&hdpu_nexus_driver); } module_init(nexus_init); diff --git a/trunk/drivers/mmc/pxamci.c b/trunk/drivers/mmc/pxamci.c index ee8f8a0420d1..f31e247b2cbe 100644 --- a/trunk/drivers/mmc/pxamci.c +++ b/trunk/drivers/mmc/pxamci.c @@ -428,8 +428,9 @@ static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs) return IRQ_HANDLED; } -static int pxamci_probe(struct platform_device *pdev) +static int pxamci_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct mmc_host *mmc; struct pxamci_host *host = NULL; struct resource *r; @@ -444,7 +445,7 @@ static int pxamci_probe(struct platform_device *pdev) if (!r) return -EBUSY; - mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev); + mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev); if (!mmc) { ret = -ENOMEM; goto out; @@ -473,7 +474,7 @@ static int pxamci_probe(struct platform_device *pdev) host->pdata->ocr_mask : MMC_VDD_32_33|MMC_VDD_33_34; - host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); + host->sg_cpu = dma_alloc_coherent(dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); if (!host->sg_cpu) { ret = -ENOMEM; goto out; @@ -510,10 +511,10 @@ static int pxamci_probe(struct platform_device *pdev) if (ret) goto out; - platform_set_drvdata(pdev, mmc); + dev_set_drvdata(dev, mmc); if (host->pdata && host->pdata->init) - host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc); + host->pdata->init(dev, pxamci_detect_irq, mmc); mmc_add_host(mmc); @@ -526,7 +527,7 @@ static int pxamci_probe(struct platform_device *pdev) if (host->base) iounmap(host->base); if (host->sg_cpu) - dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); + dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); } if (mmc) mmc_free_host(mmc); @@ -534,17 +535,17 @@ static int pxamci_probe(struct platform_device *pdev) return ret; } -static int pxamci_remove(struct platform_device *pdev) +static int pxamci_remove(struct device *dev) { - struct mmc_host *mmc = platform_get_drvdata(pdev); + struct mmc_host *mmc = dev_get_drvdata(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); if (mmc) { struct pxamci_host *host = mmc_priv(mmc); if (host->pdata && host->pdata->exit) - host->pdata->exit(&pdev->dev, mmc); + host->pdata->exit(dev, mmc); mmc_remove_host(mmc); @@ -559,7 +560,7 @@ static int pxamci_remove(struct platform_device *pdev) free_irq(host->irq, host); pxa_free_dma(host->dma); iounmap(host->base); - dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); + dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); release_resource(host->res); @@ -569,9 +570,9 @@ static int pxamci_remove(struct platform_device *pdev) } #ifdef CONFIG_PM -static int pxamci_suspend(struct platform_device *dev, pm_message_t state) +static int pxamci_suspend(struct device *dev, pm_message_t state) { - struct mmc_host *mmc = platform_get_drvdata(dev); + struct mmc_host *mmc = dev_get_drvdata(dev); int ret = 0; if (mmc) @@ -580,9 +581,9 @@ static int pxamci_suspend(struct platform_device *dev, pm_message_t state) return ret; } -static int pxamci_resume(struct platform_device *dev) +static int pxamci_resume(struct device *dev) { - struct mmc_host *mmc = platform_get_drvdata(dev); + struct mmc_host *mmc = dev_get_drvdata(dev); int ret = 0; if (mmc) @@ -595,24 +596,23 @@ static int pxamci_resume(struct platform_device *dev) #define pxamci_resume NULL #endif -static struct platform_driver pxamci_driver = { +static struct device_driver pxamci_driver = { + .name = DRIVER_NAME, + .bus = &platform_bus_type, .probe = pxamci_probe, .remove = pxamci_remove, .suspend = pxamci_suspend, .resume = pxamci_resume, - .driver = { - .name = DRIVER_NAME, - }, }; static int __init pxamci_init(void) { - return platform_driver_register(&pxamci_driver); + return driver_register(&pxamci_driver); } static void __exit pxamci_exit(void) { - platform_driver_unregister(&pxamci_driver); + driver_unregister(&pxamci_driver); } module_init(pxamci_init); diff --git a/trunk/drivers/mmc/wbsd.c b/trunk/drivers/mmc/wbsd.c index c7eb7c269081..e954b8354fef 100644 --- a/trunk/drivers/mmc/wbsd.c +++ b/trunk/drivers/mmc/wbsd.c @@ -42,7 +42,7 @@ #include "wbsd.h" #define DRIVER_NAME "wbsd" -#define DRIVER_VERSION "1.5" +#define DRIVER_VERSION "1.4" #ifdef CONFIG_MMC_DEBUG #define DBG(x...) \ @@ -1932,14 +1932,14 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp) * Non-PnP */ -static int __devinit wbsd_probe(struct platform_device* dev) +static int __devinit wbsd_probe(struct device* dev) { - return wbsd_init(&dev->dev, io, irq, dma, 0); + return wbsd_init(dev, io, irq, dma, 0); } -static int __devexit wbsd_remove(struct platform_device* dev) +static int __devexit wbsd_remove(struct device* dev) { - wbsd_shutdown(&dev->dev, 0); + wbsd_shutdown(dev, 0); return 0; } @@ -1983,9 +1983,9 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev) #ifdef CONFIG_PM -static int wbsd_suspend(struct platform_device *dev, pm_message_t state) +static int wbsd_suspend(struct device *dev, pm_message_t state) { - struct mmc_host *mmc = platform_get_drvdata(dev); + struct mmc_host *mmc = dev_get_drvdata(dev); struct wbsd_host *host; int ret; @@ -2005,9 +2005,9 @@ static int wbsd_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int wbsd_resume(struct platform_device *dev) +static int wbsd_resume(struct device *dev) { - struct mmc_host *mmc = platform_get_drvdata(dev); + struct mmc_host *mmc = dev_get_drvdata(dev); struct wbsd_host *host; if (!mmc) @@ -2038,15 +2038,14 @@ static int wbsd_resume(struct platform_device *dev) static struct platform_device *wbsd_device; -static struct platform_driver wbsd_driver = { +static struct device_driver wbsd_driver = { + .name = DRIVER_NAME, + .bus = &platform_bus_type, .probe = wbsd_probe, - .remove = __devexit_p(wbsd_remove), + .remove = wbsd_remove, .suspend = wbsd_suspend, .resume = wbsd_resume, - .driver = { - .name = DRIVER_NAME, - }, }; #ifdef CONFIG_PNP @@ -2055,7 +2054,7 @@ static struct pnp_driver wbsd_pnp_driver = { .name = DRIVER_NAME, .id_table = pnp_dev_table, .probe = wbsd_pnp_probe, - .remove = __devexit_p(wbsd_pnp_remove), + .remove = wbsd_pnp_remove, }; #endif /* CONFIG_PNP */ @@ -2086,7 +2085,7 @@ static int __init wbsd_drv_init(void) if (nopnp) { - result = platform_driver_register(&wbsd_driver); + result = driver_register(&wbsd_driver); if (result < 0) return result; @@ -2112,7 +2111,7 @@ static void __exit wbsd_drv_exit(void) { platform_device_unregister(wbsd_device); - platform_driver_unregister(&wbsd_driver); + driver_unregister(&wbsd_driver); } DBG("unloaded\n"); @@ -2128,7 +2127,6 @@ module_param(irq, uint, 0444); module_param(dma, int, 0444); MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Pierre Ossman "); MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver"); MODULE_VERSION(DRIVER_VERSION); diff --git a/trunk/drivers/mtd/maps/bast-flash.c b/trunk/drivers/mtd/maps/bast-flash.c index 51f962dd7e31..b7858eb93534 100644 --- a/trunk/drivers/mtd/maps/bast-flash.c +++ b/trunk/drivers/mtd/maps/bast-flash.c @@ -63,6 +63,11 @@ struct bast_flash_info { static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; +static struct bast_flash_info *to_bast_info(struct device *dev) +{ + return (struct bast_flash_info *)dev_get_drvdata(dev); +} + static void bast_flash_setrw(int to) { unsigned int val; @@ -82,11 +87,11 @@ static void bast_flash_setrw(int to) local_irq_restore(flags); } -static int bast_flash_remove(struct platform_device *pdev) +static int bast_flash_remove(struct device *dev) { - struct bast_flash_info *info = platform_get_drvdata(pdev); + struct bast_flash_info *info = to_bast_info(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); if (info == NULL) return 0; @@ -111,8 +116,9 @@ static int bast_flash_remove(struct platform_device *pdev) return 0; } -static int bast_flash_probe(struct platform_device *pdev) +static int bast_flash_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct bast_flash_info *info; struct resource *res; int err = 0; @@ -125,13 +131,13 @@ static int bast_flash_probe(struct platform_device *pdev) } memzero(info, sizeof(*info)); - platform_set_drvdata(pdev, info); + dev_set_drvdata(dev, info); res = pdev->resource; /* assume that the flash has one resource */ info->map.phys = res->start; info->map.size = res->end - res->start + 1; - info->map.name = pdev->dev.bus_id; + info->map.name = dev->bus_id; info->map.bankwidth = 2; if (info->map.size > AREA_MAXSIZE) @@ -193,28 +199,27 @@ static int bast_flash_probe(struct platform_device *pdev) /* fall through to exit error */ exit_error: - bast_flash_remove(pdev); + bast_flash_remove(dev); return err; } -static struct platform_driver bast_flash_driver = { +static struct device_driver bast_flash_driver = { + .name = "bast-nor", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = bast_flash_probe, .remove = bast_flash_remove, - .driver = { - .name = "bast-nor", - .owner = THIS_MODULE, - }, }; static int __init bast_flash_init(void) { printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); - return platform_driver_register(&bast_flash_driver); + return driver_register(&bast_flash_driver); } static void __exit bast_flash_exit(void) { - platform_driver_unregister(&bast_flash_driver); + driver_unregister(&bast_flash_driver); } module_init(bast_flash_init); diff --git a/trunk/drivers/mtd/maps/integrator-flash.c b/trunk/drivers/mtd/maps/integrator-flash.c index a3ba52fbd868..fe738fd8d6f8 100644 --- a/trunk/drivers/mtd/maps/integrator-flash.c +++ b/trunk/drivers/mtd/maps/integrator-flash.c @@ -67,8 +67,9 @@ static void armflash_set_vpp(struct map_info *map, int on) static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; -static int armflash_probe(struct platform_device *dev) +static int armflash_probe(struct device *_dev) { + struct platform_device *dev = to_platform_device(_dev); struct flash_platform_data *plat = dev->dev.platform_data; struct resource *res = dev->resource; unsigned int size = res->end - res->start + 1; @@ -137,7 +138,7 @@ static int armflash_probe(struct platform_device *dev) } if (err == 0) - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); /* * If we got an error, free all resources. @@ -162,11 +163,12 @@ static int armflash_probe(struct platform_device *dev) return err; } -static int armflash_remove(struct platform_device *dev) +static int armflash_remove(struct device *_dev) { - struct armflash_info *info = platform_get_drvdata(dev); + struct platform_device *dev = to_platform_device(_dev); + struct armflash_info *info = dev_get_drvdata(&dev->dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(&dev->dev, NULL); if (info) { if (info->mtd) { @@ -188,22 +190,21 @@ static int armflash_remove(struct platform_device *dev) return 0; } -static struct platform_driver armflash_driver = { +static struct device_driver armflash_driver = { + .name = "armflash", + .bus = &platform_bus_type, .probe = armflash_probe, .remove = armflash_remove, - .driver = { - .name = "armflash", - }, }; static int __init armflash_init(void) { - return platform_driver_register(&armflash_driver); + return driver_register(&armflash_driver); } static void __exit armflash_exit(void) { - platform_driver_unregister(&armflash_driver); + driver_unregister(&armflash_driver); } module_init(armflash_init); diff --git a/trunk/drivers/mtd/maps/ixp2000.c b/trunk/drivers/mtd/maps/ixp2000.c index fc7a78e31735..641eb2b55e9f 100644 --- a/trunk/drivers/mtd/maps/ixp2000.c +++ b/trunk/drivers/mtd/maps/ixp2000.c @@ -111,12 +111,13 @@ static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to, } -static int ixp2000_flash_remove(struct platform_device *dev) +static int ixp2000_flash_remove(struct device *_dev) { + struct platform_device *dev = to_platform_device(_dev); struct flash_platform_data *plat = dev->dev.platform_data; - struct ixp2000_flash_info *info = platform_get_drvdata(dev); + struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(&dev->dev, NULL); if(!info) return 0; @@ -142,9 +143,10 @@ static int ixp2000_flash_remove(struct platform_device *dev) } -static int ixp2000_flash_probe(struct platform_device *dev) +static int ixp2000_flash_probe(struct device *_dev) { static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; + struct platform_device *dev = to_platform_device(_dev); struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; struct flash_platform_data *plat; struct ixp2000_flash_info *info; @@ -175,7 +177,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) } memzero(info, sizeof(struct ixp2000_flash_info)); - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); /* * Tell the MTD layer we're not 1:1 mapped so that it does @@ -246,26 +248,25 @@ static int ixp2000_flash_probe(struct platform_device *dev) return 0; Error: - ixp2000_flash_remove(dev); + ixp2000_flash_remove(_dev); return err; } -static struct platform_driver ixp2000_flash_driver = { +static struct device_driver ixp2000_flash_driver = { + .name = "IXP2000-Flash", + .bus = &platform_bus_type, .probe = &ixp2000_flash_probe, .remove = &ixp2000_flash_remove - .driver = { - .name = "IXP2000-Flash", - }, }; static int __init ixp2000_flash_init(void) { - return platform_driver_register(&ixp2000_flash_driver); + return driver_register(&ixp2000_flash_driver); } static void __exit ixp2000_flash_exit(void) { - platform_driver_unregister(&ixp2000_flash_driver); + driver_unregister(&ixp2000_flash_driver); } module_init(ixp2000_flash_init); diff --git a/trunk/drivers/mtd/maps/ixp4xx.c b/trunk/drivers/mtd/maps/ixp4xx.c index a59f8027903c..56b3a355bf7b 100644 --- a/trunk/drivers/mtd/maps/ixp4xx.c +++ b/trunk/drivers/mtd/maps/ixp4xx.c @@ -99,12 +99,13 @@ struct ixp4xx_flash_info { static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; -static int ixp4xx_flash_remove(struct platform_device *dev) +static int ixp4xx_flash_remove(struct device *_dev) { + struct platform_device *dev = to_platform_device(_dev); struct flash_platform_data *plat = dev->dev.platform_data; - struct ixp4xx_flash_info *info = platform_get_drvdata(dev); + struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(&dev->dev, NULL); if(!info) return 0; @@ -129,8 +130,9 @@ static int ixp4xx_flash_remove(struct platform_device *dev) return 0; } -static int ixp4xx_flash_probe(struct platform_device *dev) +static int ixp4xx_flash_probe(struct device *_dev) { + struct platform_device *dev = to_platform_device(_dev); struct flash_platform_data *plat = dev->dev.platform_data; struct ixp4xx_flash_info *info; int err = -1; @@ -151,7 +153,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev) } memzero(info, sizeof(struct ixp4xx_flash_info)); - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); /* * Tell the MTD layer we're not 1:1 mapped so that it does @@ -212,26 +214,25 @@ static int ixp4xx_flash_probe(struct platform_device *dev) return 0; Error: - ixp4xx_flash_remove(dev); + ixp4xx_flash_remove(_dev); return err; } -static struct platform_driver ixp4xx_flash_driver = { +static struct device_driver ixp4xx_flash_driver = { + .name = "IXP4XX-Flash", + .bus = &platform_bus_type, .probe = ixp4xx_flash_probe, .remove = ixp4xx_flash_remove, - .driver = { - .name = "IXP4XX-Flash", - }, }; static int __init ixp4xx_flash_init(void) { - return platform_driver_register(&ixp4xx_flash_driver); + return driver_register(&ixp4xx_flash_driver); } static void __exit ixp4xx_flash_exit(void) { - platform_driver_unregister(&ixp4xx_flash_driver); + driver_unregister(&ixp4xx_flash_driver); } diff --git a/trunk/drivers/mtd/maps/omap_nor.c b/trunk/drivers/mtd/maps/omap_nor.c index 418afffb2d80..fd3b4a5fc207 100644 --- a/trunk/drivers/mtd/maps/omap_nor.c +++ b/trunk/drivers/mtd/maps/omap_nor.c @@ -70,10 +70,11 @@ static void omap_set_vpp(struct map_info *map, int enable) } } -static int __devinit omapflash_probe(struct platform_device *pdev) +static int __devinit omapflash_probe(struct device *dev) { int err; struct omapflash_info *info; + struct platform_device *pdev = to_platform_device(dev); struct flash_platform_data *pdata = pdev->dev.platform_data; struct resource *res = pdev->resource; unsigned long size = res->end - res->start + 1; @@ -118,7 +119,7 @@ static int __devinit omapflash_probe(struct platform_device *pdev) #endif add_mtd_device(info->mtd); - platform_set_drvdata(pdev, info); + dev_set_drvdata(&pdev->dev, info); return 0; @@ -132,11 +133,12 @@ static int __devinit omapflash_probe(struct platform_device *pdev) return err; } -static int __devexit omapflash_remove(struct platform_device *pdev) +static int __devexit omapflash_remove(struct device *dev) { - struct omapflash_info *info = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct omapflash_info *info = dev_get_drvdata(&pdev->dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(&pdev->dev, NULL); if (info) { if (info->parts) { @@ -153,22 +155,21 @@ static int __devexit omapflash_remove(struct platform_device *pdev) return 0; } -static struct platform_driver omapflash_driver = { +static struct device_driver omapflash_driver = { + .name = "omapflash", + .bus = &platform_bus_type, .probe = omapflash_probe, .remove = __devexit_p(omapflash_remove), - .driver = { - .name = "omapflash", - }, }; static int __init omapflash_init(void) { - return platform_driver_register(&omapflash_driver); + return driver_register(&omapflash_driver); } static void __exit omapflash_exit(void) { - platform_driver_unregister(&omapflash_driver); + driver_unregister(&omapflash_driver); } module_init(omapflash_init); diff --git a/trunk/drivers/mtd/maps/plat-ram.c b/trunk/drivers/mtd/maps/plat-ram.c index 5d3c75451ca2..a02eed94a231 100644 --- a/trunk/drivers/mtd/maps/plat-ram.c +++ b/trunk/drivers/mtd/maps/plat-ram.c @@ -56,9 +56,9 @@ struct platram_info { * device private data to struct platram_info conversion */ -static inline struct platram_info *to_platram_info(struct platform_device *dev) +static inline struct platram_info *to_platram_info(struct device *dev) { - return (struct platram_info *)platform_get_drvdata(dev); + return (struct platram_info *)dev_get_drvdata(dev); } /* platram_setrw @@ -83,13 +83,13 @@ static inline void platram_setrw(struct platram_info *info, int to) * called to remove the device from the driver's control */ -static int platram_remove(struct platform_device *pdev) +static int platram_remove(struct device *dev) { - struct platram_info *info = to_platram_info(pdev); + struct platram_info *info = to_platram_info(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); - dev_dbg(&pdev->dev, "removing device\n"); + dev_dbg(dev, "removing device\n"); if (info == NULL) return 0; @@ -130,60 +130,61 @@ static int platram_remove(struct platform_device *pdev) * driver is found. */ -static int platram_probe(struct platform_device *pdev) +static int platram_probe(struct device *dev) { + struct platform_device *pd = to_platform_device(dev); struct platdata_mtd_ram *pdata; struct platram_info *info; struct resource *res; int err = 0; - dev_dbg(&pdev->dev, "probe entered\n"); + dev_dbg(dev, "probe entered\n"); - if (pdev->dev.platform_data == NULL) { - dev_err(&pdev->dev, "no platform data supplied\n"); + if (dev->platform_data == NULL) { + dev_err(dev, "no platform data supplied\n"); err = -ENOENT; goto exit_error; } - pdata = pdev->dev.platform_data; + pdata = dev->platform_data; info = kmalloc(sizeof(*info), GFP_KERNEL); if (info == NULL) { - dev_err(&pdev->dev, "no memory for flash info\n"); + dev_err(dev, "no memory for flash info\n"); err = -ENOMEM; goto exit_error; } memset(info, 0, sizeof(*info)); - platform_set_drvdata(pdev, info); + dev_set_drvdata(dev, info); - info->dev = &pdev->dev; + info->dev = dev; info->pdata = pdata; /* get the resource for the memory mapping */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + res = platform_get_resource(pd, IORESOURCE_MEM, 0); if (res == NULL) { - dev_err(&pdev->dev, "no memory resource specified\n"); + dev_err(dev, "no memory resource specified\n"); err = -ENOENT; goto exit_free; } - dev_dbg(&pdev->dev, "got platform resource %p (0x%lx)\n", res, res->start); + dev_dbg(dev, "got platform resource %p (0x%lx)\n", res, res->start); /* setup map parameters */ info->map.phys = res->start; info->map.size = (res->end - res->start) + 1; - info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pdev->name; + info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pd->name; info->map.bankwidth = pdata->bankwidth; /* register our usage of the memory area */ - info->area = request_mem_region(res->start, info->map.size, pdev->name); + info->area = request_mem_region(res->start, info->map.size, pd->name); if (info->area == NULL) { - dev_err(&pdev->dev, "failed to request memory region\n"); + dev_err(dev, "failed to request memory region\n"); err = -EIO; goto exit_free; } @@ -191,23 +192,23 @@ static int platram_probe(struct platform_device *pdev) /* remap the memory area */ info->map.virt = ioremap(res->start, info->map.size); - dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); + dev_dbg(dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); if (info->map.virt == NULL) { - dev_err(&pdev->dev, "failed to ioremap() region\n"); + dev_err(dev, "failed to ioremap() region\n"); err = -EIO; goto exit_free; } simple_map_init(&info->map); - dev_dbg(&pdev->dev, "initialised map, probing for mtd\n"); + dev_dbg(dev, "initialised map, probing for mtd\n"); /* probe for the right mtd map driver */ info->mtd = do_map_probe("map_ram" , &info->map); if (info->mtd == NULL) { - dev_err(&pdev->dev, "failed to probe for map_ram\n"); + dev_err(dev, "failed to probe for map_ram\n"); err = -ENOMEM; goto exit_free; } @@ -236,28 +237,27 @@ static int platram_probe(struct platform_device *pdev) #endif /* CONFIG_MTD_PARTITIONS */ if (add_mtd_device(info->mtd)) { - dev_err(&pdev->dev, "add_mtd_device() failed\n"); + dev_err(dev, "add_mtd_device() failed\n"); err = -ENOMEM; } - dev_info(&pdev->dev, "registered mtd device\n"); + dev_info(dev, "registered mtd device\n"); return err; exit_free: - platram_remove(pdev); + platram_remove(dev); exit_error: return err; } /* device driver info */ -static struct platform_driver platram_driver = { +static struct device_driver platram_driver = { + .name = "mtd-ram", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = platram_probe, .remove = platram_remove, - .driver = { - .name = "mtd-ram", - .owner = THIS_MODULE, - }, }; /* module init/exit */ @@ -265,12 +265,12 @@ static struct platform_driver platram_driver = { static int __init platram_init(void) { printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n"); - return platform_driver_register(&platram_driver); + return driver_register(&platram_driver); } static void __exit platram_exit(void) { - platform_driver_unregister(&platram_driver); + driver_unregister(&platram_driver); } module_init(platram_init); diff --git a/trunk/drivers/mtd/maps/sa1100-flash.c b/trunk/drivers/mtd/maps/sa1100-flash.c index 5cefb015633c..9e8bb1782be0 100644 --- a/trunk/drivers/mtd/maps/sa1100-flash.c +++ b/trunk/drivers/mtd/maps/sa1100-flash.c @@ -356,8 +356,9 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; -static int __init sa1100_mtd_probe(struct platform_device *pdev) +static int __init sa1100_mtd_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct flash_platform_data *plat = pdev->dev.platform_data; struct mtd_partition *parts; const char *part_type = NULL; @@ -401,28 +402,28 @@ static int __init sa1100_mtd_probe(struct platform_device *pdev) info->nr_parts = nr_parts; - platform_set_drvdata(pdev, info); + dev_set_drvdata(dev, info); err = 0; out: return err; } -static int __exit sa1100_mtd_remove(struct platform_device *pdev) +static int __exit sa1100_mtd_remove(struct device *dev) { - struct sa_info *info = platform_get_drvdata(pdev); - struct flash_platform_data *plat = pdev->dev.platform_data; + struct sa_info *info = dev_get_drvdata(dev); + struct flash_platform_data *plat = dev->platform_data; - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); sa1100_destroy(info, plat); return 0; } #ifdef CONFIG_PM -static int sa1100_mtd_suspend(struct platform_device *dev, pm_message_t state) +static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) { - struct sa_info *info = platform_get_drvdata(dev); + struct sa_info *info = dev_get_drvdata(dev); int ret = 0; if (info) @@ -431,17 +432,17 @@ static int sa1100_mtd_suspend(struct platform_device *dev, pm_message_t state) return ret; } -static int sa1100_mtd_resume(struct platform_device *dev) +static int sa1100_mtd_resume(struct device *dev) { - struct sa_info *info = platform_get_drvdata(dev); + struct sa_info *info = dev_get_drvdata(dev); if (info) info->mtd->resume(info->mtd); return 0; } -static void sa1100_mtd_shutdown(struct platform_device *dev) +static void sa1100_mtd_shutdown(struct device *dev) { - struct sa_info *info = platform_get_drvdata(dev); + struct sa_info *info = dev_get_drvdata(dev); if (info && info->mtd->suspend(info->mtd) == 0) info->mtd->resume(info->mtd); } @@ -451,25 +452,24 @@ static void sa1100_mtd_shutdown(struct platform_device *dev) #define sa1100_mtd_shutdown NULL #endif -static struct platform_driver sa1100_mtd_driver = { +static struct device_driver sa1100_mtd_driver = { + .name = "flash", + .bus = &platform_bus_type, .probe = sa1100_mtd_probe, .remove = __exit_p(sa1100_mtd_remove), .suspend = sa1100_mtd_suspend, .resume = sa1100_mtd_resume, .shutdown = sa1100_mtd_shutdown, - .driver = { - .name = "flash", - }, }; static int __init sa1100_mtd_init(void) { - return platform_driver_register(&sa1100_mtd_driver); + return driver_register(&sa1100_mtd_driver); } static void __exit sa1100_mtd_exit(void) { - platform_driver_unregister(&sa1100_mtd_driver); + driver_unregister(&sa1100_mtd_driver); } module_init(sa1100_mtd_init); diff --git a/trunk/drivers/mtd/nand/s3c2410.c b/trunk/drivers/mtd/nand/s3c2410.c index d209214b1318..97e9b7892d29 100644 --- a/trunk/drivers/mtd/nand/s3c2410.c +++ b/trunk/drivers/mtd/nand/s3c2410.c @@ -125,14 +125,14 @@ static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd) return s3c2410_nand_mtd_toours(mtd)->info; } -static struct s3c2410_nand_info *to_nand_info(struct platform_device *dev) +static struct s3c2410_nand_info *to_nand_info(struct device *dev) { - return platform_get_drvdata(dev); + return dev_get_drvdata(dev); } -static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev) +static struct s3c2410_platform_nand *to_nand_plat(struct device *dev) { - return dev->dev.platform_data; + return dev->platform_data; } /* timing calculations */ @@ -165,9 +165,9 @@ static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max) /* controller setup */ static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, - struct platform_device *pdev) + struct device *dev) { - struct s3c2410_platform_nand *plat = to_nand_plat(pdev); + struct s3c2410_platform_nand *plat = to_nand_plat(dev); unsigned long clkrate = clk_get_rate(info->clk); int tacls, twrph0, twrph1; unsigned long cfg; @@ -430,11 +430,11 @@ static void s3c2410_nand_write_buf(struct mtd_info *mtd, /* device management functions */ -static int s3c2410_nand_remove(struct platform_device *pdev) +static int s3c2410_nand_remove(struct device *dev) { - struct s3c2410_nand_info *info = to_nand_info(pdev); + struct s3c2410_nand_info *info = to_nand_info(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); if (info == NULL) return 0; @@ -562,9 +562,10 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info, * nand layer to look for devices */ -static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) +static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) { - struct s3c2410_platform_nand *plat = to_nand_plat(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct s3c2410_platform_nand *plat = to_nand_plat(dev); struct s3c2410_nand_info *info; struct s3c2410_nand_mtd *nmtd; struct s3c2410_nand_set *sets; @@ -574,26 +575,26 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) int nr_sets; int setno; - pr_debug("s3c2410_nand_probe(%p)\n", pdev); + pr_debug("s3c2410_nand_probe(%p)\n", dev); info = kmalloc(sizeof(*info), GFP_KERNEL); if (info == NULL) { - dev_err(&pdev->dev, "no memory for flash info\n"); + dev_err(dev, "no memory for flash info\n"); err = -ENOMEM; goto exit_error; } memzero(info, sizeof(*info)); - platform_set_drvdata(pdev, info); + dev_set_drvdata(dev, info); spin_lock_init(&info->controller.lock); init_waitqueue_head(&info->controller.wq); /* get the clock source and enable it */ - info->clk = clk_get(&pdev->dev, "nand"); + info->clk = clk_get(dev, "nand"); if (IS_ERR(info->clk)) { - dev_err(&pdev->dev, "failed to get clock"); + dev_err(dev, "failed to get clock"); err = -ENOENT; goto exit_error; } @@ -610,27 +611,27 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) info->area = request_mem_region(res->start, size, pdev->name); if (info->area == NULL) { - dev_err(&pdev->dev, "cannot reserve register region\n"); + dev_err(dev, "cannot reserve register region\n"); err = -ENOENT; goto exit_error; } - info->device = &pdev->dev; + info->device = dev; info->platform = plat; info->regs = ioremap(res->start, size); info->is_s3c2440 = is_s3c2440; if (info->regs == NULL) { - dev_err(&pdev->dev, "cannot reserve register region\n"); + dev_err(dev, "cannot reserve register region\n"); err = -EIO; goto exit_error; } - dev_dbg(&pdev->dev, "mapped registers at %p\n", info->regs); + dev_dbg(dev, "mapped registers at %p\n", info->regs); /* initialise the hardware */ - err = s3c2410_nand_inithw(info, pdev); + err = s3c2410_nand_inithw(info, dev); if (err != 0) goto exit_error; @@ -644,7 +645,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) size = nr_sets * sizeof(*info->mtds); info->mtds = kmalloc(size, GFP_KERNEL); if (info->mtds == NULL) { - dev_err(&pdev->dev, "failed to allocate mtd storage\n"); + dev_err(dev, "failed to allocate mtd storage\n"); err = -ENOMEM; goto exit_error; } @@ -676,7 +677,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) return 0; exit_error: - s3c2410_nand_remove(pdev); + s3c2410_nand_remove(dev); if (err == 0) err = -EINVAL; @@ -685,46 +686,44 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) /* driver device registration */ -static int s3c2410_nand_probe(struct platform_device *dev) +static int s3c2410_nand_probe(struct device *dev) { return s3c24xx_nand_probe(dev, 0); } -static int s3c2440_nand_probe(struct platform_device *dev) +static int s3c2440_nand_probe(struct device *dev) { return s3c24xx_nand_probe(dev, 1); } -static struct platform_driver s3c2410_nand_driver = { +static struct device_driver s3c2410_nand_driver = { + .name = "s3c2410-nand", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = s3c2410_nand_probe, .remove = s3c2410_nand_remove, - .driver = { - .name = "s3c2410-nand", - .owner = THIS_MODULE, - }, }; -static struct platform_driver s3c2440_nand_driver = { +static struct device_driver s3c2440_nand_driver = { + .name = "s3c2440-nand", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = s3c2440_nand_probe, .remove = s3c2410_nand_remove, - .driver = { - .name = "s3c2440-nand", - .owner = THIS_MODULE, - }, }; static int __init s3c2410_nand_init(void) { printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n"); - platform_driver_register(&s3c2440_nand_driver); - return platform_driver_register(&s3c2410_nand_driver); + driver_register(&s3c2440_nand_driver); + return driver_register(&s3c2410_nand_driver); } static void __exit s3c2410_nand_exit(void) { - platform_driver_unregister(&s3c2440_nand_driver); - platform_driver_unregister(&s3c2410_nand_driver); + driver_unregister(&s3c2440_nand_driver); + driver_unregister(&s3c2410_nand_driver); } module_init(s3c2410_nand_init); diff --git a/trunk/drivers/net/depca.c b/trunk/drivers/net/depca.c index 03804cc38be0..0d33a93df96b 100644 --- a/trunk/drivers/net/depca.c +++ b/trunk/drivers/net/depca.c @@ -398,19 +398,13 @@ static struct mca_driver depca_mca_driver = { }; #endif -static int depca_isa_probe (struct platform_device *); +static int depca_isa_probe (struct device *); -static int __devexit depca_isa_remove(struct platform_device *pdev) -{ - return depca_device_remove(&pdev->dev); -} - -static struct platform_driver depca_isa_driver = { +static struct device_driver depca_isa_driver = { + .name = depca_string, + .bus = &platform_bus_type, .probe = depca_isa_probe, - .remove = __devexit_p(depca_isa_remove), - .driver = { - .name = depca_string, - }, + .remove = __devexit_p(depca_device_remove), }; /* @@ -1531,7 +1525,7 @@ static enum depca_type __init depca_shmem_probe (ulong *mem_start) return adapter; } -static int __init depca_isa_probe (struct platform_device *device) +static int __init depca_isa_probe (struct device *device) { struct net_device *dev; struct depca_private *lp; @@ -1539,7 +1533,7 @@ static int __init depca_isa_probe (struct platform_device *device) enum depca_type adapter = unknown; int status = 0; - ioaddr = (u_long) device->dev.platform_data; + ioaddr = (u_long) device->platform_data; if ((status = depca_common_init (ioaddr, &dev))) goto out; @@ -1559,7 +1553,7 @@ static int __init depca_isa_probe (struct platform_device *device) lp->adapter = adapter; lp->mem_start = mem_start; - if ((status = depca_hw_init(dev, &device->dev))) + if ((status = depca_hw_init(dev, device))) goto out_free; return 0; @@ -2088,7 +2082,7 @@ static int __init depca_module_init (void) #ifdef CONFIG_EISA err |= eisa_driver_register (&depca_eisa_driver); #endif - err |= platform_driver_register (&depca_isa_driver); + err |= driver_register (&depca_isa_driver); depca_platform_probe (); return err; @@ -2103,7 +2097,7 @@ static void __exit depca_module_exit (void) #ifdef CONFIG_EISA eisa_driver_unregister (&depca_eisa_driver); #endif - platform_driver_unregister (&depca_isa_driver); + driver_unregister (&depca_isa_driver); for (i = 0; depca_io_ports[i].iobase; i++) { if (depca_io_ports[i].device) { diff --git a/trunk/drivers/net/dm9000.c b/trunk/drivers/net/dm9000.c index 24996da4c1c4..f8c9bcdab68b 100644 --- a/trunk/drivers/net/dm9000.c +++ b/trunk/drivers/net/dm9000.c @@ -148,7 +148,7 @@ typedef struct board_info { } board_info_t; /* function declaration ------------------------------------- */ -static int dm9000_probe(struct platform_device *); +static int dm9000_probe(struct device *); static int dm9000_open(struct net_device *); static int dm9000_start_xmit(struct sk_buff *, struct net_device *); static int dm9000_stop(struct net_device *); @@ -378,8 +378,9 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db) * Search DM9000 board, allocate space and register it */ static int -dm9000_probe(struct platform_device *pdev) +dm9000_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct dm9000_plat_data *pdata = pdev->dev.platform_data; struct board_info *db; /* Point a board information structure */ struct net_device *ndev; @@ -397,7 +398,7 @@ dm9000_probe(struct platform_device *pdev) } SET_MODULE_OWNER(ndev); - SET_NETDEV_DEV(ndev, &pdev->dev); + SET_NETDEV_DEV(ndev, dev); PRINTK2("dm9000_probe()"); @@ -568,7 +569,7 @@ dm9000_probe(struct platform_device *pdev) printk("%s: Invalid ethernet MAC address. Please " "set using ifconfig\n", ndev->name); - platform_set_drvdata(pdev, ndev); + dev_set_drvdata(dev, ndev); ret = register_netdev(ndev); if (ret == 0) { @@ -1139,9 +1140,9 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value) } static int -dm9000_drv_suspend(struct platform_device *dev, pm_message_t state) +dm9000_drv_suspend(struct device *dev, pm_message_t state) { - struct net_device *ndev = platform_get_drvdata(dev); + struct net_device *ndev = dev_get_drvdata(dev); if (ndev) { if (netif_running(ndev)) { @@ -1153,9 +1154,9 @@ dm9000_drv_suspend(struct platform_device *dev, pm_message_t state) } static int -dm9000_drv_resume(struct platform_device *dev) +dm9000_drv_resume(struct device *dev) { - struct net_device *ndev = platform_get_drvdata(dev); + struct net_device *ndev = dev_get_drvdata(dev); board_info_t *db = (board_info_t *) ndev->priv; if (ndev) { @@ -1171,11 +1172,12 @@ dm9000_drv_resume(struct platform_device *dev) } static int -dm9000_drv_remove(struct platform_device *pdev) +dm9000_drv_remove(struct device *dev) { - struct net_device *ndev = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct net_device *ndev = dev_get_drvdata(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); unregister_netdev(ndev); dm9000_release_board(pdev, (board_info_t *) ndev->priv); @@ -1186,14 +1188,13 @@ dm9000_drv_remove(struct platform_device *pdev) return 0; } -static struct platform_driver dm9000_driver = { +static struct device_driver dm9000_driver = { + .name = "dm9000", + .bus = &platform_bus_type, .probe = dm9000_probe, .remove = dm9000_drv_remove, .suspend = dm9000_drv_suspend, .resume = dm9000_drv_resume, - .driver = { - .name = "dm9000", - }, }; static int __init @@ -1201,13 +1202,13 @@ dm9000_init(void) { printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); - return platform_driver_register(&dm9000_driver); /* search board and register */ + return driver_register(&dm9000_driver); /* search board and register */ } static void __exit dm9000_cleanup(void) { - platform_driver_unregister(&dm9000_driver); + driver_unregister(&dm9000_driver); } module_init(dm9000_init); diff --git a/trunk/drivers/net/gianfar.c b/trunk/drivers/net/gianfar.c index e3a329539f1c..54d294ad6df5 100644 --- a/trunk/drivers/net/gianfar.c +++ b/trunk/drivers/net/gianfar.c @@ -126,8 +126,8 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void adjust_link(struct net_device *dev); static void init_registers(struct net_device *dev); static int init_phy(struct net_device *dev); -static int gfar_probe(struct platform_device *pdev); -static int gfar_remove(struct platform_device *pdev); +static int gfar_probe(struct device *device); +static int gfar_remove(struct device *device); static void free_skb_resources(struct gfar_private *priv); static void gfar_set_multi(struct net_device *dev); static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); @@ -156,11 +156,12 @@ int gfar_uses_fcb(struct gfar_private *priv) /* Set up the ethernet device structure, private data, * and anything else we need before we start */ -static int gfar_probe(struct platform_device *pdev) +static int gfar_probe(struct device *device) { u32 tempval; struct net_device *dev = NULL; struct gfar_private *priv = NULL; + struct platform_device *pdev = to_platform_device(device); struct gianfar_platform_data *einfo; struct resource *r; int idx; @@ -207,7 +208,7 @@ static int gfar_probe(struct platform_device *pdev) spin_lock_init(&priv->lock); - platform_set_drvdata(pdev, dev); + dev_set_drvdata(device, dev); /* Stop the DMA engine now, in case it was running before */ /* (The firmware could have used it, and left it running). */ @@ -244,7 +245,7 @@ static int gfar_probe(struct platform_device *pdev) dev->base_addr = (unsigned long) (priv->regs); SET_MODULE_OWNER(dev); - SET_NETDEV_DEV(dev, &pdev->dev); + SET_NETDEV_DEV(dev, device); /* Fill in the dev structure */ dev->open = gfar_enet_open; @@ -376,12 +377,12 @@ static int gfar_probe(struct platform_device *pdev) return err; } -static int gfar_remove(struct platform_device *pdev) +static int gfar_remove(struct device *device) { - struct net_device *dev = platform_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(device); struct gfar_private *priv = netdev_priv(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(device, NULL); iounmap((void *) priv->regs); free_netdev(dev); @@ -1860,12 +1861,11 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs) } /* Structure for a device driver */ -static struct platform_driver gfar_driver = { +static struct device_driver gfar_driver = { + .name = "fsl-gianfar", + .bus = &platform_bus_type, .probe = gfar_probe, .remove = gfar_remove, - .driver = { - .name = "fsl-gianfar", - }, }; static int __init gfar_init(void) @@ -1875,7 +1875,7 @@ static int __init gfar_init(void) if (err) return err; - err = platform_driver_register(&gfar_driver); + err = driver_register(&gfar_driver); if (err) gfar_mdio_exit(); @@ -1885,7 +1885,7 @@ static int __init gfar_init(void) static void __exit gfar_exit(void) { - platform_driver_unregister(&gfar_driver); + driver_unregister(&gfar_driver); gfar_mdio_exit(); } diff --git a/trunk/drivers/net/ibmveth.c b/trunk/drivers/net/ibmveth.c index be191d80ef9c..ceb98fd398af 100644 --- a/trunk/drivers/net/ibmveth.c +++ b/trunk/drivers/net/ibmveth.c @@ -58,7 +58,7 @@ #include "ibmveth.h" -#define DEBUG 1 +#undef DEBUG #define ibmveth_printk(fmt, args...) \ printk(KERN_INFO "%s: " fmt, __FILE__, ## args) diff --git a/trunk/drivers/net/irda/sa1100_ir.c b/trunk/drivers/net/irda/sa1100_ir.c index 63d38fbbd04e..76e0b9fb5e96 100644 --- a/trunk/drivers/net/irda/sa1100_ir.c +++ b/trunk/drivers/net/irda/sa1100_ir.c @@ -291,9 +291,9 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si) /* * Suspend the IrDA interface. */ -static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) +static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) { - struct net_device *dev = platform_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(_dev); struct sa1100_irda *si; if (!dev) @@ -316,9 +316,9 @@ static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) /* * Resume the IrDA interface. */ -static int sa1100_irda_resume(struct platform_device *pdev) +static int sa1100_irda_resume(struct device *_dev) { - struct net_device *dev = platform_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(_dev); struct sa1100_irda *si; if (!dev) @@ -886,8 +886,9 @@ static int sa1100_irda_init_iobuf(iobuff_t *io, int size) return io->head ? 0 : -ENOMEM; } -static int sa1100_irda_probe(struct platform_device *pdev) +static int sa1100_irda_probe(struct device *_dev) { + struct platform_device *pdev = to_platform_device(_dev); struct net_device *dev; struct sa1100_irda *si; unsigned int baudrate_mask; @@ -966,7 +967,7 @@ static int sa1100_irda_probe(struct platform_device *pdev) err = register_netdev(dev); if (err == 0) - platform_set_drvdata(pdev, dev); + dev_set_drvdata(&pdev->dev, dev); if (err) { err_mem_5: @@ -984,9 +985,9 @@ static int sa1100_irda_probe(struct platform_device *pdev) return err; } -static int sa1100_irda_remove(struct platform_device *pdev) +static int sa1100_irda_remove(struct device *_dev) { - struct net_device *dev = platform_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(_dev); if (dev) { struct sa1100_irda *si = dev->priv; @@ -1003,14 +1004,13 @@ static int sa1100_irda_remove(struct platform_device *pdev) return 0; } -static struct platform_driver sa1100ir_driver = { +static struct device_driver sa1100ir_driver = { + .name = "sa11x0-ir", + .bus = &platform_bus_type, .probe = sa1100_irda_probe, .remove = sa1100_irda_remove, .suspend = sa1100_irda_suspend, .resume = sa1100_irda_resume, - .driver = { - .name = "sa11x0-ir", - }, }; static int __init sa1100_irda_init(void) @@ -1023,12 +1023,12 @@ static int __init sa1100_irda_init(void) if (power_level > 3) power_level = 3; - return platform_driver_register(&sa1100ir_driver); + return driver_register(&sa1100ir_driver); } static void __exit sa1100_irda_exit(void) { - platform_driver_unregister(&sa1100ir_driver); + driver_unregister(&sa1100ir_driver); } module_init(sa1100_irda_init); diff --git a/trunk/drivers/net/irda/smsc-ircc2.c b/trunk/drivers/net/irda/smsc-ircc2.c index ec94ecdb103d..a1d207f2fa68 100644 --- a/trunk/drivers/net/irda/smsc-ircc2.c +++ b/trunk/drivers/net/irda/smsc-ircc2.c @@ -214,15 +214,14 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base); /* Power Management */ -static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state); -static int smsc_ircc_resume(struct platform_device *dev); +static int smsc_ircc_suspend(struct device *dev, pm_message_t state); +static int smsc_ircc_resume(struct device *dev); -static struct platform_driver smsc_ircc_driver = { +static struct device_driver smsc_ircc_driver = { + .name = SMSC_IRCC2_DRIVER_NAME, + .bus = &platform_bus_type, .suspend = smsc_ircc_suspend, .resume = smsc_ircc_resume, - .driver = { - .name = SMSC_IRCC2_DRIVER_NAME, - }, }; /* Transceivers for SMSC-ircc */ @@ -347,7 +346,7 @@ static int __init smsc_ircc_init(void) IRDA_DEBUG(1, "%s\n", __FUNCTION__); - ret = platform_driver_register(&smsc_ircc_driver); + ret = driver_register(&smsc_ircc_driver); if (ret) { IRDA_ERROR("%s, Can't register driver!\n", driver_name); return ret; @@ -379,7 +378,7 @@ static int __init smsc_ircc_init(void) } if (ret) - platform_driver_unregister(&smsc_ircc_driver); + driver_unregister(&smsc_ircc_driver); return ret; } @@ -492,7 +491,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u err = PTR_ERR(self->pldev); goto err_out5; } - platform_set_drvdata(self->pldev, self); + dev_set_drvdata(&self->pldev->dev, self); IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); dev_count++; @@ -1686,9 +1685,9 @@ static int smsc_ircc_net_close(struct net_device *dev) return 0; } -static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state) +static int smsc_ircc_suspend(struct device *dev, pm_message_t state) { - struct smsc_ircc_cb *self = platform_get_drvdata(dev); + struct smsc_ircc_cb *self = dev_get_drvdata(dev); if (!self->io.suspended) { IRDA_DEBUG(1, "%s, Suspending\n", driver_name); @@ -1707,9 +1706,9 @@ static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int smsc_ircc_resume(struct platform_device *dev) +static int smsc_ircc_resume(struct device *dev) { - struct smsc_ircc_cb *self = platform_get_drvdata(dev); + struct smsc_ircc_cb *self = dev_get_drvdata(dev); if (self->io.suspended) { IRDA_DEBUG(1, "%s, Waking up\n", driver_name); @@ -1789,7 +1788,7 @@ static void __exit smsc_ircc_cleanup(void) smsc_ircc_close(dev_self[i]); } - platform_driver_unregister(&smsc_ircc_driver); + driver_unregister(&smsc_ircc_driver); } /* diff --git a/trunk/drivers/net/jazzsonic.c b/trunk/drivers/net/jazzsonic.c index b039bd89ceb9..2fb3101cb33e 100644 --- a/trunk/drivers/net/jazzsonic.c +++ b/trunk/drivers/net/jazzsonic.c @@ -194,7 +194,7 @@ static int __init sonic_probe1(struct net_device *dev) * Probe for a SONIC ethernet controller on a Mips Jazz board. * Actually probing is superfluous but we're paranoid. */ -static int __init jazz_sonic_probe(struct platform_device *pdev) +static int __init jazz_sonic_probe(struct device *device) { struct net_device *dev; struct sonic_local *lp; @@ -212,8 +212,8 @@ static int __init jazz_sonic_probe(struct platform_device *pdev) return -ENOMEM; lp = netdev_priv(dev); - lp->device = &pdev->dev; - SET_NETDEV_DEV(dev, &pdev->dev); + lp->device = device; + SET_NETDEV_DEV(dev, device); SET_MODULE_OWNER(dev); netdev_boot_setup_check(dev); @@ -264,9 +264,9 @@ MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); #include "sonic.c" -static int __devexit jazz_sonic_device_remove (struct platform_device *pdev) +static int __devexit jazz_sonic_device_remove (struct device *device) { - struct net_device *dev = platform_get_drvdata(pdev); + struct net_device *dev = device->driver_data; struct sonic_local* lp = netdev_priv(dev); unregister_netdev (dev); @@ -278,19 +278,18 @@ static int __devexit jazz_sonic_device_remove (struct platform_device *pdev) return 0; } -static struct platform_driver jazz_sonic_driver = { +static struct device_driver jazz_sonic_driver = { + .name = jazz_sonic_string, + .bus = &platform_bus_type, .probe = jazz_sonic_probe, .remove = __devexit_p(jazz_sonic_device_remove), - .driver = { - .name = jazz_sonic_string, - }, }; static int __init jazz_sonic_init_module(void) { int err; - if ((err = platform_driver_register(&jazz_sonic_driver))) { + if ((err = driver_register(&jazz_sonic_driver))) { printk(KERN_ERR "Driver registration failed\n"); return err; } @@ -314,7 +313,7 @@ static int __init jazz_sonic_init_module(void) static void __exit jazz_sonic_cleanup_module(void) { - platform_driver_unregister(&jazz_sonic_driver); + driver_unregister(&jazz_sonic_driver); if (jazz_sonic_device) { platform_device_unregister(jazz_sonic_device); diff --git a/trunk/drivers/net/macsonic.c b/trunk/drivers/net/macsonic.c index 02d5c6822733..9ef4592aca03 100644 --- a/trunk/drivers/net/macsonic.c +++ b/trunk/drivers/net/macsonic.c @@ -525,7 +525,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev) return macsonic_init(dev); } -static int __init mac_sonic_probe(struct platform_device *device) +static int __init mac_sonic_probe(struct device *device) { struct net_device *dev; struct sonic_local *lp; @@ -537,8 +537,8 @@ static int __init mac_sonic_probe(struct platform_device *device) return -ENOMEM; lp = netdev_priv(dev); - lp->device = &device->dev; - SET_NETDEV_DEV(dev, &device->dev); + lp->device = device; + SET_NETDEV_DEV(dev, device); SET_MODULE_OWNER(dev); /* This will catch fatal stuff like -ENOMEM as well as success */ @@ -579,9 +579,9 @@ MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); #include "sonic.c" -static int __devexit mac_sonic_device_remove (struct platform_device *device) +static int __devexit mac_sonic_device_remove (struct device *device) { - struct net_device *dev = platform_get_drvdata(device); + struct net_device *dev = device->driver_data; struct sonic_local* lp = netdev_priv(dev); unregister_netdev (dev); @@ -592,19 +592,18 @@ static int __devexit mac_sonic_device_remove (struct platform_device *device) return 0; } -static struct platform_driver mac_sonic_driver = { +static struct device_driver mac_sonic_driver = { + .name = mac_sonic_string, + .bus = &platform_bus_type, .probe = mac_sonic_probe, .remove = __devexit_p(mac_sonic_device_remove), - .driver = { - .name = mac_sonic_string, - }, }; static int __init mac_sonic_init_module(void) { int err; - if ((err = platform_driver_register(&mac_sonic_driver))) { + if ((err = driver_register(&mac_sonic_driver))) { printk(KERN_ERR "Driver registration failed\n"); return err; } @@ -629,7 +628,7 @@ static int __init mac_sonic_init_module(void) static void __exit mac_sonic_cleanup_module(void) { - platform_driver_unregister(&mac_sonic_driver); + driver_unregister(&mac_sonic_driver); if (mac_sonic_device) { platform_device_unregister(mac_sonic_device); diff --git a/trunk/drivers/net/mv643xx_eth.c b/trunk/drivers/net/mv643xx_eth.c index 3cb9b3fe0cf1..71f2c6705bc3 100644 --- a/trunk/drivers/net/mv643xx_eth.c +++ b/trunk/drivers/net/mv643xx_eth.c @@ -1387,8 +1387,9 @@ static void mv643xx_netpoll(struct net_device *netdev) * Input : struct device * * Output : -ENOMEM if failed , 0 if success */ -static int mv643xx_eth_probe(struct platform_device *pdev) +static int mv643xx_eth_probe(struct device *ddev) { + struct platform_device *pdev = to_platform_device(ddev); struct mv643xx_eth_platform_data *pd; int port_num = pdev->id; struct mv643xx_private *mp; @@ -1401,7 +1402,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) if (!dev) return -ENOMEM; - platform_set_drvdata(pdev, dev); + dev_set_drvdata(ddev, dev); mp = netdev_priv(dev); @@ -1545,20 +1546,21 @@ static int mv643xx_eth_probe(struct platform_device *pdev) return err; } -static int mv643xx_eth_remove(struct platform_device *pdev) +static int mv643xx_eth_remove(struct device *ddev) { - struct net_device *dev = platform_get_drvdata(pdev); + struct net_device *dev = dev_get_drvdata(ddev); unregister_netdev(dev); flush_scheduled_work(); free_netdev(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(ddev, NULL); return 0; } -static int mv643xx_eth_shared_probe(struct platform_device *pdev) +static int mv643xx_eth_shared_probe(struct device *ddev) { + struct platform_device *pdev = to_platform_device(ddev); struct resource *res; printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); @@ -1576,7 +1578,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) } -static int mv643xx_eth_shared_remove(struct platform_device *pdev) +static int mv643xx_eth_shared_remove(struct device *ddev) { iounmap(mv643xx_eth_shared_base); mv643xx_eth_shared_base = NULL; @@ -1584,20 +1586,18 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev) return 0; } -static struct platform_driver mv643xx_eth_driver = { +static struct device_driver mv643xx_eth_driver = { + .name = MV643XX_ETH_NAME, + .bus = &platform_bus_type, .probe = mv643xx_eth_probe, .remove = mv643xx_eth_remove, - .driver = { - .name = MV643XX_ETH_NAME, - }, }; -static struct platform_driver mv643xx_eth_shared_driver = { +static struct device_driver mv643xx_eth_shared_driver = { + .name = MV643XX_ETH_SHARED_NAME, + .bus = &platform_bus_type, .probe = mv643xx_eth_shared_probe, .remove = mv643xx_eth_shared_remove, - .driver = { - .name = MV643XX_ETH_SHARED_NAME, - }, }; /* @@ -1613,11 +1613,11 @@ static int __init mv643xx_init_module(void) { int rc; - rc = platform_driver_register(&mv643xx_eth_shared_driver); + rc = driver_register(&mv643xx_eth_shared_driver); if (!rc) { - rc = platform_driver_register(&mv643xx_eth_driver); + rc = driver_register(&mv643xx_eth_driver); if (rc) - platform_driver_unregister(&mv643xx_eth_shared_driver); + driver_unregister(&mv643xx_eth_shared_driver); } return rc; } @@ -1633,8 +1633,8 @@ static int __init mv643xx_init_module(void) */ static void __exit mv643xx_cleanup_module(void) { - platform_driver_unregister(&mv643xx_eth_driver); - platform_driver_unregister(&mv643xx_eth_shared_driver); + driver_unregister(&mv643xx_eth_driver); + driver_unregister(&mv643xx_eth_shared_driver); } module_init(mv643xx_init_module); diff --git a/trunk/drivers/net/smc91x.c b/trunk/drivers/net/smc91x.c index c91e2e81f131..74d5f1a6fdea 100644 --- a/trunk/drivers/net/smc91x.c +++ b/trunk/drivers/net/smc91x.c @@ -2183,8 +2183,9 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device * * 0 --> there is a device * anything else, error */ -static int smc_drv_probe(struct platform_device *pdev) +static int smc_drv_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct net_device *ndev; struct resource *res; unsigned int __iomem *addr; @@ -2211,7 +2212,7 @@ static int smc_drv_probe(struct platform_device *pdev) goto out_release_io; } SET_MODULE_OWNER(ndev); - SET_NETDEV_DEV(ndev, &pdev->dev); + SET_NETDEV_DEV(ndev, dev); ndev->dma = (unsigned char)-1; ndev->irq = platform_get_irq(pdev, 0); @@ -2232,7 +2233,7 @@ static int smc_drv_probe(struct platform_device *pdev) goto out_release_attrib; } - platform_set_drvdata(pdev, ndev); + dev_set_drvdata(dev, ndev); ret = smc_probe(ndev, addr); if (ret != 0) goto out_iounmap; @@ -2248,7 +2249,7 @@ static int smc_drv_probe(struct platform_device *pdev) return 0; out_iounmap: - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); iounmap(addr); out_release_attrib: smc_release_attrib(pdev); @@ -2262,13 +2263,14 @@ static int smc_drv_probe(struct platform_device *pdev) return ret; } -static int smc_drv_remove(struct platform_device *pdev) +static int smc_drv_remove(struct device *dev) { - struct net_device *ndev = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct net_device *ndev = dev_get_drvdata(dev); struct smc_local *lp = netdev_priv(ndev); struct resource *res; - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); unregister_netdev(ndev); @@ -2293,9 +2295,9 @@ static int smc_drv_remove(struct platform_device *pdev) return 0; } -static int smc_drv_suspend(struct platform_device *dev, pm_message_t state) +static int smc_drv_suspend(struct device *dev, pm_message_t state) { - struct net_device *ndev = platform_get_drvdata(dev); + struct net_device *ndev = dev_get_drvdata(dev); if (ndev) { if (netif_running(ndev)) { @@ -2307,13 +2309,14 @@ static int smc_drv_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int smc_drv_resume(struct platform_device *dev) +static int smc_drv_resume(struct device *dev) { - struct net_device *ndev = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct net_device *ndev = dev_get_drvdata(dev); if (ndev) { struct smc_local *lp = netdev_priv(ndev); - smc_enable_device(dev); + smc_enable_device(pdev); if (netif_running(ndev)) { smc_reset(ndev); smc_enable(ndev); @@ -2325,14 +2328,13 @@ static int smc_drv_resume(struct platform_device *dev) return 0; } -static struct platform_driver smc_driver = { +static struct device_driver smc_driver = { + .name = CARDNAME, + .bus = &platform_bus_type, .probe = smc_drv_probe, .remove = smc_drv_remove, .suspend = smc_drv_suspend, .resume = smc_drv_resume, - .driver = { - .name = CARDNAME, - }, }; static int __init smc_init(void) @@ -2346,12 +2348,12 @@ static int __init smc_init(void) #endif #endif - return platform_driver_register(&smc_driver); + return driver_register(&smc_driver); } static void __exit smc_cleanup(void) { - platform_driver_unregister(&smc_driver); + driver_unregister(&smc_driver); } module_init(smc_init); diff --git a/trunk/drivers/net/tokenring/proteon.c b/trunk/drivers/net/tokenring/proteon.c index 4f756960db2a..d04c918ebef8 100644 --- a/trunk/drivers/net/tokenring/proteon.c +++ b/trunk/drivers/net/tokenring/proteon.c @@ -344,10 +344,9 @@ module_param_array(dma, int, NULL, 0); static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; -static struct platform_driver proteon_driver = { - .driver = { - .name = "proteon", - }, +static struct device_driver proteon_driver = { + .name = "proteon", + .bus = &platform_bus_type, }; static int __init proteon_init(void) @@ -356,7 +355,7 @@ static int __init proteon_init(void) struct platform_device *pdev; int i, num = 0, err = 0; - err = platform_driver_register(&proteon_driver); + err = driver_register(&proteon_driver); if (err) return err; @@ -373,7 +372,7 @@ static int __init proteon_init(void) err = setup_card(dev, &pdev->dev); if (!err) { proteon_dev[i] = pdev; - platform_set_drvdata(pdev, dev); + dev_set_drvdata(&pdev->dev, dev); ++num; } else { platform_device_unregister(pdev); @@ -400,17 +399,17 @@ static void __exit proteon_cleanup(void) if (!pdev) continue; - dev = platform_get_drvdata(pdev); + dev = dev_get_drvdata(&pdev->dev); unregister_netdev(dev); release_region(dev->base_addr, PROTEON_IO_EXTENT); free_irq(dev->irq, dev); free_dma(dev->dma); tmsdev_term(dev); free_netdev(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(&pdev->dev, NULL); platform_device_unregister(pdev); } - platform_driver_unregister(&proteon_driver); + driver_unregister(&proteon_driver); } module_init(proteon_init); diff --git a/trunk/drivers/net/tokenring/skisa.c b/trunk/drivers/net/tokenring/skisa.c index d6ba41cf3110..72cf708396be 100644 --- a/trunk/drivers/net/tokenring/skisa.c +++ b/trunk/drivers/net/tokenring/skisa.c @@ -354,10 +354,9 @@ module_param_array(dma, int, NULL, 0); static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; -static struct platform_driver sk_isa_driver = { - .driver = { - .name = "skisa", - }, +static struct device_driver sk_isa_driver = { + .name = "skisa", + .bus = &platform_bus_type, }; static int __init sk_isa_init(void) @@ -366,7 +365,7 @@ static int __init sk_isa_init(void) struct platform_device *pdev; int i, num = 0, err = 0; - err = platform_driver_register(&sk_isa_driver); + err = driver_register(&sk_isa_driver); if (err) return err; @@ -383,7 +382,7 @@ static int __init sk_isa_init(void) err = setup_card(dev, &pdev->dev); if (!err) { sk_isa_dev[i] = pdev; - platform_set_drvdata(sk_isa_dev[i], dev); + dev_set_drvdata(&sk_isa_dev[i]->dev, dev); ++num; } else { platform_device_unregister(pdev); @@ -410,17 +409,17 @@ static void __exit sk_isa_cleanup(void) if (!pdev) continue; - dev = platform_get_drvdata(pdev); + dev = dev_get_drvdata(&pdev->dev); unregister_netdev(dev); release_region(dev->base_addr, SK_ISA_IO_EXTENT); free_irq(dev->irq, dev); free_dma(dev->dma); tmsdev_term(dev); free_netdev(dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(&pdev->dev, NULL); platform_device_unregister(pdev); } - platform_driver_unregister(&sk_isa_driver); + driver_unregister(&sk_isa_driver); } module_init(sk_isa_init); diff --git a/trunk/drivers/scsi/ahci.c b/trunk/drivers/scsi/ahci.c index 57ef7ae387d9..10c470e7d316 100644 --- a/trunk/drivers/scsi/ahci.c +++ b/trunk/drivers/scsi/ahci.c @@ -255,7 +255,7 @@ static struct ata_port_info ahci_port_info[] = { }, }; -static const struct pci_device_id ahci_pci_tbl[] = { +static struct pci_device_id ahci_pci_tbl[] = { { PCI_VENDOR_ID_INTEL, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* ICH6 */ { PCI_VENDOR_ID_INTEL, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, diff --git a/trunk/drivers/scsi/ata_piix.c b/trunk/drivers/scsi/ata_piix.c index 855428ff37e9..a1bd8d95623c 100644 --- a/trunk/drivers/scsi/ata_piix.c +++ b/trunk/drivers/scsi/ata_piix.c @@ -95,7 +95,7 @@ static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); static unsigned int in_module_init = 1; -static const struct pci_device_id piix_pci_tbl[] = { +static struct pci_device_id piix_pci_tbl[] = { #ifdef ATA_ENABLE_PATA { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata }, { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, diff --git a/trunk/drivers/scsi/libata-core.c b/trunk/drivers/scsi/libata-core.c index e51d9a8a2796..a74b4071a662 100644 --- a/trunk/drivers/scsi/libata-core.c +++ b/trunk/drivers/scsi/libata-core.c @@ -4563,7 +4563,6 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int probe_ent->irq = pdev->irq; probe_ent->irq_flags = SA_SHIRQ; - probe_ent->private_data = port[0]->private_data; if (ports & ATA_PORT_PRIMARY) { probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0); @@ -4600,7 +4599,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru probe_ent->legacy_mode = 1; probe_ent->n_ports = 1; probe_ent->hard_port_no = port_num; - probe_ent->private_data = port->private_data; switch(port_num) { diff --git a/trunk/drivers/scsi/libata-scsi.c b/trunk/drivers/scsi/libata-scsi.c index 7e37f488f591..bb30fcdc9297 100644 --- a/trunk/drivers/scsi/libata-scsi.c +++ b/trunk/drivers/scsi/libata-scsi.c @@ -1129,8 +1129,6 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm * length 0 means transfer 0 block of data. * However, for ATA R/W commands, sector count 0 means * 256 or 65536 sectors, not 0 sectors as in SCSI. - * - * WARNING: one or two older ATA drives treat 0 as 0... */ goto nothing_to_do; diff --git a/trunk/drivers/scsi/pdc_adma.c b/trunk/drivers/scsi/pdc_adma.c index f557f17ca00c..78b4ff117af6 100644 --- a/trunk/drivers/scsi/pdc_adma.c +++ b/trunk/drivers/scsi/pdc_adma.c @@ -190,7 +190,7 @@ static struct ata_port_info adma_port_info[] = { }, }; -static const struct pci_device_id adma_ata_pci_tbl[] = { +static struct pci_device_id adma_ata_pci_tbl[] = { { PCI_VENDOR_ID_PDC, 0x1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_1841_idx }, diff --git a/trunk/drivers/scsi/sata_mv.c b/trunk/drivers/scsi/sata_mv.c index 257c128f4aaa..93d55233af7b 100644 --- a/trunk/drivers/scsi/sata_mv.c +++ b/trunk/drivers/scsi/sata_mv.c @@ -349,7 +349,7 @@ static struct ata_port_info mv_port_info[] = { }, }; -static const struct pci_device_id mv_pci_tbl[] = { +static struct pci_device_id mv_pci_tbl[] = { {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, @@ -359,8 +359,6 @@ static const struct pci_device_id mv_pci_tbl[] = { {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6080), 0, 0, chip_608x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6081), 0, 0, chip_608x}, - - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x0241), 0, 0, chip_604x}, {} /* terminate list */ }; diff --git a/trunk/drivers/scsi/sata_nv.c b/trunk/drivers/scsi/sata_nv.c index 4954896dfdb9..37a4fae95ed4 100644 --- a/trunk/drivers/scsi/sata_nv.c +++ b/trunk/drivers/scsi/sata_nv.c @@ -137,7 +137,7 @@ enum nv_host_type CK804 }; -static const struct pci_device_id nv_pci_tbl[] = { +static struct pci_device_id nv_pci_tbl[] = { { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, NFORCE2 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA, diff --git a/trunk/drivers/scsi/sata_promise.c b/trunk/drivers/scsi/sata_promise.c index 242d906987ad..9edc9d91efc3 100644 --- a/trunk/drivers/scsi/sata_promise.c +++ b/trunk/drivers/scsi/sata_promise.c @@ -193,7 +193,7 @@ static struct ata_port_info pdc_port_info[] = { }, }; -static const struct pci_device_id pdc_ata_pci_tbl[] = { +static struct pci_device_id pdc_ata_pci_tbl[] = { { PCI_VENDOR_ID_PROMISE, 0x3371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_2037x }, { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, diff --git a/trunk/drivers/scsi/sata_qstor.c b/trunk/drivers/scsi/sata_qstor.c index b2f6324a2eb2..d274ab235781 100644 --- a/trunk/drivers/scsi/sata_qstor.c +++ b/trunk/drivers/scsi/sata_qstor.c @@ -184,7 +184,7 @@ static struct ata_port_info qs_port_info[] = { }, }; -static const struct pci_device_id qs_ata_pci_tbl[] = { +static struct pci_device_id qs_ata_pci_tbl[] = { { PCI_VENDOR_ID_PDC, 0x2068, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_2068_idx }, diff --git a/trunk/drivers/scsi/sata_sil.c b/trunk/drivers/scsi/sata_sil.c index 36091868560d..d0e3c3c6c25f 100644 --- a/trunk/drivers/scsi/sata_sil.c +++ b/trunk/drivers/scsi/sata_sil.c @@ -87,7 +87,7 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); static void sil_post_set_mode (struct ata_port *ap); -static const struct pci_device_id sil_pci_tbl[] = { +static struct pci_device_id sil_pci_tbl[] = { { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, diff --git a/trunk/drivers/scsi/sata_sil24.c b/trunk/drivers/scsi/sata_sil24.c index d3198d9a72c1..4682a50650b4 100644 --- a/trunk/drivers/scsi/sata_sil24.c +++ b/trunk/drivers/scsi/sata_sil24.c @@ -240,7 +240,7 @@ static void sil24_port_stop(struct ata_port *ap); static void sil24_host_stop(struct ata_host_set *host_set); static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); -static const struct pci_device_id sil24_pci_tbl[] = { +static struct pci_device_id sil24_pci_tbl[] = { { 0x1095, 0x3124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3124 }, { 0x1095, 0x3132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3132 }, { 0x1095, 0x3131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, BID_SIL3131 }, diff --git a/trunk/drivers/scsi/sata_sis.c b/trunk/drivers/scsi/sata_sis.c index 32e12620b162..42d7c4e92501 100644 --- a/trunk/drivers/scsi/sata_sis.c +++ b/trunk/drivers/scsi/sata_sis.c @@ -67,7 +67,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg); static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); -static const struct pci_device_id sis_pci_tbl[] = { +static struct pci_device_id sis_pci_tbl[] = { { PCI_VENDOR_ID_SI, 0x180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, { PCI_VENDOR_ID_SI, 0x181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, { PCI_VENDOR_ID_SI, 0x182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 }, diff --git a/trunk/drivers/scsi/sata_svw.c b/trunk/drivers/scsi/sata_svw.c index 57e5a9d964c3..9895d1caefcf 100644 --- a/trunk/drivers/scsi/sata_svw.c +++ b/trunk/drivers/scsi/sata_svw.c @@ -466,7 +466,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e * 0x24a is device ID for BCM5785 (aka HT1000) HT southbridge integrated SATA * controller * */ -static const struct pci_device_id k2_sata_pci_tbl[] = { +static struct pci_device_id k2_sata_pci_tbl[] = { { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, diff --git a/trunk/drivers/scsi/sata_sx4.c b/trunk/drivers/scsi/sata_sx4.c index b4bbe48acab0..d5a38784352b 100644 --- a/trunk/drivers/scsi/sata_sx4.c +++ b/trunk/drivers/scsi/sata_sx4.c @@ -229,7 +229,7 @@ static struct ata_port_info pdc_port_info[] = { }; -static const struct pci_device_id pdc_sata_pci_tbl[] = { +static struct pci_device_id pdc_sata_pci_tbl[] = { { PCI_VENDOR_ID_PROMISE, 0x6622, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_20621 }, { } /* terminate list */ diff --git a/trunk/drivers/scsi/sata_uli.c b/trunk/drivers/scsi/sata_uli.c index b2422a0f25c8..cf0baaa4e045 100644 --- a/trunk/drivers/scsi/sata_uli.c +++ b/trunk/drivers/scsi/sata_uli.c @@ -55,7 +55,7 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); static u32 uli_scr_read (struct ata_port *ap, unsigned int sc_reg); static void uli_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); -static const struct pci_device_id uli_pci_tbl[] = { +static struct pci_device_id uli_pci_tbl[] = { { PCI_VENDOR_ID_AL, 0x5289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5289 }, { PCI_VENDOR_ID_AL, 0x5287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5287 }, { PCI_VENDOR_ID_AL, 0x5281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, uli_5281 }, diff --git a/trunk/drivers/scsi/sata_via.c b/trunk/drivers/scsi/sata_via.c index c76215692da2..ab19d2ba2a4b 100644 --- a/trunk/drivers/scsi/sata_via.c +++ b/trunk/drivers/scsi/sata_via.c @@ -75,7 +75,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); -static const struct pci_device_id svia_pci_tbl[] = { +static struct pci_device_id svia_pci_tbl[] = { { 0x1106, 0x3149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6420 }, { 0x1106, 0x3249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, vt6421 }, diff --git a/trunk/drivers/scsi/sata_vsc.c b/trunk/drivers/scsi/sata_vsc.c index 77a6e4b9262d..ce8a2fd7da84 100644 --- a/trunk/drivers/scsi/sata_vsc.c +++ b/trunk/drivers/scsi/sata_vsc.c @@ -400,7 +400,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d * 0x8086/0x3200 is the Intel 31244, which is supposed to be identical * compatibility is untested as of yet */ -static const struct pci_device_id vsc_sata_pci_tbl[] = { +static struct pci_device_id vsc_sata_pci_tbl[] = { { 0x1725, 0x7174, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, { 0x8086, 0x3200, PCI_ANY_ID, PCI_ANY_ID, 0x10600, 0xFFFFFF, 0 }, { } diff --git a/trunk/drivers/serial/8250.c b/trunk/drivers/serial/8250.c index 3742753241ee..98820603e75f 100644 --- a/trunk/drivers/serial/8250.c +++ b/trunk/drivers/serial/8250.c @@ -2381,9 +2381,9 @@ void serial8250_resume_port(int line) * list is terminated with a zero flags entry, which means we expect * all entries to have at least UPF_BOOT_AUTOCONF set. */ -static int __devinit serial8250_probe(struct platform_device *dev) +static int __devinit serial8250_probe(struct device *dev) { - struct plat_serial8250_port *p = dev->dev.platform_data; + struct plat_serial8250_port *p = dev->platform_data; struct uart_port port; int ret, i; @@ -2399,12 +2399,12 @@ static int __devinit serial8250_probe(struct platform_device *dev) port.flags = p->flags; port.mapbase = p->mapbase; port.hub6 = p->hub6; - port.dev = &dev->dev; + port.dev = dev; if (share_irqs) port.flags |= UPF_SHARE_IRQ; ret = serial8250_register_port(&port); if (ret < 0) { - dev_err(&dev->dev, "unable to register port at index %d " + dev_err(dev, "unable to register port at index %d " "(IO%lx MEM%lx IRQ%d): %d\n", i, p->iobase, p->mapbase, p->irq, ret); } @@ -2415,55 +2415,54 @@ static int __devinit serial8250_probe(struct platform_device *dev) /* * Remove serial ports registered against a platform device. */ -static int __devexit serial8250_remove(struct platform_device *dev) +static int __devexit serial8250_remove(struct device *dev) { int i; for (i = 0; i < UART_NR; i++) { struct uart_8250_port *up = &serial8250_ports[i]; - if (up->port.dev == &dev->dev) + if (up->port.dev == dev) serial8250_unregister_port(i); } return 0; } -static int serial8250_suspend(struct platform_device *dev, pm_message_t state) +static int serial8250_suspend(struct device *dev, pm_message_t state) { int i; for (i = 0; i < UART_NR; i++) { struct uart_8250_port *up = &serial8250_ports[i]; - if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) + if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) uart_suspend_port(&serial8250_reg, &up->port); } return 0; } -static int serial8250_resume(struct platform_device *dev) +static int serial8250_resume(struct device *dev) { int i; for (i = 0; i < UART_NR; i++) { struct uart_8250_port *up = &serial8250_ports[i]; - if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) + if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) uart_resume_port(&serial8250_reg, &up->port); } return 0; } -static struct platform_driver serial8250_isa_driver = { +static struct device_driver serial8250_isa_driver = { + .name = "serial8250", + .bus = &platform_bus_type, .probe = serial8250_probe, .remove = __devexit_p(serial8250_remove), .suspend = serial8250_suspend, .resume = serial8250_resume, - .driver = { - .name = "serial8250", - }, }; /* @@ -2609,7 +2608,7 @@ static int __init serial8250_init(void) serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); - ret = platform_driver_register(&serial8250_isa_driver); + ret = driver_register(&serial8250_isa_driver); if (ret == 0) goto out; @@ -2631,7 +2630,7 @@ static void __exit serial8250_exit(void) */ serial8250_isa_devs = NULL; - platform_driver_unregister(&serial8250_isa_driver); + driver_unregister(&serial8250_isa_driver); platform_device_unregister(isa_dev); uart_unregister_driver(&serial8250_reg); diff --git a/trunk/drivers/serial/imx.c b/trunk/drivers/serial/imx.c index 355cd93a8a87..4a54ff584700 100644 --- a/trunk/drivers/serial/imx.c +++ b/trunk/drivers/serial/imx.c @@ -921,9 +921,9 @@ static struct uart_driver imx_reg = { .cons = IMX_CONSOLE, }; -static int serial_imx_suspend(struct platform_device *dev, pm_message_t state) +static int serial_imx_suspend(struct device *_dev, pm_message_t state) { - struct imx_port *sport = platform_get_drvdata(dev); + struct imx_port *sport = dev_get_drvdata(_dev); if (sport) uart_suspend_port(&imx_reg, &sport->port); @@ -931,9 +931,9 @@ static int serial_imx_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int serial_imx_resume(struct platform_device *dev) +static int serial_imx_resume(struct device *_dev) { - struct imx_port *sport = platform_get_drvdata(dev); + struct imx_port *sport = dev_get_drvdata(_dev); if (sport) uart_resume_port(&imx_reg, &sport->port); @@ -941,19 +941,21 @@ static int serial_imx_resume(struct platform_device *dev) return 0; } -static int serial_imx_probe(struct platform_device *dev) +static int serial_imx_probe(struct device *_dev) { - imx_ports[dev->id].port.dev = &dev->dev; + struct platform_device *dev = to_platform_device(_dev); + + imx_ports[dev->id].port.dev = _dev; uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); - platform_set_drvdata(dev, &imx_ports[dev->id]); + dev_set_drvdata(_dev, &imx_ports[dev->id]); return 0; } -static int serial_imx_remove(struct platform_device *dev) +static int serial_imx_remove(struct device *_dev) { - struct imx_port *sport = platform_get_drvdata(dev); + struct imx_port *sport = dev_get_drvdata(_dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(_dev, NULL); if (sport) uart_remove_one_port(&imx_reg, &sport->port); @@ -961,15 +963,14 @@ static int serial_imx_remove(struct platform_device *dev) return 0; } -static struct platform_driver serial_imx_driver = { +static struct device_driver serial_imx_driver = { + .name = "imx-uart", + .bus = &platform_bus_type, .probe = serial_imx_probe, .remove = serial_imx_remove, .suspend = serial_imx_suspend, .resume = serial_imx_resume, - .driver = { - .name = "imx-uart", - }, }; static int __init imx_serial_init(void) @@ -984,7 +985,7 @@ static int __init imx_serial_init(void) if (ret) return ret; - ret = platform_driver_register(&serial_imx_driver); + ret = driver_register(&serial_imx_driver); if (ret != 0) uart_unregister_driver(&imx_reg); diff --git a/trunk/drivers/serial/mpc52xx_uart.c b/trunk/drivers/serial/mpc52xx_uart.c index 5d3cb8486447..0dd08a09e7e6 100644 --- a/trunk/drivers/serial/mpc52xx_uart.c +++ b/trunk/drivers/serial/mpc52xx_uart.c @@ -717,9 +717,10 @@ static struct uart_driver mpc52xx_uart_driver = { /* ======================================================================== */ static int __devinit -mpc52xx_uart_probe(struct platform_device *dev) +mpc52xx_uart_probe(struct device *dev) { - struct resource *res = dev->resource; + struct platform_device *pdev = to_platform_device(dev); + struct resource *res = pdev->resource; struct uart_port *port = NULL; int i, idx, ret; @@ -760,17 +761,17 @@ mpc52xx_uart_probe(struct platform_device *dev) /* Add the port to the uart sub-system */ ret = uart_add_one_port(&mpc52xx_uart_driver, port); if (!ret) - platform_set_drvdata(dev, (void*)port); + dev_set_drvdata(dev, (void*)port); return ret; } static int -mpc52xx_uart_remove(struct platform_device *dev) +mpc52xx_uart_remove(struct device *dev) { - struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); + struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); if (port) uart_remove_one_port(&mpc52xx_uart_driver, port); @@ -780,9 +781,9 @@ mpc52xx_uart_remove(struct platform_device *dev) #ifdef CONFIG_PM static int -mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) +mpc52xx_uart_suspend(struct device *dev, pm_message_t state) { - struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); + struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); if (sport) uart_suspend_port(&mpc52xx_uart_driver, port); @@ -791,9 +792,9 @@ mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) } static int -mpc52xx_uart_resume(struct platform_device *dev) +mpc52xx_uart_resume(struct device *dev) { - struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); + struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); if (port) uart_resume_port(&mpc52xx_uart_driver, port); @@ -802,16 +803,15 @@ mpc52xx_uart_resume(struct platform_device *dev) } #endif -static struct platform_driver mpc52xx_uart_platform_driver = { +static struct device_driver mpc52xx_uart_platform_driver = { + .name = "mpc52xx-psc", + .bus = &platform_bus_type, .probe = mpc52xx_uart_probe, .remove = mpc52xx_uart_remove, #ifdef CONFIG_PM .suspend = mpc52xx_uart_suspend, .resume = mpc52xx_uart_resume, #endif - .driver = { - .name = "mpc52xx-psc", - }, }; @@ -828,7 +828,7 @@ mpc52xx_uart_init(void) ret = uart_register_driver(&mpc52xx_uart_driver); if (ret == 0) { - ret = platform_driver_register(&mpc52xx_uart_platform_driver); + ret = driver_register(&mpc52xx_uart_platform_driver); if (ret) uart_unregister_driver(&mpc52xx_uart_driver); } @@ -839,7 +839,7 @@ mpc52xx_uart_init(void) static void __exit mpc52xx_uart_exit(void) { - platform_driver_unregister(&mpc52xx_uart_platform_driver); + driver_unregister(&mpc52xx_uart_platform_driver); uart_unregister_driver(&mpc52xx_uart_driver); } diff --git a/trunk/drivers/serial/mpsc.c b/trunk/drivers/serial/mpsc.c index 8f83e4007ecd..ba8838b234da 100644 --- a/trunk/drivers/serial/mpsc.c +++ b/trunk/drivers/serial/mpsc.c @@ -1551,14 +1551,15 @@ mpsc_shared_unmap_regs(void) } static int -mpsc_shared_drv_probe(struct platform_device *dev) +mpsc_shared_drv_probe(struct device *dev) { + struct platform_device *pd = to_platform_device(dev); struct mpsc_shared_pdata *pdata; int rc = -ENODEV; - if (dev->id == 0) { - if (!(rc = mpsc_shared_map_regs(dev))) { - pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data; + if (pd->id == 0) { + if (!(rc = mpsc_shared_map_regs(pd))) { + pdata = (struct mpsc_shared_pdata *)dev->platform_data; mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; @@ -1576,11 +1577,12 @@ mpsc_shared_drv_probe(struct platform_device *dev) } static int -mpsc_shared_drv_remove(struct platform_device *dev) +mpsc_shared_drv_remove(struct device *dev) { + struct platform_device *pd = to_platform_device(dev); int rc = -ENODEV; - if (dev->id == 0) { + if (pd->id == 0) { mpsc_shared_unmap_regs(); mpsc_shared_regs.MPSC_MRR_m = 0; mpsc_shared_regs.MPSC_RCRR_m = 0; @@ -1593,12 +1595,11 @@ mpsc_shared_drv_remove(struct platform_device *dev) return rc; } -static struct platform_driver mpsc_shared_driver = { +static struct device_driver mpsc_shared_driver = { + .name = MPSC_SHARED_NAME, + .bus = &platform_bus_type, .probe = mpsc_shared_drv_probe, .remove = mpsc_shared_drv_remove, - .driver = { - .name = MPSC_SHARED_NAME, - }, }; /* @@ -1731,18 +1732,19 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi, } static int -mpsc_drv_probe(struct platform_device *dev) +mpsc_drv_probe(struct device *dev) { + struct platform_device *pd = to_platform_device(dev); struct mpsc_port_info *pi; int rc = -ENODEV; - pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id); + pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); - if (dev->id < MPSC_NUM_CTLRS) { - pi = &mpsc_ports[dev->id]; + if (pd->id < MPSC_NUM_CTLRS) { + pi = &mpsc_ports[pd->id]; - if (!(rc = mpsc_drv_map_regs(pi, dev))) { - mpsc_drv_get_platform_data(pi, dev, dev->id); + if (!(rc = mpsc_drv_map_regs(pi, pd))) { + mpsc_drv_get_platform_data(pi, pd, pd->id); if (!(rc = mpsc_make_ready(pi))) if (!(rc = uart_add_one_port(&mpsc_reg, @@ -1762,26 +1764,27 @@ mpsc_drv_probe(struct platform_device *dev) } static int -mpsc_drv_remove(struct platform_device *dev) +mpsc_drv_remove(struct device *dev) { - pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id); + struct platform_device *pd = to_platform_device(dev); - if (dev->id < MPSC_NUM_CTLRS) { - uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port); - mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port); - mpsc_drv_unmap_regs(&mpsc_ports[dev->id]); + pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id); + + if (pd->id < MPSC_NUM_CTLRS) { + uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); + mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port); + mpsc_drv_unmap_regs(&mpsc_ports[pd->id]); return 0; } else return -ENODEV; } -static struct platform_driver mpsc_driver = { +static struct device_driver mpsc_driver = { + .name = MPSC_CTLR_NAME, + .bus = &platform_bus_type, .probe = mpsc_drv_probe, .remove = mpsc_drv_remove, - .driver = { - .name = MPSC_CTLR_NAME, - }, }; static int __init @@ -1795,9 +1798,9 @@ mpsc_drv_init(void) memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); if (!(rc = uart_register_driver(&mpsc_reg))) { - if (!(rc = platform_driver_register(&mpsc_shared_driver))) { - if ((rc = platform_driver_register(&mpsc_driver))) { - platform_driver_unregister(&mpsc_shared_driver); + if (!(rc = driver_register(&mpsc_shared_driver))) { + if ((rc = driver_register(&mpsc_driver))) { + driver_unregister(&mpsc_shared_driver); uart_unregister_driver(&mpsc_reg); } } @@ -1812,8 +1815,8 @@ mpsc_drv_init(void) static void __exit mpsc_drv_exit(void) { - platform_driver_unregister(&mpsc_driver); - platform_driver_unregister(&mpsc_shared_driver); + driver_unregister(&mpsc_driver); + driver_unregister(&mpsc_shared_driver); uart_unregister_driver(&mpsc_reg); memset(mpsc_ports, 0, sizeof(mpsc_ports)); memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); diff --git a/trunk/drivers/serial/pxa.c b/trunk/drivers/serial/pxa.c index ff5e6309d682..16b2f9417af9 100644 --- a/trunk/drivers/serial/pxa.c +++ b/trunk/drivers/serial/pxa.c @@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = { .cons = PXA_CONSOLE, }; -static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state) +static int serial_pxa_suspend(struct device *_dev, pm_message_t state) { - struct uart_pxa_port *sport = platform_get_drvdata(dev); + struct uart_pxa_port *sport = dev_get_drvdata(_dev); if (sport) uart_suspend_port(&serial_pxa_reg, &sport->port); @@ -815,9 +815,9 @@ static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int serial_pxa_resume(struct platform_device *dev) +static int serial_pxa_resume(struct device *_dev) { - struct uart_pxa_port *sport = platform_get_drvdata(dev); + struct uart_pxa_port *sport = dev_get_drvdata(_dev); if (sport) uart_resume_port(&serial_pxa_reg, &sport->port); @@ -825,19 +825,21 @@ static int serial_pxa_resume(struct platform_device *dev) return 0; } -static int serial_pxa_probe(struct platform_device *dev) +static int serial_pxa_probe(struct device *_dev) { - serial_pxa_ports[dev->id].port.dev = &dev->dev; + struct platform_device *dev = to_platform_device(_dev); + + serial_pxa_ports[dev->id].port.dev = _dev; uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); - platform_set_drvdata(dev, &serial_pxa_ports[dev->id]); + dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); return 0; } -static int serial_pxa_remove(struct platform_device *dev) +static int serial_pxa_remove(struct device *_dev) { - struct uart_pxa_port *sport = platform_get_drvdata(dev); + struct uart_pxa_port *sport = dev_get_drvdata(_dev); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(_dev, NULL); if (sport) uart_remove_one_port(&serial_pxa_reg, &sport->port); @@ -845,15 +847,14 @@ static int serial_pxa_remove(struct platform_device *dev) return 0; } -static struct platform_driver serial_pxa_driver = { +static struct device_driver serial_pxa_driver = { + .name = "pxa2xx-uart", + .bus = &platform_bus_type, .probe = serial_pxa_probe, .remove = serial_pxa_remove, .suspend = serial_pxa_suspend, .resume = serial_pxa_resume, - .driver = { - .name = "pxa2xx-uart", - }, }; int __init serial_pxa_init(void) @@ -864,7 +865,7 @@ int __init serial_pxa_init(void) if (ret != 0) return ret; - ret = platform_driver_register(&serial_pxa_driver); + ret = driver_register(&serial_pxa_driver); if (ret != 0) uart_unregister_driver(&serial_pxa_reg); @@ -873,7 +874,7 @@ int __init serial_pxa_init(void) void __exit serial_pxa_exit(void) { - platform_driver_unregister(&serial_pxa_driver); + driver_unregister(&serial_pxa_driver); uart_unregister_driver(&serial_pxa_reg); } diff --git a/trunk/drivers/serial/s3c2410.c b/trunk/drivers/serial/s3c2410.c index 47681c4654e4..036792328d49 100644 --- a/trunk/drivers/serial/s3c2410.c +++ b/trunk/drivers/serial/s3c2410.c @@ -1092,13 +1092,14 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, static int probe_index = 0; -static int s3c24xx_serial_probe(struct platform_device *dev, +static int s3c24xx_serial_probe(struct device *_dev, struct s3c24xx_uart_info *info) { struct s3c24xx_uart_port *ourport; + struct platform_device *dev = to_platform_device(_dev); int ret; - dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index); + dbg("s3c24xx_serial_probe(%p, %p) %d\n", _dev, info, probe_index); ourport = &s3c24xx_serial_ports[probe_index]; probe_index++; @@ -1111,7 +1112,7 @@ static int s3c24xx_serial_probe(struct platform_device *dev, dbg("%s: adding port\n", __FUNCTION__); uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); - platform_set_drvdata(dev, &ourport->port); + dev_set_drvdata(_dev, &ourport->port); return 0; @@ -1119,9 +1120,9 @@ static int s3c24xx_serial_probe(struct platform_device *dev, return ret; } -static int s3c24xx_serial_remove(struct platform_device *dev) +static int s3c24xx_serial_remove(struct device *_dev) { - struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); + struct uart_port *port = s3c24xx_dev_to_port(_dev); if (port) uart_remove_one_port(&s3c24xx_uart_drv, port); @@ -1133,9 +1134,9 @@ static int s3c24xx_serial_remove(struct platform_device *dev) #ifdef CONFIG_PM -static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state) +static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) { - struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); + struct uart_port *port = s3c24xx_dev_to_port(dev); if (port) uart_suspend_port(&s3c24xx_uart_drv, port); @@ -1143,9 +1144,9 @@ static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t stat return 0; } -static int s3c24xx_serial_resume(struct platform_device *dev) +static int s3c24xx_serial_resume(struct device *dev) { - struct uart_port *port = s3c24xx_dev_to_port(&dev->dev); + struct uart_port *port = s3c24xx_dev_to_port(dev); struct s3c24xx_uart_port *ourport = to_ourport(port); if (port) { @@ -1164,11 +1165,11 @@ static int s3c24xx_serial_resume(struct platform_device *dev) #define s3c24xx_serial_resume NULL #endif -static int s3c24xx_serial_init(struct platform_driver *drv, +static int s3c24xx_serial_init(struct device_driver *drv, struct s3c24xx_uart_info *info) { dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); - return platform_driver_register(drv); + return driver_register(drv); } @@ -1227,20 +1228,19 @@ static struct s3c24xx_uart_info s3c2400_uart_inf = { .reset_port = s3c2400_serial_resetport, }; -static int s3c2400_serial_probe(struct platform_device *dev) +static int s3c2400_serial_probe(struct device *dev) { return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); } -static struct platform_driver s3c2400_serial_drv = { +static struct device_driver s3c2400_serial_drv = { + .name = "s3c2400-uart", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = s3c2400_serial_probe, .remove = s3c24xx_serial_remove, .suspend = s3c24xx_serial_suspend, .resume = s3c24xx_serial_resume, - .driver = { - .name = "s3c2400-uart", - .owner = THIS_MODULE, - }, }; static inline int s3c2400_serial_init(void) @@ -1250,7 +1250,7 @@ static inline int s3c2400_serial_init(void) static inline void s3c2400_serial_exit(void) { - platform_driver_unregister(&s3c2400_serial_drv); + driver_unregister(&s3c2400_serial_drv); } #define s3c2400_uart_inf_at &s3c2400_uart_inf @@ -1332,20 +1332,19 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = { /* device management */ -static int s3c2410_serial_probe(struct platform_device *dev) +static int s3c2410_serial_probe(struct device *dev) { return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); } -static struct platform_driver s3c2410_serial_drv = { +static struct device_driver s3c2410_serial_drv = { + .name = "s3c2410-uart", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = s3c2410_serial_probe, .remove = s3c24xx_serial_remove, .suspend = s3c24xx_serial_suspend, .resume = s3c24xx_serial_resume, - .driver = { - .name = "s3c2410-uart", - .owner = THIS_MODULE, - }, }; static inline int s3c2410_serial_init(void) @@ -1355,7 +1354,7 @@ static inline int s3c2410_serial_init(void) static inline void s3c2410_serial_exit(void) { - platform_driver_unregister(&s3c2410_serial_drv); + driver_unregister(&s3c2410_serial_drv); } #define s3c2410_uart_inf_at &s3c2410_uart_inf @@ -1494,21 +1493,20 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = { /* device management */ -static int s3c2440_serial_probe(struct platform_device *dev) +static int s3c2440_serial_probe(struct device *dev) { dbg("s3c2440_serial_probe: dev=%p\n", dev); return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); } -static struct platform_driver s3c2440_serial_drv = { +static struct device_driver s3c2440_serial_drv = { + .name = "s3c2440-uart", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = s3c2440_serial_probe, .remove = s3c24xx_serial_remove, .suspend = s3c24xx_serial_suspend, .resume = s3c24xx_serial_resume, - .driver = { - .name = "s3c2440-uart", - .owner = THIS_MODULE, - }, }; @@ -1519,7 +1517,7 @@ static inline int s3c2440_serial_init(void) static inline void s3c2440_serial_exit(void) { - platform_driver_unregister(&s3c2440_serial_drv); + driver_unregister(&s3c2440_serial_drv); } #define s3c2440_uart_inf_at &s3c2440_uart_inf diff --git a/trunk/drivers/serial/sa1100.c b/trunk/drivers/serial/sa1100.c index fd9deee20e05..ed618cc7ae96 100644 --- a/trunk/drivers/serial/sa1100.c +++ b/trunk/drivers/serial/sa1100.c @@ -834,9 +834,9 @@ static struct uart_driver sa1100_reg = { .cons = SA1100_CONSOLE, }; -static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state) +static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) { - struct sa1100_port *sport = platform_get_drvdata(dev); + struct sa1100_port *sport = dev_get_drvdata(_dev); if (sport) uart_suspend_port(&sa1100_reg, &sport->port); @@ -844,9 +844,9 @@ static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state return 0; } -static int sa1100_serial_resume(struct platform_device *dev) +static int sa1100_serial_resume(struct device *_dev) { - struct sa1100_port *sport = platform_get_drvdata(dev); + struct sa1100_port *sport = dev_get_drvdata(_dev); if (sport) uart_resume_port(&sa1100_reg, &sport->port); @@ -854,8 +854,9 @@ static int sa1100_serial_resume(struct platform_device *dev) return 0; } -static int sa1100_serial_probe(struct platform_device *dev) +static int sa1100_serial_probe(struct device *_dev) { + struct platform_device *dev = to_platform_device(_dev); struct resource *res = dev->resource; int i; @@ -868,9 +869,9 @@ static int sa1100_serial_probe(struct platform_device *dev) if (sa1100_ports[i].port.mapbase != res->start) continue; - sa1100_ports[i].port.dev = &dev->dev; + sa1100_ports[i].port.dev = _dev; uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); - platform_set_drvdata(dev, &sa1100_ports[i]); + dev_set_drvdata(_dev, &sa1100_ports[i]); break; } } @@ -878,11 +879,11 @@ static int sa1100_serial_probe(struct platform_device *dev) return 0; } -static int sa1100_serial_remove(struct platform_device *pdev) +static int sa1100_serial_remove(struct device *_dev) { - struct sa1100_port *sport = platform_get_drvdata(pdev); + struct sa1100_port *sport = dev_get_drvdata(_dev); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(_dev, NULL); if (sport) uart_remove_one_port(&sa1100_reg, &sport->port); @@ -890,14 +891,13 @@ static int sa1100_serial_remove(struct platform_device *pdev) return 0; } -static struct platform_driver sa11x0_serial_driver = { +static struct device_driver sa11x0_serial_driver = { + .name = "sa11x0-uart", + .bus = &platform_bus_type, .probe = sa1100_serial_probe, .remove = sa1100_serial_remove, .suspend = sa1100_serial_suspend, .resume = sa1100_serial_resume, - .driver = { - .name = "sa11x0-uart", - }, }; static int __init sa1100_serial_init(void) @@ -910,7 +910,7 @@ static int __init sa1100_serial_init(void) ret = uart_register_driver(&sa1100_reg); if (ret == 0) { - ret = platform_driver_register(&sa11x0_serial_driver); + ret = driver_register(&sa11x0_serial_driver); if (ret) uart_unregister_driver(&sa1100_reg); } @@ -919,7 +919,7 @@ static int __init sa1100_serial_init(void) static void __exit sa1100_serial_exit(void) { - platform_driver_unregister(&sa11x0_serial_driver); + driver_unregister(&sa11x0_serial_driver); uart_unregister_driver(&sa1100_reg); } diff --git a/trunk/drivers/serial/vr41xx_siu.c b/trunk/drivers/serial/vr41xx_siu.c index 865d4dea65df..01696b3e3f61 100644 --- a/trunk/drivers/serial/vr41xx_siu.c +++ b/trunk/drivers/serial/vr41xx_siu.c @@ -924,7 +924,7 @@ static struct uart_driver siu_uart_driver = { .cons = SERIAL_VR41XX_CONSOLE, }; -static int siu_probe(struct platform_device *dev) +static int siu_probe(struct device *dev) { struct uart_port *port; int num, i, retval; @@ -941,7 +941,7 @@ static int siu_probe(struct platform_device *dev) for (i = 0; i < num; i++) { port = &siu_uart_ports[i]; port->ops = &siu_uart_ops; - port->dev = &dev->dev; + port->dev = dev; retval = uart_add_one_port(&siu_uart_driver, port); if (retval < 0) { @@ -958,14 +958,14 @@ static int siu_probe(struct platform_device *dev) return 0; } -static int siu_remove(struct platform_device *dev) +static int siu_remove(struct device *dev) { struct uart_port *port; int i; for (i = 0; i < siu_uart_driver.nr; i++) { port = &siu_uart_ports[i]; - if (port->dev == &dev->dev) { + if (port->dev == dev) { uart_remove_one_port(&siu_uart_driver, port); port->dev = NULL; } @@ -976,7 +976,7 @@ static int siu_remove(struct platform_device *dev) return 0; } -static int siu_suspend(struct platform_device *dev, pm_message_t state) +static int siu_suspend(struct device *dev, pm_message_t state) { struct uart_port *port; int i; @@ -984,7 +984,7 @@ static int siu_suspend(struct platform_device *dev, pm_message_t state) for (i = 0; i < siu_uart_driver.nr; i++) { port = &siu_uart_ports[i]; if ((port->type == PORT_VR41XX_SIU || - port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) + port->type == PORT_VR41XX_DSIU) && port->dev == dev) uart_suspend_port(&siu_uart_driver, port); } @@ -992,7 +992,7 @@ static int siu_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int siu_resume(struct platform_device *dev) +static int siu_resume(struct device *dev) { struct uart_port *port; int i; @@ -1000,7 +1000,7 @@ static int siu_resume(struct platform_device *dev) for (i = 0; i < siu_uart_driver.nr; i++) { port = &siu_uart_ports[i]; if ((port->type == PORT_VR41XX_SIU || - port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev) + port->type == PORT_VR41XX_DSIU) && port->dev == dev) uart_resume_port(&siu_uart_driver, port); } @@ -1009,14 +1009,13 @@ static int siu_resume(struct platform_device *dev) static struct platform_device *siu_platform_device; -static struct platform_driver siu_device_driver = { +static struct device_driver siu_device_driver = { + .name = "SIU", + .bus = &platform_bus_type, .probe = siu_probe, .remove = siu_remove, .suspend = siu_suspend, .resume = siu_resume, - .driver = { - .name = "SIU", - }, }; static int __devinit vr41xx_siu_init(void) @@ -1027,7 +1026,7 @@ static int __devinit vr41xx_siu_init(void) if (IS_ERR(siu_platform_device)) return PTR_ERR(siu_platform_device); - retval = platform_driver_register(&siu_device_driver); + retval = driver_register(&siu_device_driver); if (retval < 0) platform_device_unregister(siu_platform_device); @@ -1036,7 +1035,7 @@ static int __devinit vr41xx_siu_init(void) static void __devexit vr41xx_siu_exit(void) { - platform_driver_unregister(&siu_device_driver); + driver_unregister(&siu_device_driver); platform_device_unregister(siu_platform_device); } diff --git a/trunk/drivers/usb/gadget/dummy_hcd.c b/trunk/drivers/usb/gadget/dummy_hcd.c index 1e407745c115..904519085334 100644 --- a/trunk/drivers/usb/gadget/dummy_hcd.c +++ b/trunk/drivers/usb/gadget/dummy_hcd.c @@ -896,7 +896,7 @@ dummy_gadget_release (struct device *dev) #endif } -static int dummy_udc_probe (struct platform_device *dev) +static int dummy_udc_probe (struct device *dev) { struct dummy *dum = the_controller; int rc; @@ -909,7 +909,7 @@ static int dummy_udc_probe (struct platform_device *dev) dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); strcpy (dum->gadget.dev.bus_id, "gadget"); - dum->gadget.dev.parent = &dev->dev; + dum->gadget.dev.parent = dev; dum->gadget.dev.release = dummy_gadget_release; rc = device_register (&dum->gadget.dev); if (rc < 0) @@ -919,26 +919,26 @@ static int dummy_udc_probe (struct platform_device *dev) usb_bus_get (&dummy_to_hcd (dum)->self); #endif - platform_set_drvdata (dev, dum); + dev_set_drvdata (dev, dum); device_create_file (&dum->gadget.dev, &dev_attr_function); return rc; } -static int dummy_udc_remove (struct platform_device *dev) +static int dummy_udc_remove (struct device *dev) { - struct dummy *dum = platform_get_drvdata (dev); + struct dummy *dum = dev_get_drvdata (dev); - platform_set_drvdata (dev, NULL); + dev_set_drvdata (dev, NULL); device_remove_file (&dum->gadget.dev, &dev_attr_function); device_unregister (&dum->gadget.dev); return 0; } -static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state) +static int dummy_udc_suspend (struct device *dev, pm_message_t state) { - struct dummy *dum = platform_get_drvdata(dev); + struct dummy *dum = dev_get_drvdata(dev); - dev_dbg (&dev->dev, "%s\n", __FUNCTION__); + dev_dbg (dev, "%s\n", __FUNCTION__); spin_lock_irq (&dum->lock); dum->udc_suspended = 1; set_link_state (dum); @@ -949,30 +949,29 @@ static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state) return 0; } -static int dummy_udc_resume (struct platform_device *dev) +static int dummy_udc_resume (struct device *dev) { - struct dummy *dum = platform_get_drvdata(dev); + struct dummy *dum = dev_get_drvdata(dev); - dev_dbg (&dev->dev, "%s\n", __FUNCTION__); + dev_dbg (dev, "%s\n", __FUNCTION__); spin_lock_irq (&dum->lock); dum->udc_suspended = 0; set_link_state (dum); spin_unlock_irq (&dum->lock); - dev->dev.power.power_state = PMSG_ON; + dev->power.power_state = PMSG_ON; usb_hcd_poll_rh_status (dummy_to_hcd (dum)); return 0; } -static struct platform_driver dummy_udc_driver = { +static struct device_driver dummy_udc_driver = { + .name = (char *) gadget_name, + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = dummy_udc_probe, .remove = dummy_udc_remove, .suspend = dummy_udc_suspend, .resume = dummy_udc_resume, - .driver = { - .name = (char *) gadget_name, - .owner = THIS_MODULE, - }, }; /*-------------------------------------------------------------------------*/ @@ -1899,14 +1898,14 @@ static const struct hc_driver dummy_hcd = { .bus_resume = dummy_bus_resume, }; -static int dummy_hcd_probe (struct platform_device *dev) +static int dummy_hcd_probe (struct device *dev) { struct usb_hcd *hcd; int retval; dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); - hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id); + hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id); if (!hcd) return -ENOMEM; the_controller = hcd_to_dummy (hcd); @@ -1919,49 +1918,48 @@ static int dummy_hcd_probe (struct platform_device *dev) return retval; } -static int dummy_hcd_remove (struct platform_device *dev) +static int dummy_hcd_remove (struct device *dev) { struct usb_hcd *hcd; - hcd = platform_get_drvdata (dev); + hcd = dev_get_drvdata (dev); usb_remove_hcd (hcd); usb_put_hcd (hcd); the_controller = NULL; return 0; } -static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state) +static int dummy_hcd_suspend (struct device *dev, pm_message_t state) { struct usb_hcd *hcd; - dev_dbg (&dev->dev, "%s\n", __FUNCTION__); - hcd = platform_get_drvdata (dev); + dev_dbg (dev, "%s\n", __FUNCTION__); + hcd = dev_get_drvdata (dev); hcd->state = HC_STATE_SUSPENDED; return 0; } -static int dummy_hcd_resume (struct platform_device *dev) +static int dummy_hcd_resume (struct device *dev) { struct usb_hcd *hcd; - dev_dbg (&dev->dev, "%s\n", __FUNCTION__); - hcd = platform_get_drvdata (dev); + dev_dbg (dev, "%s\n", __FUNCTION__); + hcd = dev_get_drvdata (dev); hcd->state = HC_STATE_RUNNING; usb_hcd_poll_rh_status (hcd); return 0; } -static struct platform_driver dummy_hcd_driver = { +static struct device_driver dummy_hcd_driver = { + .name = (char *) driver_name, + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = dummy_hcd_probe, .remove = dummy_hcd_remove, .suspend = dummy_hcd_suspend, .resume = dummy_hcd_resume, - .driver = { - .name = (char *) driver_name, - .owner = THIS_MODULE, - }, }; /*-------------------------------------------------------------------------*/ @@ -1997,11 +1995,11 @@ static int __init init (void) if (usb_disabled ()) return -ENODEV; - retval = platform_driver_register (&dummy_hcd_driver); + retval = driver_register (&dummy_hcd_driver); if (retval < 0) return retval; - retval = platform_driver_register (&dummy_udc_driver); + retval = driver_register (&dummy_udc_driver); if (retval < 0) goto err_register_udc_driver; @@ -2017,9 +2015,9 @@ static int __init init (void) err_register_udc: platform_device_unregister (&the_hcd_pdev); err_register_hcd: - platform_driver_unregister (&dummy_udc_driver); + driver_unregister (&dummy_udc_driver); err_register_udc_driver: - platform_driver_unregister (&dummy_hcd_driver); + driver_unregister (&dummy_hcd_driver); return retval; } module_init (init); @@ -2028,7 +2026,7 @@ static void __exit cleanup (void) { platform_device_unregister (&the_udc_pdev); platform_device_unregister (&the_hcd_pdev); - platform_driver_unregister (&dummy_udc_driver); - platform_driver_unregister (&dummy_hcd_driver); + driver_unregister (&dummy_udc_driver); + driver_unregister (&dummy_hcd_driver); } module_exit (cleanup); diff --git a/trunk/drivers/usb/gadget/lh7a40x_udc.c b/trunk/drivers/usb/gadget/lh7a40x_udc.c index e02fea5a5433..bc6269f10cbb 100644 --- a/trunk/drivers/usb/gadget/lh7a40x_udc.c +++ b/trunk/drivers/usb/gadget/lh7a40x_udc.c @@ -2085,21 +2085,21 @@ static struct lh7a40x_udc memory = { /* * probe - binds to the platform device */ -static int lh7a40x_udc_probe(struct platform_device *pdev) +static int lh7a40x_udc_probe(struct device *_dev) { struct lh7a40x_udc *dev = &memory; int retval; - DEBUG("%s: %p\n", __FUNCTION__, pdev); + DEBUG("%s: %p\n", __FUNCTION__, _dev); spin_lock_init(&dev->lock); - dev->dev = &pdev->dev; + dev->dev = _dev; device_initialize(&dev->gadget.dev); - dev->gadget.dev.parent = &pdev->dev; + dev->gadget.dev.parent = _dev; the_controller = dev; - platform_set_drvdata(pdev, dev); + dev_set_drvdata(_dev, dev); udc_disable(dev); udc_reinit(dev); @@ -2119,11 +2119,11 @@ static int lh7a40x_udc_probe(struct platform_device *pdev) return retval; } -static int lh7a40x_udc_remove(struct platform_device *pdev) +static int lh7a40x_udc_remove(struct device *_dev) { - struct lh7a40x_udc *dev = platform_get_drvdata(pdev); + struct lh7a40x_udc *dev = _dev->driver_data; - DEBUG("%s: %p\n", __FUNCTION__, pdev); + DEBUG("%s: %p\n", __FUNCTION__, dev); udc_disable(dev); remove_proc_files(); @@ -2131,7 +2131,7 @@ static int lh7a40x_udc_remove(struct platform_device *pdev) free_irq(IRQ_USBINTR, dev); - platform_set_drvdata(pdev, 0); + dev_set_drvdata(_dev, 0); the_controller = 0; @@ -2140,27 +2140,26 @@ static int lh7a40x_udc_remove(struct platform_device *pdev) /*-------------------------------------------------------------------------*/ -static struct platform_driver udc_driver = { +static struct device_driver udc_driver = { + .name = (char *)driver_name, + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = lh7a40x_udc_probe, .remove = lh7a40x_udc_remove /* FIXME power management support */ /* .suspend = ... disable UDC */ /* .resume = ... re-enable UDC */ - .driver = { - .name = (char *)driver_name, - .owner = THIS_MODULE, - }, }; static int __init udc_init(void) { DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); - return platform_driver_register(&udc_driver); + return driver_register(&udc_driver); } static void __exit udc_exit(void) { - platform_driver_unregister(&udc_driver); + driver_unregister(&udc_driver); } module_init(udc_init); diff --git a/trunk/drivers/usb/gadget/omap_udc.c b/trunk/drivers/usb/gadget/omap_udc.c index a8972d7c97be..387692a3611e 100644 --- a/trunk/drivers/usb/gadget/omap_udc.c +++ b/trunk/drivers/usb/gadget/omap_udc.c @@ -2707,17 +2707,18 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv) return 0; } -static int __init omap_udc_probe(struct platform_device *pdev) +static int __init omap_udc_probe(struct device *dev) { + struct platform_device *odev = to_platform_device(dev); int status = -ENODEV; int hmc; struct otg_transceiver *xceiv = NULL; const char *type = NULL; - struct omap_usb_config *config = pdev->dev.platform_data; + struct omap_usb_config *config = dev->platform_data; /* NOTE: "knows" the order of the resources! */ - if (!request_mem_region(pdev->resource[0].start, - pdev->resource[0].end - pdev->resource[0].start + 1, + if (!request_mem_region(odev->resource[0].start, + odev->resource[0].end - odev->resource[0].start + 1, driver_name)) { DBG("request_mem_region failed\n"); return -EBUSY; @@ -2802,7 +2803,7 @@ static int __init omap_udc_probe(struct platform_device *pdev) INFO("hmc mode %d, %s transceiver\n", hmc, type); /* a "gadget" abstracts/virtualizes the controller */ - status = omap_udc_setup(pdev, xceiv); + status = omap_udc_setup(odev, xceiv); if (status) { goto cleanup0; } @@ -2820,28 +2821,28 @@ static int __init omap_udc_probe(struct platform_device *pdev) udc->clr_halt = UDC_RESET_EP; /* USB general purpose IRQ: ep0, state changes, dma, etc */ - status = request_irq(pdev->resource[1].start, omap_udc_irq, + status = request_irq(odev->resource[1].start, omap_udc_irq, SA_SAMPLE_RANDOM, driver_name, udc); if (status != 0) { ERR( "can't get irq %ld, err %d\n", - pdev->resource[1].start, status); + odev->resource[1].start, status); goto cleanup1; } /* USB "non-iso" IRQ (PIO for all but ep0) */ - status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, + status = request_irq(odev->resource[2].start, omap_udc_pio_irq, SA_SAMPLE_RANDOM, "omap_udc pio", udc); if (status != 0) { ERR( "can't get irq %ld, err %d\n", - pdev->resource[2].start, status); + odev->resource[2].start, status); goto cleanup2; } #ifdef USE_ISO - status = request_irq(pdev->resource[3].start, omap_udc_iso_irq, + status = request_irq(odev->resource[3].start, omap_udc_iso_irq, SA_INTERRUPT, "omap_udc iso", udc); if (status != 0) { ERR("can't get irq %ld, err %d\n", - pdev->resource[3].start, status); + odev->resource[3].start, status); goto cleanup3; } #endif @@ -2852,11 +2853,11 @@ static int __init omap_udc_probe(struct platform_device *pdev) #ifdef USE_ISO cleanup3: - free_irq(pdev->resource[2].start, udc); + free_irq(odev->resource[2].start, udc); #endif cleanup2: - free_irq(pdev->resource[1].start, udc); + free_irq(odev->resource[1].start, udc); cleanup1: kfree (udc); @@ -2865,13 +2866,14 @@ static int __init omap_udc_probe(struct platform_device *pdev) cleanup0: if (xceiv) put_device(xceiv->dev); - release_mem_region(pdev->resource[0].start, - pdev->resource[0].end - pdev->resource[0].start + 1); + release_mem_region(odev->resource[0].start, + odev->resource[0].end - odev->resource[0].start + 1); return status; } -static int __exit omap_udc_remove(struct platform_device *pdev) +static int __exit omap_udc_remove(struct device *dev) { + struct platform_device *odev = to_platform_device(dev); DECLARE_COMPLETION(done); if (!udc) @@ -2889,13 +2891,13 @@ static int __exit omap_udc_remove(struct platform_device *pdev) remove_proc_file(); #ifdef USE_ISO - free_irq(pdev->resource[3].start, udc); + free_irq(odev->resource[3].start, udc); #endif - free_irq(pdev->resource[2].start, udc); - free_irq(pdev->resource[1].start, udc); + free_irq(odev->resource[2].start, udc); + free_irq(odev->resource[1].start, udc); - release_mem_region(pdev->resource[0].start, - pdev->resource[0].end - pdev->resource[0].start + 1); + release_mem_region(odev->resource[0].start, + odev->resource[0].end - odev->resource[0].start + 1); device_unregister(&udc->gadget.dev); wait_for_completion(&done); @@ -2913,7 +2915,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev) * may involve talking to an external transceiver (e.g. isp1301). */ -static int omap_udc_suspend(struct platform_device *dev, pm_message_t message) +static int omap_udc_suspend(struct device *dev, pm_message_t message) { u32 devstat; @@ -2933,7 +2935,7 @@ static int omap_udc_suspend(struct platform_device *dev, pm_message_t message) return 0; } -static int omap_udc_resume(struct platform_device *dev) +static int omap_udc_resume(struct device *dev) { DBG("resume + wakeup/SRP\n"); omap_pullup(&udc->gadget, 1); @@ -2945,15 +2947,14 @@ static int omap_udc_resume(struct platform_device *dev) /*-------------------------------------------------------------------------*/ -static struct platform_driver udc_driver = { +static struct device_driver udc_driver = { + .name = (char *) driver_name, + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = omap_udc_probe, .remove = __exit_p(omap_udc_remove), .suspend = omap_udc_suspend, .resume = omap_udc_resume, - .driver = { - .owner = THIS_MODULE, - .name = (char *) driver_name, - }, }; static int __init udc_init(void) @@ -2964,13 +2965,13 @@ static int __init udc_init(void) #endif "%s\n", driver_desc, use_dma ? " (dma)" : ""); - return platform_driver_register(&udc_driver); + return driver_register(&udc_driver); } module_init(udc_init); static void __exit udc_exit(void) { - platform_driver_unregister(&udc_driver); + driver_unregister(&udc_driver); } module_exit(udc_exit); diff --git a/trunk/drivers/usb/gadget/pxa2xx_udc.c b/trunk/drivers/usb/gadget/pxa2xx_udc.c index bb028c5b8952..510d28a924db 100644 --- a/trunk/drivers/usb/gadget/pxa2xx_udc.c +++ b/trunk/drivers/usb/gadget/pxa2xx_udc.c @@ -2432,7 +2432,7 @@ static struct pxa2xx_udc memory = { /* * probe - binds to the platform device */ -static int __init pxa2xx_udc_probe(struct platform_device *pdev) +static int __init pxa2xx_udc_probe(struct device *_dev) { struct pxa2xx_udc *dev = &memory; int retval, out_dma = 1; @@ -2495,19 +2495,19 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) #endif /* other non-static parts of init */ - dev->dev = &pdev->dev; - dev->mach = pdev->dev.platform_data; + dev->dev = _dev; + dev->mach = _dev->platform_data; init_timer(&dev->timer); dev->timer.function = udc_watchdog; dev->timer.data = (unsigned long) dev; device_initialize(&dev->gadget.dev); - dev->gadget.dev.parent = &pdev->dev; - dev->gadget.dev.dma_mask = pdev->dev.dma_mask; + dev->gadget.dev.parent = _dev; + dev->gadget.dev.dma_mask = _dev->dma_mask; the_controller = dev; - platform_set_drvdata(pdev, dev); + dev_set_drvdata(_dev, dev); udc_disable(dev); udc_reinit(dev); @@ -2559,14 +2559,14 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) return 0; } -static void pxa2xx_udc_shutdown(struct platform_device *_dev) +static void pxa2xx_udc_shutdown(struct device *_dev) { pullup_off(); } -static int __exit pxa2xx_udc_remove(struct platform_device *pdev) +static int __exit pxa2xx_udc_remove(struct device *_dev) { - struct pxa2xx_udc *dev = platform_get_drvdata(pdev); + struct pxa2xx_udc *dev = dev_get_drvdata(_dev); udc_disable(dev); remove_proc_files(); @@ -2580,7 +2580,7 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev) free_irq(LUBBOCK_USB_DISC_IRQ, dev); free_irq(LUBBOCK_USB_IRQ, dev); } - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(_dev, NULL); the_controller = NULL; return 0; } @@ -2601,9 +2601,9 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev) * VBUS IRQs should probably be ignored so that the PXA device just acts * "dead" to USB hosts until system resume. */ -static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) +static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) { - struct pxa2xx_udc *udc = platform_get_drvdata(dev); + struct pxa2xx_udc *udc = dev_get_drvdata(dev); if (!udc->mach->udc_command) WARN("USB host won't detect disconnect!\n"); @@ -2612,9 +2612,9 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int pxa2xx_udc_resume(struct platform_device *dev) +static int pxa2xx_udc_resume(struct device *dev) { - struct pxa2xx_udc *udc = platform_get_drvdata(dev); + struct pxa2xx_udc *udc = dev_get_drvdata(dev); pullup(udc, 1); @@ -2628,28 +2628,27 @@ static int pxa2xx_udc_resume(struct platform_device *dev) /*-------------------------------------------------------------------------*/ -static struct platform_driver udc_driver = { +static struct device_driver udc_driver = { + .name = "pxa2xx-udc", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = pxa2xx_udc_probe, .shutdown = pxa2xx_udc_shutdown, .remove = __exit_p(pxa2xx_udc_remove), .suspend = pxa2xx_udc_suspend, .resume = pxa2xx_udc_resume, - .driver = { - .owner = THIS_MODULE, - .name = "pxa2xx-udc", - }, }; static int __init udc_init(void) { printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); - return platform_driver_register(&udc_driver); + return driver_register(&udc_driver); } module_init(udc_init); static void __exit udc_exit(void) { - platform_driver_unregister(&udc_driver); + driver_unregister(&udc_driver); } module_exit(udc_exit); diff --git a/trunk/drivers/usb/host/isp116x-hcd.c b/trunk/drivers/usb/host/isp116x-hcd.c index 82f64986bc22..f9c3f5b8dd1c 100644 --- a/trunk/drivers/usb/host/isp116x-hcd.c +++ b/trunk/drivers/usb/host/isp116x-hcd.c @@ -1633,15 +1633,17 @@ static struct hc_driver isp116x_hc_driver = { /*----------------------------------------------------------------*/ -static int __init_or_module isp116x_remove(struct platform_device *pdev) +static int __init_or_module isp116x_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct usb_hcd *hcd = dev_get_drvdata(dev); struct isp116x *isp116x; + struct platform_device *pdev; struct resource *res; if (!hcd) return 0; isp116x = hcd_to_isp116x(hcd); + pdev = container_of(dev, struct platform_device, dev); remove_debug_file(isp116x); usb_remove_hcd(hcd); @@ -1658,16 +1660,18 @@ static int __init_or_module isp116x_remove(struct platform_device *pdev) #define resource_len(r) (((r)->end - (r)->start) + 1) -static int __init isp116x_probe(struct platform_device *pdev) +static int __init isp116x_probe(struct device *dev) { struct usb_hcd *hcd; struct isp116x *isp116x; + struct platform_device *pdev; struct resource *addr, *data; void __iomem *addr_reg; void __iomem *data_reg; int irq; int ret = 0; + pdev = container_of(dev, struct platform_device, dev); if (pdev->num_resources < 3) { ret = -ENODEV; goto err1; @@ -1681,7 +1685,7 @@ static int __init isp116x_probe(struct platform_device *pdev) goto err1; } - if (pdev->dev.dma_mask) { + if (dev->dma_mask) { DBG("DMA not supported\n"); ret = -EINVAL; goto err1; @@ -1707,7 +1711,7 @@ static int __init isp116x_probe(struct platform_device *pdev) } /* allocate and initialize hcd */ - hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, pdev->dev.bus_id); + hcd = usb_create_hcd(&isp116x_hc_driver, dev, dev->bus_id); if (!hcd) { ret = -ENOMEM; goto err5; @@ -1719,7 +1723,7 @@ static int __init isp116x_probe(struct platform_device *pdev) isp116x->addr_reg = addr_reg; spin_lock_init(&isp116x->lock); INIT_LIST_HEAD(&isp116x->async); - isp116x->board = pdev->dev.platform_data; + isp116x->board = dev->platform_data; if (!isp116x->board) { ERR("Platform data structure not initialized\n"); @@ -1760,13 +1764,13 @@ static int __init isp116x_probe(struct platform_device *pdev) /* Suspend of platform device */ -static int isp116x_suspend(struct platform_device *dev, pm_message_t state) +static int isp116x_suspend(struct device *dev, pm_message_t state) { int ret = 0; VDBG("%s: state %x\n", __func__, state); - dev->dev.power.power_state = state; + dev->power.power_state = state; return ret; } @@ -1774,13 +1778,13 @@ static int isp116x_suspend(struct platform_device *dev, pm_message_t state) /* Resume platform device */ -static int isp116x_resume(struct platform_device *dev) +static int isp116x_resume(struct device *dev) { int ret = 0; - VDBG("%s: state %x\n", __func__, dev->dev.power.power_state); + VDBG("%s: state %x\n", __func__, dev->power.power_state); - dev->dev.power.power_state = PMSG_ON; + dev->power.power_state = PMSG_ON; return ret; } @@ -1792,14 +1796,13 @@ static int isp116x_resume(struct platform_device *dev) #endif -static struct platform_driver isp116x_driver = { +static struct device_driver isp116x_driver = { + .name = (char *)hcd_name, + .bus = &platform_bus_type, .probe = isp116x_probe, .remove = isp116x_remove, .suspend = isp116x_suspend, .resume = isp116x_resume, - .driver = { - .name = (char *)hcd_name, - }, }; /*-----------------------------------------------------------------*/ @@ -1810,14 +1813,14 @@ static int __init isp116x_init(void) return -ENODEV; INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); - return platform_driver_register(&isp116x_driver); + return driver_register(&isp116x_driver); } module_init(isp116x_init); static void __exit isp116x_cleanup(void) { - platform_driver_unregister(&isp116x_driver); + driver_unregister(&isp116x_driver); } module_exit(isp116x_cleanup); diff --git a/trunk/drivers/usb/host/ohci-au1xxx.c b/trunk/drivers/usb/host/ohci-au1xxx.c index d9cf3b327d96..f0c78cf14b6c 100644 --- a/trunk/drivers/usb/host/ohci-au1xxx.c +++ b/trunk/drivers/usb/host/ohci-au1xxx.c @@ -225,8 +225,9 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { /*-------------------------------------------------------------------------*/ -static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev) +static int ohci_hcd_au1xxx_drv_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); int ret; pr_debug ("In ohci_hcd_au1xxx_drv_probe"); @@ -238,37 +239,39 @@ static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev) return ret; } -static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev) +static int ohci_hcd_au1xxx_drv_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); usb_hcd_au1xxx_remove(hcd, pdev); return 0; } /*TBD*/ -/*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev) +/*static int ohci_hcd_au1xxx_drv_suspend(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); return 0; } -static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev) +static int ohci_hcd_au1xxx_drv_resume(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); return 0; } */ -static struct platform_driver ohci_hcd_au1xxx_driver = { +static struct device_driver ohci_hcd_au1xxx_driver = { + .name = "au1xxx-ohci", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = ohci_hcd_au1xxx_drv_probe, .remove = ohci_hcd_au1xxx_drv_remove, /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ /*.resume = ohci_hcd_au1xxx_drv_resume, */ - .driver = { - .name = "au1xxx-ohci", - .owner = THIS_MODULE, - }, }; static int __init ohci_hcd_au1xxx_init (void) @@ -277,12 +280,12 @@ static int __init ohci_hcd_au1xxx_init (void) pr_debug ("block sizes: ed %d td %d\n", sizeof (struct ed), sizeof (struct td)); - return platform_driver_register(&ohci_hcd_au1xxx_driver); + return driver_register(&ohci_hcd_au1xxx_driver); } static void __exit ohci_hcd_au1xxx_cleanup (void) { - platform_driver_unregister(&ohci_hcd_au1xxx_driver); + driver_unregister(&ohci_hcd_au1xxx_driver); } module_init (ohci_hcd_au1xxx_init); diff --git a/trunk/drivers/usb/host/ohci-lh7a404.c b/trunk/drivers/usb/host/ohci-lh7a404.c index 081ec3f5cff4..336c766c6e29 100644 --- a/trunk/drivers/usb/host/ohci-lh7a404.c +++ b/trunk/drivers/usb/host/ohci-lh7a404.c @@ -204,8 +204,9 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { /*-------------------------------------------------------------------------*/ -static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev) +static int ohci_hcd_lh7a404_drv_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); int ret; pr_debug ("In ohci_hcd_lh7a404_drv_probe"); @@ -217,38 +218,40 @@ static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev) return ret; } -static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev) +static int ohci_hcd_lh7a404_drv_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); usb_hcd_lh7a404_remove(hcd, pdev); return 0; } /*TBD*/ -/*static int ohci_hcd_lh7a404_drv_suspend(struct platform_device *dev) +/*static int ohci_hcd_lh7a404_drv_suspend(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); return 0; } -static int ohci_hcd_lh7a404_drv_resume(struct platform_device *dev) +static int ohci_hcd_lh7a404_drv_resume(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); return 0; } */ -static struct platform_driver ohci_hcd_lh7a404_driver = { +static struct device_driver ohci_hcd_lh7a404_driver = { + .name = "lh7a404-ohci", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = ohci_hcd_lh7a404_drv_probe, .remove = ohci_hcd_lh7a404_drv_remove, /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ /*.resume = ohci_hcd_lh7a404_drv_resume, */ - .driver = { - .name = "lh7a404-ohci", - .owner = THIS_MODULE, - }, }; static int __init ohci_hcd_lh7a404_init (void) @@ -257,12 +260,12 @@ static int __init ohci_hcd_lh7a404_init (void) pr_debug ("block sizes: ed %d td %d\n", sizeof (struct ed), sizeof (struct td)); - return platform_driver_register(&ohci_hcd_lh7a404_driver); + return driver_register(&ohci_hcd_lh7a404_driver); } static void __exit ohci_hcd_lh7a404_cleanup (void) { - platform_driver_unregister(&ohci_hcd_lh7a404_driver); + driver_unregister(&ohci_hcd_lh7a404_driver); } module_init (ohci_hcd_lh7a404_init); diff --git a/trunk/drivers/usb/host/ohci-omap.c b/trunk/drivers/usb/host/ohci-omap.c index c9e29d808711..e46cc540cf4d 100644 --- a/trunk/drivers/usb/host/ohci-omap.c +++ b/trunk/drivers/usb/host/ohci-omap.c @@ -433,22 +433,24 @@ static const struct hc_driver ohci_omap_hc_driver = { /*-------------------------------------------------------------------------*/ -static int ohci_hcd_omap_drv_probe(struct platform_device *dev) +static int ohci_hcd_omap_drv_probe(struct device *dev) { - return usb_hcd_omap_probe(&ohci_omap_hc_driver, dev); + return usb_hcd_omap_probe(&ohci_omap_hc_driver, + to_platform_device(dev)); } -static int ohci_hcd_omap_drv_remove(struct platform_device *dev) +static int ohci_hcd_omap_drv_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); struct ohci_hcd *ohci = hcd_to_ohci (hcd); - usb_hcd_omap_remove(hcd, dev); + usb_hcd_omap_remove(hcd, pdev); if (ohci->transceiver) { (void) otg_set_host(ohci->transceiver, 0); put_device(ohci->transceiver->dev); } - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); return 0; } @@ -457,9 +459,9 @@ static int ohci_hcd_omap_drv_remove(struct platform_device *dev) #ifdef CONFIG_PM -static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) +static int ohci_omap_suspend(struct device *dev, pm_message_t message) { - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); + struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); if (time_before(jiffies, ohci->next_statechange)) msleep(5); @@ -471,9 +473,9 @@ static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message) return 0; } -static int ohci_omap_resume(struct platform_device *dev) +static int ohci_omap_resume(struct device *dev) { - struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev)); + struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); if (time_before(jiffies, ohci->next_statechange)) msleep(5); @@ -492,17 +494,16 @@ static int ohci_omap_resume(struct platform_device *dev) /* * Driver definition to register with the OMAP bus */ -static struct platform_driver ohci_hcd_omap_driver = { +static struct device_driver ohci_hcd_omap_driver = { + .name = "ohci", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = ohci_hcd_omap_drv_probe, .remove = ohci_hcd_omap_drv_remove, #ifdef CONFIG_PM .suspend = ohci_omap_suspend, .resume = ohci_omap_resume, #endif - .driver = { - .owner = THIS_MODULE, - .name = "ohci", - }, }; static int __init ohci_hcd_omap_init (void) @@ -514,12 +515,12 @@ static int __init ohci_hcd_omap_init (void) pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name, sizeof (struct ed), sizeof (struct td)); - return platform_driver_register(&ohci_hcd_omap_driver); + return driver_register(&ohci_hcd_omap_driver); } static void __exit ohci_hcd_omap_cleanup (void) { - platform_driver_unregister(&ohci_hcd_omap_driver); + driver_unregister(&ohci_hcd_omap_driver); } module_init (ohci_hcd_omap_init); diff --git a/trunk/drivers/usb/host/ohci-ppc-soc.c b/trunk/drivers/usb/host/ohci-ppc-soc.c index 18755766e406..92cf6f4a1374 100644 --- a/trunk/drivers/usb/host/ohci-ppc-soc.c +++ b/trunk/drivers/usb/host/ohci-ppc-soc.c @@ -172,8 +172,9 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { .start_port_reset = ohci_start_port_reset, }; -static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) +static int ohci_hcd_ppc_soc_drv_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); int ret; if (usb_disabled()) @@ -183,25 +184,25 @@ static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) return ret; } -static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) +static int ohci_hcd_ppc_soc_drv_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); usb_hcd_ppc_soc_remove(hcd, pdev); return 0; } -static struct platform_driver ohci_hcd_ppc_soc_driver = { +static struct device_driver ohci_hcd_ppc_soc_driver = { + .name = "ppc-soc-ohci", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = ohci_hcd_ppc_soc_drv_probe, .remove = ohci_hcd_ppc_soc_drv_remove, #ifdef CONFIG_PM /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ #endif - .driver = { - .name = "ppc-soc-ohci", - .owner = THIS_MODULE, - }, }; static int __init ohci_hcd_ppc_soc_init(void) @@ -210,12 +211,12 @@ static int __init ohci_hcd_ppc_soc_init(void) pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed), sizeof(struct td)); - return platform_driver_register(&ohci_hcd_ppc_soc_driver); + return driver_register(&ohci_hcd_ppc_soc_driver); } static void __exit ohci_hcd_ppc_soc_cleanup(void) { - platform_driver_unregister(&ohci_hcd_ppc_soc_driver); + driver_unregister(&ohci_hcd_ppc_soc_driver); } module_init(ohci_hcd_ppc_soc_init); diff --git a/trunk/drivers/usb/host/ohci-pxa27x.c b/trunk/drivers/usb/host/ohci-pxa27x.c index 9d65ec307990..59e20568e8f9 100644 --- a/trunk/drivers/usb/host/ohci-pxa27x.c +++ b/trunk/drivers/usb/host/ohci-pxa27x.c @@ -290,8 +290,9 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { /*-------------------------------------------------------------------------*/ -static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev) +static int ohci_hcd_pxa27x_drv_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); int ret; pr_debug ("In ohci_hcd_pxa27x_drv_probe"); @@ -303,39 +304,41 @@ static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev) return ret; } -static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) +static int ohci_hcd_pxa27x_drv_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); usb_hcd_pxa27x_remove(hcd, pdev); return 0; } -static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *dev, pm_message_t state) +static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state) { -// struct usb_hcd *hcd = platform_get_drvdata(dev); +// struct platform_device *pdev = to_platform_device(dev); +// struct usb_hcd *hcd = dev_get_drvdata(dev); printk("%s: not implemented yet\n", __FUNCTION__); return 0; } -static int ohci_hcd_pxa27x_drv_resume(struct platform_device *dev) +static int ohci_hcd_pxa27x_drv_resume(struct device *dev) { -// struct usb_hcd *hcd = platform_get_drvdata(dev); +// struct platform_device *pdev = to_platform_device(dev); +// struct usb_hcd *hcd = dev_get_drvdata(dev); printk("%s: not implemented yet\n", __FUNCTION__); return 0; } -static struct platform_driver ohci_hcd_pxa27x_driver = { +static struct device_driver ohci_hcd_pxa27x_driver = { + .name = "pxa27x-ohci", + .bus = &platform_bus_type, .probe = ohci_hcd_pxa27x_drv_probe, .remove = ohci_hcd_pxa27x_drv_remove, .suspend = ohci_hcd_pxa27x_drv_suspend, - .resume = ohci_hcd_pxa27x_drv_resume, - .driver = { - .name = "pxa27x-ohci", - }, + .resume = ohci_hcd_pxa27x_drv_resume, }; static int __init ohci_hcd_pxa27x_init (void) @@ -344,12 +347,12 @@ static int __init ohci_hcd_pxa27x_init (void) pr_debug ("block sizes: ed %d td %d\n", sizeof (struct ed), sizeof (struct td)); - return platform_driver_register(&ohci_hcd_pxa27x_driver); + return driver_register(&ohci_hcd_pxa27x_driver); } static void __exit ohci_hcd_pxa27x_cleanup (void) { - platform_driver_unregister(&ohci_hcd_pxa27x_driver); + driver_unregister(&ohci_hcd_pxa27x_driver); } module_init (ohci_hcd_pxa27x_init); diff --git a/trunk/drivers/usb/host/ohci-s3c2410.c b/trunk/drivers/usb/host/ohci-s3c2410.c index 35cc9402adc0..ee1fc605b402 100644 --- a/trunk/drivers/usb/host/ohci-s3c2410.c +++ b/trunk/drivers/usb/host/ohci-s3c2410.c @@ -459,38 +459,39 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { /* device driver */ -static int ohci_hcd_s3c2410_drv_probe(struct platform_device *pdev) +static int ohci_hcd_s3c2410_drv_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); } -static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev) +static int ohci_hcd_s3c2410_drv_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); usb_hcd_s3c2410_remove(hcd, pdev); return 0; } -static struct platform_driver ohci_hcd_s3c2410_driver = { +static struct device_driver ohci_hcd_s3c2410_driver = { + .name = "s3c2410-ohci", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = ohci_hcd_s3c2410_drv_probe, .remove = ohci_hcd_s3c2410_drv_remove, /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ /*.resume = ohci_hcd_s3c2410_drv_resume, */ - .driver = { - .owner = THIS_MODULE, - .name = "s3c2410-ohci", - }, }; static int __init ohci_hcd_s3c2410_init (void) { - return platform_driver_register(&ohci_hcd_s3c2410_driver); + return driver_register(&ohci_hcd_s3c2410_driver); } static void __exit ohci_hcd_s3c2410_cleanup (void) { - platform_driver_unregister(&ohci_hcd_s3c2410_driver); + driver_unregister(&ohci_hcd_s3c2410_driver); } module_init (ohci_hcd_s3c2410_init); diff --git a/trunk/drivers/usb/host/sl811-hcd.c b/trunk/drivers/usb/host/sl811-hcd.c index a7722a6a5a5b..5607c0ae6835 100644 --- a/trunk/drivers/usb/host/sl811-hcd.c +++ b/trunk/drivers/usb/host/sl811-hcd.c @@ -1631,21 +1631,24 @@ static struct hc_driver sl811h_hc_driver = { /*-------------------------------------------------------------------------*/ static int __devexit -sl811h_remove(struct platform_device *dev) +sl811h_remove(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); struct sl811 *sl811 = hcd_to_sl811(hcd); + struct platform_device *pdev; struct resource *res; + pdev = container_of(dev, struct platform_device, dev); + remove_debug_file(sl811); usb_remove_hcd(hcd); /* some platforms may use IORESOURCE_IO */ - res = platform_get_resource(dev, IORESOURCE_MEM, 1); + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (res) iounmap(sl811->data_reg); - res = platform_get_resource(dev, IORESOURCE_MEM, 0); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res) iounmap(sl811->addr_reg); @@ -1654,10 +1657,11 @@ sl811h_remove(struct platform_device *dev) } static int __devinit -sl811h_probe(struct platform_device *dev) +sl811h_probe(struct device *dev) { struct usb_hcd *hcd; struct sl811 *sl811; + struct platform_device *pdev; struct resource *addr, *data; int irq; void __iomem *addr_reg; @@ -1670,23 +1674,24 @@ sl811h_probe(struct platform_device *dev) * specific platform_data. we don't probe for IRQs, and do only * minimal sanity checking. */ - irq = platform_get_irq(dev, 0); - if (dev->num_resources < 3 || irq < 0) + pdev = container_of(dev, struct platform_device, dev); + irq = platform_get_irq(pdev, 0); + if (pdev->num_resources < 3 || irq < 0) return -ENODEV; /* refuse to confuse usbcore */ - if (dev->dev.dma_mask) { + if (dev->dma_mask) { DBG("no we won't dma\n"); return -EINVAL; } /* the chip may be wired for either kind of addressing */ - addr = platform_get_resource(dev, IORESOURCE_MEM, 0); - data = platform_get_resource(dev, IORESOURCE_MEM, 1); + addr = platform_get_resource(pdev, IORESOURCE_MEM, 0); + data = platform_get_resource(pdev, IORESOURCE_MEM, 1); retval = -EBUSY; if (!addr || !data) { - addr = platform_get_resource(dev, IORESOURCE_IO, 0); - data = platform_get_resource(dev, IORESOURCE_IO, 1); + addr = platform_get_resource(pdev, IORESOURCE_IO, 0); + data = platform_get_resource(pdev, IORESOURCE_IO, 1); if (!addr || !data) return -ENODEV; ioaddr = 1; @@ -1708,7 +1713,7 @@ sl811h_probe(struct platform_device *dev) } /* allocate and initialize hcd */ - hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id); + hcd = usb_create_hcd(&sl811h_hc_driver, dev, dev->bus_id); if (!hcd) { retval = -ENOMEM; goto err5; @@ -1718,7 +1723,7 @@ sl811h_probe(struct platform_device *dev) spin_lock_init(&sl811->lock); INIT_LIST_HEAD(&sl811->async); - sl811->board = dev->dev.platform_data; + sl811->board = dev->platform_data; init_timer(&sl811->timer); sl811->timer.function = sl811h_timer; sl811->timer.data = (unsigned long) sl811; @@ -1780,9 +1785,9 @@ sl811h_probe(struct platform_device *dev) */ static int -sl811h_suspend(struct platform_device *dev, pm_message_t state) +sl811h_suspend(struct device *dev, pm_message_t state) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); struct sl811 *sl811 = hcd_to_sl811(hcd); int retval = 0; @@ -1791,27 +1796,27 @@ sl811h_suspend(struct platform_device *dev, pm_message_t state) else if (state.event == PM_EVENT_SUSPEND) port_power(sl811, 0); if (retval == 0) - dev->dev.power.power_state = state; + dev->power.power_state = state; return retval; } static int -sl811h_resume(struct platform_device *dev) +sl811h_resume(struct device *dev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = dev_get_drvdata(dev); struct sl811 *sl811 = hcd_to_sl811(hcd); /* with no "check to see if VBUS is still powered" board hook, * let's assume it'd only be powered to enable remote wakeup. */ - if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND + if (dev->power.power_state.event == PM_EVENT_SUSPEND || !hcd->can_wakeup) { sl811->port1 = 0; port_power(sl811, 1); return 0; } - dev->dev.power.power_state = PMSG_ON; + dev->power.power_state = PMSG_ON; return sl811h_bus_resume(hcd); } @@ -1824,16 +1829,16 @@ sl811h_resume(struct platform_device *dev) /* this driver is exported so sl811_cs can depend on it */ -struct platform_driver sl811h_driver = { +struct device_driver sl811h_driver = { + .name = (char *) hcd_name, + .bus = &platform_bus_type, + .owner = THIS_MODULE, + .probe = sl811h_probe, .remove = __devexit_p(sl811h_remove), .suspend = sl811h_suspend, .resume = sl811h_resume, - .driver = { - .name = (char *) hcd_name, - .owner = THIS_MODULE, - }, }; EXPORT_SYMBOL(sl811h_driver); @@ -1845,12 +1850,12 @@ static int __init sl811h_init(void) return -ENODEV; INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); - return platform_driver_register(&sl811h_driver); + return driver_register(&sl811h_driver); } module_init(sl811h_init); static void __exit sl811h_cleanup(void) { - platform_driver_unregister(&sl811h_driver); + driver_unregister(&sl811h_driver); } module_exit(sl811h_cleanup); diff --git a/trunk/drivers/video/acornfb.c b/trunk/drivers/video/acornfb.c index 750cebb18306..193b482570c7 100644 --- a/trunk/drivers/video/acornfb.c +++ b/trunk/drivers/video/acornfb.c @@ -1279,7 +1279,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) printk("acornfb: freed %dK memory\n", mb_freed); } -static int __init acornfb_probe(struct platform_device *dev) +static int __init acornfb_probe(struct device *dev) { unsigned long size; u_int h_sync, v_sync; @@ -1292,7 +1292,7 @@ static int __init acornfb_probe(struct platform_device *dev) acornfb_init_fbinfo(); - current_par.dev = &dev->dev; + current_par.dev = dev; if (current_par.montype == -1) current_par.montype = acornfb_detect_monitortype(); @@ -1453,16 +1453,15 @@ static int __init acornfb_probe(struct platform_device *dev) return 0; } -static struct platform_driver acornfb_driver = { +static struct device_driver acornfb_driver = { + .name = "acornfb", + .bus = &platform_bus_type, .probe = acornfb_probe, - .driver = { - .name = "acornfb", - }, }; static int __init acornfb_init(void) { - return platform_driver_register(&acornfb_driver); + return driver_register(&acornfb_driver); } module_init(acornfb_init); diff --git a/trunk/drivers/video/arcfb.c b/trunk/drivers/video/arcfb.c index 080db812ca48..a1fc8bbb1090 100644 --- a/trunk/drivers/video/arcfb.c +++ b/trunk/drivers/video/arcfb.c @@ -514,8 +514,9 @@ static struct fb_ops arcfb_ops = { .fb_ioctl = arcfb_ioctl, }; -static int __init arcfb_probe(struct platform_device *dev) +static int __init arcfb_probe(struct device *device) { + struct platform_device *dev = to_platform_device(device); struct fb_info *info; int retval = -ENOMEM; int videomemorysize; @@ -558,7 +559,7 @@ static int __init arcfb_probe(struct platform_device *dev) retval = register_framebuffer(info); if (retval < 0) goto err1; - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); if (irq) { par->irq = irq; if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ, @@ -599,9 +600,9 @@ static int __init arcfb_probe(struct platform_device *dev) return retval; } -static int arcfb_remove(struct platform_device *dev) +static int arcfb_remove(struct device *device) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(device); if (info) { unregister_framebuffer(info); @@ -611,12 +612,11 @@ static int arcfb_remove(struct platform_device *dev) return 0; } -static struct platform_driver arcfb_driver = { +static struct device_driver arcfb_driver = { + .name = "arcfb", + .bus = &platform_bus_type, .probe = arcfb_probe, .remove = arcfb_remove, - .driver = { - .name = "arcfb", - }, }; static struct platform_device *arcfb_device; @@ -628,7 +628,7 @@ static int __init arcfb_init(void) if (!arcfb_enable) return -ENXIO; - ret = platform_driver_register(&arcfb_driver); + ret = driver_register(&arcfb_driver); if (!ret) { arcfb_device = platform_device_alloc("arcfb", 0); if (arcfb_device) { @@ -638,7 +638,7 @@ static int __init arcfb_init(void) } if (ret) { platform_device_put(arcfb_device); - platform_driver_unregister(&arcfb_driver); + driver_unregister(&arcfb_driver); } } return ret; @@ -648,7 +648,7 @@ static int __init arcfb_init(void) static void __exit arcfb_exit(void) { platform_device_unregister(arcfb_device); - platform_driver_unregister(&arcfb_driver); + driver_unregister(&arcfb_driver); } module_param(num_cols, ulong, 0); diff --git a/trunk/drivers/video/backlight/corgi_bl.c b/trunk/drivers/video/backlight/corgi_bl.c index 6a219b2c77e3..bd9a6996aee7 100644 --- a/trunk/drivers/video/backlight/corgi_bl.c +++ b/trunk/drivers/video/backlight/corgi_bl.c @@ -79,13 +79,13 @@ static void corgibl_blank(int blank) } #ifdef CONFIG_PM -static int corgibl_suspend(struct platform_device *dev, pm_message_t state) +static int corgibl_suspend(struct device *dev, pm_message_t state) { corgibl_blank(FB_BLANK_POWERDOWN); return 0; } -static int corgibl_resume(struct platform_device *dev) +static int corgibl_resume(struct device *dev) { corgibl_blank(FB_BLANK_UNBLANK); return 0; @@ -143,9 +143,9 @@ static struct backlight_properties corgibl_data = { static struct backlight_device *corgi_backlight_device; -static int __init corgibl_probe(struct platform_device *pdev) +static int __init corgibl_probe(struct device *dev) { - struct corgibl_machinfo *machinfo = pdev->dev.platform_data; + struct corgibl_machinfo *machinfo = dev->platform_data; corgibl_data.max_brightness = machinfo->max_intensity; corgibl_mach_set_intensity = machinfo->set_bl_intensity; @@ -162,7 +162,7 @@ static int __init corgibl_probe(struct platform_device *pdev) return 0; } -static int corgibl_remove(struct platform_device *dev) +static int corgibl_remove(struct device *dev) { backlight_device_unregister(corgi_backlight_device); @@ -172,24 +172,23 @@ static int corgibl_remove(struct platform_device *dev) return 0; } -static struct platform_driver corgibl_driver = { +static struct device_driver corgibl_driver = { + .name = "corgi-bl", + .bus = &platform_bus_type, .probe = corgibl_probe, .remove = corgibl_remove, .suspend = corgibl_suspend, .resume = corgibl_resume, - .driver = { - .name = "corgi-bl", - }, }; static int __init corgibl_init(void) { - return platform_driver_register(&corgibl_driver); + return driver_register(&corgibl_driver); } static void __exit corgibl_exit(void) { - platform_driver_unregister(&corgibl_driver); + driver_unregister(&corgibl_driver); } module_init(corgibl_init); diff --git a/trunk/drivers/video/dnfb.c b/trunk/drivers/video/dnfb.c index 5abd3cb00671..957a3ada2b75 100644 --- a/trunk/drivers/video/dnfb.c +++ b/trunk/drivers/video/dnfb.c @@ -227,8 +227,9 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) * Initialization */ -static int __devinit dnfb_probe(struct platform_device *dev) +static int __devinit dnfb_probe(struct device *device) { + struct platform_device *dev = to_platform_device(device); struct fb_info *info; int err = 0; @@ -256,7 +257,7 @@ static int __devinit dnfb_probe(struct platform_device *dev) framebuffer_release(info); return err; } - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); /* now we have registered we can safely setup the hardware */ out_8(AP_CONTROL_3A, RESET_CREG); @@ -270,11 +271,10 @@ static int __devinit dnfb_probe(struct platform_device *dev) return err; } -static struct platform_driver dnfb_driver = { +static struct device_driver dnfb_driver = { + .name = "dnfb", + .bus = &platform_bus_type, .probe = dnfb_probe, - .driver = { - .name = "dnfb", - }, }; static struct platform_device dnfb_device = { @@ -288,12 +288,12 @@ int __init dnfb_init(void) if (fb_get_options("dnfb", NULL)) return -ENODEV; - ret = platform_driver_register(&dnfb_driver); + ret = driver_register(&dnfb_driver); if (!ret) { ret = platform_device_register(&dnfb_device); if (ret) - platform_driver_unregister(&dnfb_driver); + driver_unregister(&dnfb_driver); } return ret; } diff --git a/trunk/drivers/video/epson1355fb.c b/trunk/drivers/video/epson1355fb.c index 3b0e71383448..6a81a1dd8f3d 100644 --- a/trunk/drivers/video/epson1355fb.c +++ b/trunk/drivers/video/epson1355fb.c @@ -609,9 +609,9 @@ static void epson1355fb_platform_release(struct device *device) { } -static int epson1355fb_remove(struct platform_device *dev) +static int epson1355fb_remove(struct device *device) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(device); struct epson1355_par *par = info->par; backlight_enable(0); @@ -632,8 +632,9 @@ static int epson1355fb_remove(struct platform_device *dev) return 0; } -int __init epson1355fb_probe(struct platform_device *dev) +int __init epson1355fb_probe(struct device *device) { + struct platform_device *dev = to_platform_device(device); struct epson1355_par *default_par; struct fb_info *info; u8 revision; @@ -712,7 +713,7 @@ int __init epson1355fb_probe(struct platform_device *dev) /* * Our driver data. */ - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); @@ -720,16 +721,15 @@ int __init epson1355fb_probe(struct platform_device *dev) return 0; bail: - epson1355fb_remove(dev); + epson1355fb_remove(device); return rc; } -static struct platform_driver epson1355fb_driver = { +static struct device_driver epson1355fb_driver = { + .name = "epson1355fb", + .bus = &platform_bus_type, .probe = epson1355fb_probe, .remove = epson1355fb_remove, - .driver = { - .name = "epson1355fb", - }, }; static struct platform_device epson1355fb_device = { @@ -747,11 +747,11 @@ int __init epson1355fb_init(void) if (fb_get_options("epson1355fb", NULL)) return -ENODEV; - ret = platform_driver_register(&epson1355fb_driver); + ret = driver_register(&epson1355fb_driver); if (!ret) { ret = platform_device_register(&epson1355fb_device); if (ret) - platform_driver_unregister(&epson1355fb_driver); + driver_unregister(&epson1355fb_driver); } return ret; } @@ -762,7 +762,7 @@ module_init(epson1355fb_init); static void __exit epson1355fb_exit(void) { platform_device_unregister(&epson1355fb_device); - platform_driver_unregister(&epson1355fb_driver); + driver_unregister(&epson1355fb_driver); } /* ------------------------------------------------------------------------- */ diff --git a/trunk/drivers/video/gbefb.c b/trunk/drivers/video/gbefb.c index d744c51807b7..9d5e4f342110 100644 --- a/trunk/drivers/video/gbefb.c +++ b/trunk/drivers/video/gbefb.c @@ -1105,11 +1105,12 @@ int __init gbefb_setup(char *options) return 0; } -static int __init gbefb_probe(struct platform_device *p_dev) +static int __init gbefb_probe(struct device *dev) { int i, ret = 0; struct fb_info *info; struct gbefb_par *par; + struct platform_device *p_dev = to_platform_device(dev); #ifndef MODULE char *options = NULL; #endif @@ -1203,8 +1204,8 @@ static int __init gbefb_probe(struct platform_device *p_dev) goto out_gbe_unmap; } - platform_set_drvdata(p_dev, info); - gbefb_create_sysfs(&p_dev->dev); + dev_set_drvdata(&p_dev->dev, info); + gbefb_create_sysfs(dev); printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n", info->node, info->fix.id, gbe_revision, (unsigned) GBE_BASE, @@ -1230,9 +1231,10 @@ static int __init gbefb_probe(struct platform_device *p_dev) return ret; } -static int __devexit gbefb_remove(struct platform_device* p_dev) +static int __devexit gbefb_remove(struct device* dev) { - struct fb_info *info = platform_get_drvdata(p_dev); + struct platform_device *p_dev = to_platform_device(dev); + struct fb_info *info = dev_get_drvdata(&p_dev->dev); unregister_framebuffer(info); gbe_turn_off(); @@ -1250,19 +1252,18 @@ static int __devexit gbefb_remove(struct platform_device* p_dev) return 0; } -static struct platform_driver gbefb_driver = { +static struct device_driver gbefb_driver = { + .name = "gbefb", + .bus = &platform_bus_type, .probe = gbefb_probe, .remove = __devexit_p(gbefb_remove), - .driver = { - .name = "gbefb", - }, }; static struct platform_device *gbefb_device; int __init gbefb_init(void) { - int ret = platform_driver_register(&gbefb_driver); + int ret = driver_register(&gbefb_driver); if (!ret) { gbefb_device = platform_device_alloc("gbefb", 0); if (gbefb_device) { @@ -1272,7 +1273,7 @@ int __init gbefb_init(void) } if (ret) { platform_device_put(gbefb_device); - platform_driver_unregister(&gbefb_driver); + driver_unregister(&gbefb_driver); } } return ret; @@ -1281,7 +1282,7 @@ int __init gbefb_init(void) void __exit gbefb_exit(void) { platform_device_unregister(gbefb_device); - platform_driver_unregister(&gbefb_driver); + driver_unregister(&gbefb_driver); } module_init(gbefb_init); diff --git a/trunk/drivers/video/imxfb.c b/trunk/drivers/video/imxfb.c index 5924cc225c95..e20b9f3a255f 100644 --- a/trunk/drivers/video/imxfb.c +++ b/trunk/drivers/video/imxfb.c @@ -423,18 +423,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi) * Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int imxfb_suspend(struct platform_device *dev, pm_message_t state) +static int imxfb_suspend(struct device *dev, pm_message_t state) { - struct imxfb_info *fbi = platform_get_drvdata(dev); + struct imxfb_info *fbi = dev_get_drvdata(dev); pr_debug("%s\n",__FUNCTION__); imxfb_disable_controller(fbi); return 0; } -static int imxfb_resume(struct platform_device *dev) +static int imxfb_resume(struct device *dev) { - struct imxfb_info *fbi = platform_get_drvdata(dev); + struct imxfb_info *fbi = dev_get_drvdata(dev); pr_debug("%s\n",__FUNCTION__); imxfb_enable_controller(fbi); @@ -538,8 +538,9 @@ static int __init imxfb_map_video_memory(struct fb_info *info) return fbi->map_cpu ? 0 : -ENOMEM; } -static int __init imxfb_probe(struct platform_device *pdev) +static int __init imxfb_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct imxfb_info *fbi; struct fb_info *info; struct imxfb_mach_info *inf; @@ -552,21 +553,21 @@ static int __init imxfb_probe(struct platform_device *pdev) if(!res) return -ENODEV; - inf = pdev->dev.platform_data; + inf = dev->platform_data; if(!inf) { dev_err(dev,"No platform_data available\n"); return -ENOMEM; } - info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev); + info = framebuffer_alloc(sizeof(struct imxfb_info), dev); if(!info) return -ENOMEM; fbi = info->par; - platform_set_drvdata(pdev, info); + dev_set_drvdata(dev, info); - ret = imxfb_init_fbinfo(&pdev->dev); + ret = imxfb_init_fbinfo(dev); if( ret < 0 ) goto failed_init; @@ -620,21 +621,22 @@ static int __init imxfb_probe(struct platform_device *pdev) fb_dealloc_cmap(&info->cmap); failed_cmap: if (!inf->fixed_screen_cpu) - dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu, + dma_free_writecombine(dev,fbi->map_size,fbi->map_cpu, fbi->map_dma); failed_map: kfree(info->pseudo_palette); failed_regs: release_mem_region(res->start, res->end - res->start); failed_init: - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); framebuffer_release(info); return ret; } -static int imxfb_remove(struct platform_device *pdev) +static int imxfb_remove(struct device *dev) { - struct fb_info *info = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct fb_info *info = dev_get_drvdata(dev); struct imxfb_info *fbi = info->par; struct resource *res; @@ -649,37 +651,36 @@ static int imxfb_remove(struct platform_device *pdev) framebuffer_release(info); release_mem_region(res->start, res->end - res->start + 1); - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); return 0; } -void imxfb_shutdown(struct platform_device * dev) +void imxfb_shutdown(struct device * dev) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(dev); struct imxfb_info *fbi = info->par; imxfb_disable_controller(fbi); } -static struct platform_driver imxfb_driver = { +static struct device_driver imxfb_driver = { + .name = "imx-fb", + .bus = &platform_bus_type, .probe = imxfb_probe, .suspend = imxfb_suspend, .resume = imxfb_resume, .remove = imxfb_remove, .shutdown = imxfb_shutdown, - .driver = { - .name = "imx-fb", - }, }; int __init imxfb_init(void) { - return platform_driver_register(&imxfb_driver); + return driver_register(&imxfb_driver); } static void __exit imxfb_cleanup(void) { - platform_driver_unregister(&imxfb_driver); + driver_unregister(&imxfb_driver); } module_init(imxfb_init); diff --git a/trunk/drivers/video/pxafb.c b/trunk/drivers/video/pxafb.c index 7b4cd250bec8..f305a5b77b23 100644 --- a/trunk/drivers/video/pxafb.c +++ b/trunk/drivers/video/pxafb.c @@ -980,17 +980,17 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data) * Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int pxafb_suspend(struct platform_device *dev, pm_message_t state) +static int pxafb_suspend(struct device *dev, pm_message_t state) { - struct pxafb_info *fbi = platform_get_drvdata(dev); + struct pxafb_info *fbi = dev_get_drvdata(dev); set_ctrlr_state(fbi, C_DISABLE_PM); return 0; } -static int pxafb_resume(struct platform_device *dev) +static int pxafb_resume(struct device *dev) { - struct pxafb_info *fbi = platform_get_drvdata(dev); + struct pxafb_info *fbi = dev_get_drvdata(dev); set_ctrlr_state(fbi, C_ENABLE_PM); return 0; @@ -1268,7 +1268,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options) } #endif -int __init pxafb_probe(struct platform_device *dev) +int __init pxafb_probe(struct device *dev) { struct pxafb_info *fbi; struct pxafb_mach_info *inf; @@ -1276,14 +1276,14 @@ int __init pxafb_probe(struct platform_device *dev) dev_dbg(dev, "pxafb_probe\n"); - inf = dev->dev.platform_data; + inf = dev->platform_data; ret = -ENOMEM; fbi = NULL; if (!inf) goto failed; #ifdef CONFIG_FB_PXA_PARAMETERS - ret = pxafb_parse_options(&dev->dev, g_options); + ret = pxafb_parse_options(dev, g_options); if (ret < 0) goto failed; #endif @@ -1293,36 +1293,36 @@ int __init pxafb_probe(struct platform_device *dev) * a warning is given. */ if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) - dev_warn(&dev->dev, "machine LCCR0 setting contains illegal bits: %08x\n", + dev_warn(dev, "machine LCCR0 setting contains illegal bits: %08x\n", inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) - dev_warn(&dev->dev, "machine LCCR3 setting contains illegal bits: %08x\n", + dev_warn(dev, "machine LCCR3 setting contains illegal bits: %08x\n", inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); if (inf->lccr0 & LCCR0_DPD && ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) - dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is only valid in passive mono" + dev_warn(dev, "Double Pixel Data (DPD) mode is only valid in passive mono" " single panel mode\n"); if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) - dev_warn(&dev->dev, "Dual panel only valid in passive mode\n"); + dev_warn(dev, "Dual panel only valid in passive mode\n"); if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && (inf->upper_margin || inf->lower_margin)) - dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n"); + dev_warn(dev, "Upper and lower margins must be 0 in passive mode\n"); #endif - dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); + dev_dbg(dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) { - dev_err(&dev->dev, "Invalid resolution or bit depth\n"); + dev_err(dev, "Invalid resolution or bit depth\n"); ret = -EINVAL; goto failed; } pxafb_backlight_power = inf->pxafb_backlight_power; pxafb_lcd_power = inf->pxafb_lcd_power; - fbi = pxafb_init_fbinfo(&dev->dev); + fbi = pxafb_init_fbinfo(dev); if (!fbi) { - dev_err(&dev->dev, "Failed to initialize framebuffer device\n"); + dev_err(dev, "Failed to initialize framebuffer device\n"); ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc goto failed; } @@ -1330,14 +1330,14 @@ int __init pxafb_probe(struct platform_device *dev) /* Initialize video memory */ ret = pxafb_map_video_memory(fbi); if (ret) { - dev_err(&dev->dev, "Failed to allocate video RAM: %d\n", ret); + dev_err(dev, "Failed to allocate video RAM: %d\n", ret); ret = -ENOMEM; goto failed; } ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); if (ret) { - dev_err(&dev->dev, "request_irq failed: %d\n", ret); + dev_err(dev, "request_irq failed: %d\n", ret); ret = -EBUSY; goto failed; } @@ -1349,11 +1349,11 @@ int __init pxafb_probe(struct platform_device *dev) pxafb_check_var(&fbi->fb.var, &fbi->fb); pxafb_set_par(&fbi->fb); - platform_set_drvdata(dev, fbi); + dev_set_drvdata(dev, fbi); ret = register_framebuffer(&fbi->fb); if (ret < 0) { - dev_err(&dev->dev, "Failed to register framebuffer device: %d\n", ret); + dev_err(dev, "Failed to register framebuffer device: %d\n", ret); goto failed; } @@ -1376,20 +1376,19 @@ int __init pxafb_probe(struct platform_device *dev) return 0; failed: - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); kfree(fbi); return ret; } -static struct platform_driver pxafb_driver = { +static struct device_driver pxafb_driver = { + .name = "pxa2xx-fb", + .bus = &platform_bus_type, .probe = pxafb_probe, #ifdef CONFIG_PM .suspend = pxafb_suspend, .resume = pxafb_resume, #endif - .driver = { - .name = "pxa2xx-fb", - }, }; #ifndef MODULE @@ -1416,7 +1415,7 @@ int __devinit pxafb_init(void) return -ENODEV; pxafb_setup(option); #endif - return platform_driver_register(&pxafb_driver); + return driver_register(&pxafb_driver); } module_init(pxafb_init); diff --git a/trunk/drivers/video/q40fb.c b/trunk/drivers/video/q40fb.c index fc91dbf896d2..bfc41f2c902a 100644 --- a/trunk/drivers/video/q40fb.c +++ b/trunk/drivers/video/q40fb.c @@ -86,8 +86,9 @@ static struct fb_ops q40fb_ops = { .fb_imageblit = cfb_imageblit, }; -static int __init q40fb_probe(struct platform_device *dev) +static int __init q40fb_probe(struct device *device) { + struct platform_device *dev = to_platform_device(device); struct fb_info *info; if (!MACH_IS_Q40) @@ -127,11 +128,10 @@ static int __init q40fb_probe(struct platform_device *dev) return 0; } -static struct platform_driver q40fb_driver = { +static struct device_driver q40fb_driver = { + .name = "q40fb", + .bus = &platform_bus_type, .probe = q40fb_probe, - .driver = { - .name = "q40fb", - }, }; static struct platform_device q40fb_device = { @@ -145,12 +145,12 @@ int __init q40fb_init(void) if (fb_get_options("q40fb", NULL)) return -ENODEV; - ret = platform_driver_register(&q40fb_driver); + ret = driver_register(&q40fb_driver); if (!ret) { ret = platform_device_register(&q40fb_device); if (ret) - platform_driver_unregister(&q40fb_driver); + driver_unregister(&q40fb_driver); } return ret; } diff --git a/trunk/drivers/video/s1d13xxxfb.c b/trunk/drivers/video/s1d13xxxfb.c index e5d0f92eeae3..3edbd14c5c46 100644 --- a/trunk/drivers/video/s1d13xxxfb.c +++ b/trunk/drivers/video/s1d13xxxfb.c @@ -503,9 +503,10 @@ s1d13xxxfb_fetch_hw_state(struct fb_info *info) static int -s1d13xxxfb_remove(struct platform_device *pdev) +s1d13xxxfb_remove(struct device *dev) { - struct fb_info *info = platform_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); + struct platform_device *pdev = to_platform_device(dev); struct s1d13xxxfb_par *par = NULL; if (info) { @@ -533,8 +534,9 @@ s1d13xxxfb_remove(struct platform_device *pdev) } static int __devinit -s1d13xxxfb_probe(struct platform_device *pdev) +s1d13xxxfb_probe(struct device *dev) { + struct platform_device *pdev = to_platform_device(dev); struct s1d13xxxfb_par *default_par; struct fb_info *info; struct s1d13xxxfb_pdata *pdata = NULL; @@ -546,8 +548,8 @@ s1d13xxxfb_probe(struct platform_device *pdev) printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); /* enable platform-dependent hardware glue, if any */ - if (pdev->dev.platform_data) - pdata = pdev->dev.platform_data; + if (dev->platform_data) + pdata = dev->platform_data; if (pdata && pdata->platform_init_video) pdata->platform_init_video(); @@ -570,14 +572,14 @@ s1d13xxxfb_probe(struct platform_device *pdev) if (!request_mem_region(pdev->resource[0].start, pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) { - dev_dbg(&pdev->dev, "request_mem_region failed\n"); + dev_dbg(dev, "request_mem_region failed\n"); ret = -EBUSY; goto bail; } if (!request_mem_region(pdev->resource[1].start, pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) { - dev_dbg(&pdev->dev, "request_mem_region failed\n"); + dev_dbg(dev, "request_mem_region failed\n"); ret = -EBUSY; goto bail; } @@ -638,7 +640,7 @@ s1d13xxxfb_probe(struct platform_device *pdev) goto bail; } - platform_set_drvdata(pdev, info); + dev_set_drvdata(&pdev->dev, info); printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); @@ -646,15 +648,15 @@ s1d13xxxfb_probe(struct platform_device *pdev) return 0; bail: - s1d13xxxfb_remove(pdev); + s1d13xxxfb_remove(dev); return ret; } #ifdef CONFIG_PM -static int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state) +static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(dev); struct s1d13xxxfb_par *s1dfb = info->par; struct s1d13xxxfb_pdata *pdata = NULL; @@ -662,8 +664,8 @@ static int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state) lcd_enable(s1dfb, 0); crt_enable(s1dfb, 0); - if (dev->dev.platform_data) - pdata = dev->dev.platform_data; + if (dev->platform_data) + pdata = dev->platform_data; #if 0 if (!s1dfb->disp_save) @@ -699,9 +701,9 @@ static int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int s1d13xxxfb_resume(struct platform_device *dev) +static int s1d13xxxfb_resume(struct device *dev) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(dev); struct s1d13xxxfb_par *s1dfb = info->par; struct s1d13xxxfb_pdata *pdata = NULL; @@ -712,8 +714,8 @@ static int s1d13xxxfb_resume(struct platform_device *dev) while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01)) udelay(10); - if (dev->dev.platform_data) - pdata = dev->dev.platform_data; + if (dev->platform_data) + pdata = dev->platform_data; if (s1dfb->regs_save) { /* will write RO regs, *should* get away with it :) */ @@ -739,16 +741,15 @@ static int s1d13xxxfb_resume(struct platform_device *dev) } #endif /* CONFIG_PM */ -static struct platform_driver s1d13xxxfb_driver = { +static struct device_driver s1d13xxxfb_driver = { + .name = S1D_DEVICENAME, + .bus = &platform_bus_type, .probe = s1d13xxxfb_probe, .remove = s1d13xxxfb_remove, #ifdef CONFIG_PM .suspend = s1d13xxxfb_suspend, - .resume = s1d13xxxfb_resume, + .resume = s1d13xxxfb_resume #endif - .driver = { - .name = S1D_DEVICENAME, - }, }; @@ -758,14 +759,14 @@ s1d13xxxfb_init(void) if (fb_get_options("s1d13xxxfb", NULL)) return -ENODEV; - return platform_driver_register(&s1d13xxxfb_driver); + return driver_register(&s1d13xxxfb_driver); } static void __exit s1d13xxxfb_exit(void) { - platform_driver_unregister(&s1d13xxxfb_driver); + driver_unregister(&s1d13xxxfb_driver); } module_init(s1d13xxxfb_init); diff --git a/trunk/drivers/video/s3c2410fb.c b/trunk/drivers/video/s3c2410fb.c index ce6e749db3a7..855a6778b9eb 100644 --- a/trunk/drivers/video/s3c2410fb.c +++ b/trunk/drivers/video/s3c2410fb.c @@ -634,18 +634,19 @@ static irqreturn_t s3c2410fb_irq(int irq, void *dev_id, struct pt_regs *r) static char driver_name[]="s3c2410fb"; -int __init s3c2410fb_probe(struct platform_device *pdev) +int __init s3c2410fb_probe(struct device *dev) { struct s3c2410fb_info *info; struct fb_info *fbinfo; + struct platform_device *pdev = to_platform_device(dev); struct s3c2410fb_hw *mregs; int ret; int irq; int i; - mach_info = pdev->dev.platform_data; + mach_info = dev->platform_data; if (mach_info == NULL) { - dev_err(&pdev->dev,"no platform data for lcd, cannot attach\n"); + dev_err(dev,"no platform data for lcd, cannot attach\n"); return -EINVAL; } @@ -653,11 +654,11 @@ int __init s3c2410fb_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq < 0) { - dev_err(&pdev->dev, "no irq for device\n"); + dev_err(dev, "no irq for device\n"); return -ENOENT; } - fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), &pdev->dev); + fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), dev); if (!fbinfo) { return -ENOMEM; } @@ -665,7 +666,7 @@ int __init s3c2410fb_probe(struct platform_device *pdev) info = fbinfo->par; info->fb = fbinfo; - platform_set_drvdata(pdev, fbinfo); + dev_set_drvdata(dev, fbinfo); s3c2410fb_init_registers(info); @@ -675,7 +676,7 @@ int __init s3c2410fb_probe(struct platform_device *pdev) memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); - info->mach_info = pdev->dev.platform_data; + info->mach_info = dev->platform_data; fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; fbinfo->fix.type_aux = 0; @@ -734,7 +735,7 @@ int __init s3c2410fb_probe(struct platform_device *pdev) ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); if (ret) { - dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret); + dev_err(dev, "cannot get irq %d - err %d\n", irq, ret); ret = -EBUSY; goto release_mem; } @@ -772,7 +773,7 @@ int __init s3c2410fb_probe(struct platform_device *pdev) } /* create device files */ - device_create_file(&pdev->dev, &dev_attr_debug); + device_create_file(dev, &dev_attr_debug); printk(KERN_INFO "fb%d: %s frame buffer device\n", fbinfo->node, fbinfo->fix.id); @@ -815,9 +816,10 @@ static void s3c2410fb_stop_lcd(void) /* * Cleanup */ -static int s3c2410fb_remove(struct platform_device *pdev) +static int s3c2410fb_remove(struct device *dev) { - struct fb_info *fbinfo = platform_get_drvdata(pdev); + struct platform_device *pdev = to_platform_device(dev); + struct fb_info *fbinfo = dev_get_drvdata(dev); struct s3c2410fb_info *info = fbinfo->par; int irq; @@ -845,9 +847,9 @@ static int s3c2410fb_remove(struct platform_device *pdev) /* suspend and resume support for the lcd controller */ -static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) +static int s3c2410fb_suspend(struct device *dev, pm_message_t state) { - struct fb_info *fbinfo = platform_get_drvdata(dev); + struct fb_info *fbinfo = dev_get_drvdata(dev); struct s3c2410fb_info *info = fbinfo->par; s3c2410fb_stop_lcd(); @@ -862,9 +864,9 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int s3c2410fb_resume(struct platform_device *dev) +static int s3c2410fb_resume(struct device *dev) { - struct fb_info *fbinfo = platform_get_drvdata(dev); + struct fb_info *fbinfo = dev_get_drvdata(dev); struct s3c2410fb_info *info = fbinfo->par; clk_enable(info->clk); @@ -880,25 +882,24 @@ static int s3c2410fb_resume(struct platform_device *dev) #define s3c2410fb_resume NULL #endif -static struct platform_driver s3c2410fb_driver = { +static struct device_driver s3c2410fb_driver = { + .name = "s3c2410-lcd", + .owner = THIS_MODULE, + .bus = &platform_bus_type, .probe = s3c2410fb_probe, - .remove = s3c2410fb_remove, .suspend = s3c2410fb_suspend, .resume = s3c2410fb_resume, - .driver = { - .name = "s3c2410-lcd", - .owner = THIS_MODULE, - }, + .remove = s3c2410fb_remove }; int __devinit s3c2410fb_init(void) { - return platform_driver_register(&s3c2410fb_driver); + return driver_register(&s3c2410fb_driver); } static void __exit s3c2410fb_cleanup(void) { - platform_driver_unregister(&s3c2410fb_driver); + driver_unregister(&s3c2410fb_driver); } diff --git a/trunk/drivers/video/sa1100fb.c b/trunk/drivers/video/sa1100fb.c index 2ea1354e439f..a5184575cfae 100644 --- a/trunk/drivers/video/sa1100fb.c +++ b/trunk/drivers/video/sa1100fb.c @@ -1308,17 +1308,17 @@ sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val, * Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ -static int sa1100fb_suspend(struct platform_device *dev, pm_message_t state) +static int sa1100fb_suspend(struct device *dev, pm_message_t state) { - struct sa1100fb_info *fbi = platform_get_drvdata(dev); + struct sa1100fb_info *fbi = dev_get_drvdata(dev); set_ctrlr_state(fbi, C_DISABLE_PM); return 0; } -static int sa1100fb_resume(struct platform_device *dev) +static int sa1100fb_resume(struct device *dev) { - struct sa1100fb_info *fbi = platform_get_drvdata(dev); + struct sa1100fb_info *fbi = dev_get_drvdata(dev); set_ctrlr_state(fbi, C_ENABLE_PM); return 0; @@ -1452,7 +1452,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) return fbi; } -static int __init sa1100fb_probe(struct platform_device *pdev) +static int __init sa1100fb_probe(struct device *dev) { struct sa1100fb_info *fbi; int ret; @@ -1460,7 +1460,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev) if (!request_mem_region(0xb0100000, 0x10000, "LCD")) return -EBUSY; - fbi = sa1100fb_init_fbinfo(&pdev->dev); + fbi = sa1100fb_init_fbinfo(dev); ret = -ENOMEM; if (!fbi) goto failed; @@ -1488,7 +1488,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev) */ sa1100fb_check_var(&fbi->fb.var, &fbi->fb); - platform_set_drvdata(pdev, fbi); + dev_set_drvdata(dev, fbi); ret = register_framebuffer(&fbi->fb); if (ret < 0) @@ -1505,19 +1505,18 @@ static int __init sa1100fb_probe(struct platform_device *pdev) return 0; failed: - platform_set_drvdata(pdev, NULL); + dev_set_drvdata(dev, NULL); kfree(fbi); release_mem_region(0xb0100000, 0x10000); return ret; } -static struct platform_driver sa1100fb_driver = { +static struct device_driver sa1100fb_driver = { + .name = "sa11x0-fb", + .bus = &platform_bus_type, .probe = sa1100fb_probe, .suspend = sa1100fb_suspend, .resume = sa1100fb_resume, - .driver = { - .name = "sa11x0-fb", - }, }; int __init sa1100fb_init(void) @@ -1525,7 +1524,7 @@ int __init sa1100fb_init(void) if (fb_get_options("sa1100fb", NULL)) return -ENODEV; - return platform_driver_register(&sa1100fb_driver); + return driver_register(&sa1100fb_driver); } int __init sa1100fb_setup(char *options) diff --git a/trunk/drivers/video/sgivwfb.c b/trunk/drivers/video/sgivwfb.c index 7054660767e4..2e8769dd345a 100644 --- a/trunk/drivers/video/sgivwfb.c +++ b/trunk/drivers/video/sgivwfb.c @@ -750,8 +750,9 @@ int __init sgivwfb_setup(char *options) /* * Initialisation */ -static int __init sgivwfb_probe(struct platform_device *dev) +static int __init sgivwfb_probe(struct device *device) { + struct platform_device *dev = to_platform_device(device); struct sgivw_par *par; struct fb_info *info; char *monitor; @@ -812,7 +813,7 @@ static int __init sgivwfb_probe(struct platform_device *dev) goto fail_register_framebuffer; } - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n", info->node, sgivwfb_mem_size >> 10, sgivwfb_mem_phys); @@ -830,9 +831,9 @@ static int __init sgivwfb_probe(struct platform_device *dev) return -ENXIO; } -static int sgivwfb_remove(struct platform_device *dev) +static int sgivwfb_remove(struct device *device) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(device); if (info) { struct sgivw_par *par = info->par; @@ -846,12 +847,11 @@ static int sgivwfb_remove(struct platform_device *dev) return 0; } -static struct platform_driver sgivwfb_driver = { +static struct device_driver sgivwfb_driver = { + .name = "sgivwfb", + .bus = &platform_bus_type, .probe = sgivwfb_probe, .remove = sgivwfb_remove, - .driver = { - .name = "sgivwfb", - }, }; static struct platform_device *sgivwfb_device; @@ -867,7 +867,7 @@ int __init sgivwfb_init(void) return -ENODEV; sgivwfb_setup(option); #endif - ret = platform_driver_register(&sgivwfb_driver); + ret = driver_register(&sgivwfb_driver); if (!ret) { sgivwfb_device = platform_device_alloc("sgivwfb", 0); if (sgivwfb_device) { @@ -875,7 +875,7 @@ int __init sgivwfb_init(void) } else ret = -ENOMEM; if (ret) { - platform_driver_unregister(&sgivwfb_driver); + driver_unregister(&sgivwfb_driver); platform_device_put(sgivwfb_device); } } @@ -890,7 +890,7 @@ MODULE_LICENSE("GPL"); static void __exit sgivwfb_exit(void) { platform_device_unregister(sgivwfb_device); - platform_driver_unregister(&sgivwfb_driver); + driver_unregister(&sgivwfb_driver); } module_exit(sgivwfb_exit); diff --git a/trunk/drivers/video/vesafb.c b/trunk/drivers/video/vesafb.c index 2c3aa2fcfd91..e25eae1a78c1 100644 --- a/trunk/drivers/video/vesafb.c +++ b/trunk/drivers/video/vesafb.c @@ -245,8 +245,9 @@ static int __init vesafb_setup(char *options) return 0; } -static int __init vesafb_probe(struct platform_device *dev) +static int __init vesafb_probe(struct device *device) { + struct platform_device *dev = to_platform_device(device); struct fb_info *info; int i, err; unsigned int size_vmode; @@ -479,11 +480,10 @@ static int __init vesafb_probe(struct platform_device *dev) return err; } -static struct platform_driver vesafb_driver = { +static struct device_driver vesafb_driver = { + .name = "vesafb", + .bus = &platform_bus_type, .probe = vesafb_probe, - .driver = { - .name = "vesafb", - }, }; static struct platform_device vesafb_device = { @@ -498,12 +498,12 @@ static int __init vesafb_init(void) /* ignore error return of fb_get_options */ fb_get_options("vesafb", &option); vesafb_setup(option); - ret = platform_driver_register(&vesafb_driver); + ret = driver_register(&vesafb_driver); if (!ret) { ret = platform_device_register(&vesafb_device); if (ret) - platform_driver_unregister(&vesafb_driver); + driver_unregister(&vesafb_driver); } return ret; } diff --git a/trunk/drivers/video/vfb.c b/trunk/drivers/video/vfb.c index ffa1ad474226..8794dc5d2466 100644 --- a/trunk/drivers/video/vfb.c +++ b/trunk/drivers/video/vfb.c @@ -403,8 +403,9 @@ static void vfb_platform_release(struct device *device) // This is called when the reference count goes to zero. } -static int __init vfb_probe(struct platform_device *dev) +static int __init vfb_probe(struct device *device) { + struct platform_device *dev = to_platform_device(device); struct fb_info *info; int retval = -ENOMEM; @@ -446,7 +447,7 @@ static int __init vfb_probe(struct platform_device *dev) retval = register_framebuffer(info); if (retval < 0) goto err2; - platform_set_drvdata(dev, info); + dev_set_drvdata(&dev->dev, info); printk(KERN_INFO "fb%d: Virtual frame buffer device, using %ldK of video memory\n", @@ -461,9 +462,9 @@ static int __init vfb_probe(struct platform_device *dev) return retval; } -static int vfb_remove(struct platform_device *dev) +static int vfb_remove(struct device *device) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(device); if (info) { unregister_framebuffer(info); @@ -473,12 +474,11 @@ static int vfb_remove(struct platform_device *dev) return 0; } -static struct platform_driver vfb_driver = { +static struct device_driver vfb_driver = { + .name = "vfb", + .bus = &platform_bus_type, .probe = vfb_probe, .remove = vfb_remove, - .driver = { - .name = "vfb", - }, }; static struct platform_device vfb_device = { @@ -504,12 +504,12 @@ static int __init vfb_init(void) if (!vfb_enable) return -ENXIO; - ret = platform_driver_register(&vfb_driver); + ret = driver_register(&vfb_driver); if (!ret) { ret = platform_device_register(&vfb_device); if (ret) - platform_driver_unregister(&vfb_driver); + driver_unregister(&vfb_driver); } return ret; } @@ -520,7 +520,7 @@ module_init(vfb_init); static void __exit vfb_exit(void) { platform_device_unregister(&vfb_device); - platform_driver_unregister(&vfb_driver); + driver_unregister(&vfb_driver); } module_exit(vfb_exit); diff --git a/trunk/drivers/video/w100fb.c b/trunk/drivers/video/w100fb.c index daa46051f55d..48e70f153c4b 100644 --- a/trunk/drivers/video/w100fb.c +++ b/trunk/drivers/video/w100fb.c @@ -437,9 +437,9 @@ static void w100fb_restore_vidmem(struct w100fb_par *par) } } -static int w100fb_suspend(struct platform_device *dev, pm_message_t state) +static int w100fb_suspend(struct device *dev, pm_message_t state) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(dev); struct w100fb_par *par=info->par; struct w100_tg_info *tg = par->mach->tg; @@ -452,9 +452,9 @@ static int w100fb_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int w100fb_resume(struct platform_device *dev) +static int w100fb_resume(struct device *dev) { - struct fb_info *info = platform_get_drvdata(dev); + struct fb_info *info = dev_get_drvdata(dev); struct w100fb_par *par=info->par; struct w100_tg_info *tg = par->mach->tg; @@ -473,12 +473,13 @@ static int w100fb_resume(struct platform_device *dev) #endif -int __init w100fb_probe(struct platform_device *pdev) +int __init w100fb_probe(struct device *dev) { int err = -EIO; struct w100fb_mach_info *inf; struct fb_info *info = NULL; struct w100fb_par *par; + struct platform_device *pdev = to_platform_device(dev); struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); unsigned int chip_id; @@ -521,9 +522,9 @@ int __init w100fb_probe(struct platform_device *pdev) } par = info->par; - platform_set_drvdata(pdev, info); + dev_set_drvdata(dev, info); - inf = pdev->dev.platform_data; + inf = dev->platform_data; par->chip_id = chip_id; par->mach = inf; par->fastpll_mode = 0; @@ -599,10 +600,10 @@ int __init w100fb_probe(struct platform_device *pdev) goto out; } - device_create_file(&pdev->dev, &dev_attr_fastpllclk); - device_create_file(&pdev->dev, &dev_attr_reg_read); - device_create_file(&pdev->dev, &dev_attr_reg_write); - device_create_file(&pdev->dev, &dev_attr_flip); + device_create_file(dev, &dev_attr_fastpllclk); + device_create_file(dev, &dev_attr_reg_read); + device_create_file(dev, &dev_attr_reg_write); + device_create_file(dev, &dev_attr_flip); printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); return 0; @@ -621,15 +622,15 @@ int __init w100fb_probe(struct platform_device *pdev) } -static int w100fb_remove(struct platform_device *pdev) +static int w100fb_remove(struct device *dev) { - struct fb_info *info = platform_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); struct w100fb_par *par=info->par; - device_remove_file(&pdev->dev, &dev_attr_fastpllclk); - device_remove_file(&pdev->dev, &dev_attr_reg_read); - device_remove_file(&pdev->dev, &dev_attr_reg_write); - device_remove_file(&pdev->dev, &dev_attr_flip); + device_remove_file(dev, &dev_attr_fastpllclk); + device_remove_file(dev, &dev_attr_reg_read); + device_remove_file(dev, &dev_attr_reg_write); + device_remove_file(dev, &dev_attr_flip); unregister_framebuffer(info); @@ -1447,24 +1448,23 @@ static void w100_vsync(void) writel(0x00000002, remapped_regs + mmGEN_INT_STATUS); } -static struct platform_driver w100fb_driver = { +static struct device_driver w100fb_driver = { + .name = "w100fb", + .bus = &platform_bus_type, .probe = w100fb_probe, .remove = w100fb_remove, .suspend = w100fb_suspend, .resume = w100fb_resume, - .driver = { - .name = "w100fb", - }, }; int __devinit w100fb_init(void) { - return platform_driver_register(&w100fb_driver); + return driver_register(&w100fb_driver); } void __exit w100fb_cleanup(void) { - platform_driver_unregister(&w100fb_driver); + driver_unregister(&w100fb_driver); } module_init(w100fb_init); diff --git a/trunk/include/asm-powerpc/auxvec.h b/trunk/include/asm-powerpc/auxvec.h index 19a099b62cd6..79d8c4732309 100644 --- a/trunk/include/asm-powerpc/auxvec.h +++ b/trunk/include/asm-powerpc/auxvec.h @@ -14,6 +14,8 @@ /* The vDSO location. We have to use the same value as x86 for glibc's * sake :-) */ +#ifdef __powerpc64__ #define AT_SYSINFO_EHDR 33 +#endif #endif diff --git a/trunk/include/asm-powerpc/elf.h b/trunk/include/asm-powerpc/elf.h index 3dcd65edf978..feac3458d71f 100644 --- a/trunk/include/asm-powerpc/elf.h +++ b/trunk/include/asm-powerpc/elf.h @@ -269,12 +269,14 @@ extern int dcache_bsize; extern int icache_bsize; extern int ucache_bsize; -/* vDSO has arch_setup_additional_pages */ -#define ARCH_HAS_SETUP_ADDITIONAL_PAGES +#ifdef __powerpc64__ struct linux_binprm; -extern int arch_setup_additional_pages(struct linux_binprm *bprm, - int executable_stack); +#define ARCH_HAS_SETUP_ADDITIONAL_PAGES /* vDSO has arch_setup_additional_pages */ +extern int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack); #define VDSO_AUX_ENT(a,b) NEW_AUX_ENT(a,b); +#else +#define VDSO_AUX_ENT(a,b) +#endif /* __powerpc64__ */ /* * The requirements here are: diff --git a/trunk/include/asm-powerpc/irq.h b/trunk/include/asm-powerpc/irq.h index 8eb7e857ec4c..c9fbcede0ef9 100644 --- a/trunk/include/asm-powerpc/irq.h +++ b/trunk/include/asm-powerpc/irq.h @@ -389,7 +389,6 @@ extern u64 ppc64_interrupt_controller; #define SIU_INT_TIMER4 ((uint)0x0f + CPM_IRQ_OFFSET) #define SIU_INT_TMCNT ((uint)0x10 + CPM_IRQ_OFFSET) #define SIU_INT_PIT ((uint)0x11 + CPM_IRQ_OFFSET) -#define SIU_INT_PCI ((uint)0x12 + CPM_IRQ_OFFSET) #define SIU_INT_IRQ1 ((uint)0x13 + CPM_IRQ_OFFSET) #define SIU_INT_IRQ2 ((uint)0x14 + CPM_IRQ_OFFSET) #define SIU_INT_IRQ3 ((uint)0x15 + CPM_IRQ_OFFSET) diff --git a/trunk/include/asm-powerpc/processor.h b/trunk/include/asm-powerpc/processor.h index d12382d292d4..f6f186b56b0f 100644 --- a/trunk/include/asm-powerpc/processor.h +++ b/trunk/include/asm-powerpc/processor.h @@ -177,8 +177,8 @@ struct thread_struct { #ifdef CONFIG_PPC64 unsigned long start_tb; /* Start purr when proc switched in */ unsigned long accum_tb; /* Total accumilated purr for process */ -#endif unsigned long vdso_base; /* base of the vDSO library */ +#endif unsigned long dabr; /* Data address breakpoint register */ #ifdef CONFIG_ALTIVEC /* Complete AltiVec register set */ diff --git a/trunk/include/asm-powerpc/sparsemem.h b/trunk/include/asm-powerpc/sparsemem.h index ba1b34fdb967..58d2aab416f8 100644 --- a/trunk/include/asm-powerpc/sparsemem.h +++ b/trunk/include/asm-powerpc/sparsemem.h @@ -8,8 +8,8 @@ * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space */ #define SECTION_SIZE_BITS 24 -#define MAX_PHYSADDR_BITS 44 -#define MAX_PHYSMEM_BITS 44 +#define MAX_PHYSADDR_BITS 38 +#define MAX_PHYSMEM_BITS 36 #ifdef CONFIG_MEMORY_HOTPLUG extern void create_section_mapping(unsigned long start, unsigned long end); diff --git a/trunk/include/asm-powerpc/systemcfg.h b/trunk/include/asm-powerpc/systemcfg.h new file mode 100644 index 000000000000..36b5cbe466f1 --- /dev/null +++ b/trunk/include/asm-powerpc/systemcfg.h @@ -0,0 +1,64 @@ +#ifndef _SYSTEMCFG_H +#define _SYSTEMCFG_H + +/* + * Copyright (C) 2002 Peter Bergner , IBM + * + * 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. + */ + +/* Change Activity: + * 2002/09/30 : bergner : Created + * End Change Activity + */ + +/* + * If the major version changes we are incompatible. + * Minor version changes are a hint. + */ +#define SYSTEMCFG_MAJOR 1 +#define SYSTEMCFG_MINOR 1 + +#ifndef __ASSEMBLY__ + +#include + +#define SYSCALL_MAP_SIZE ((__NR_syscalls + 31) / 32) + +struct systemcfg { + __u8 eye_catcher[16]; /* Eyecatcher: SYSTEMCFG:PPC64 0x00 */ + struct { /* Systemcfg version numbers */ + __u32 major; /* Major number 0x10 */ + __u32 minor; /* Minor number 0x14 */ + } version; + + __u32 platform; /* Platform flags 0x18 */ + __u32 processor; /* Processor type 0x1C */ + __u64 processorCount; /* # of physical processors 0x20 */ + __u64 physicalMemorySize; /* Size of real memory(B) 0x28 */ + __u64 tb_orig_stamp; /* Timebase at boot 0x30 */ + __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */ + __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */ + __u64 stamp_xsec; /* 0x48 */ + __u64 tb_update_count; /* Timebase atomicity ctr 0x50 */ + __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */ + __u32 tz_dsttime; /* Type of dst correction 0x5C */ + /* next four are no longer used except to be exported to /proc */ + __u32 dcache_size; /* L1 d-cache size 0x60 */ + __u32 dcache_line_size; /* L1 d-cache line size 0x64 */ + __u32 icache_size; /* L1 i-cache size 0x68 */ + __u32 icache_line_size; /* L1 i-cache line size 0x6C */ + __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of available syscalls 0x70 */ + __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of available syscalls */ +}; + +#ifdef __KERNEL__ +extern struct systemcfg *_systemcfg; /* to be renamed */ +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* _SYSTEMCFG_H */ diff --git a/trunk/include/asm-powerpc/topology.h b/trunk/include/asm-powerpc/topology.h index 015d28746e1b..2512e3836bf4 100644 --- a/trunk/include/asm-powerpc/topology.h +++ b/trunk/include/asm-powerpc/topology.h @@ -9,7 +9,15 @@ static inline int cpu_to_node(int cpu) { - return numa_cpu_lookup_table[cpu]; + int node; + + node = numa_cpu_lookup_table[cpu]; + +#ifdef DEBUG_NUMA + BUG_ON(node == -1); +#endif + + return node; } #define parent_node(node) (node) @@ -29,6 +37,8 @@ static inline int node_to_first_cpu(int node) #define pcibus_to_node(node) (-1) #define pcibus_to_cpumask(bus) (cpu_online_map) +#define nr_cpus_node(node) (nr_cpus_in_node[node]) + /* sched_domains SD_NODE_INIT for PPC64 machines */ #define SD_NODE_INIT (struct sched_domain) { \ .span = CPU_MASK_NONE, \ diff --git a/trunk/include/asm-powerpc/vdso_datapage.h b/trunk/include/asm-powerpc/vdso_datapage.h deleted file mode 100644 index fc323b51366b..000000000000 --- a/trunk/include/asm-powerpc/vdso_datapage.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef _VDSO_DATAPAGE_H -#define _VDSO_DATAPAGE_H - -/* - * Copyright (C) 2002 Peter Bergner , IBM - * Copyright (C) 2005 Benjamin Herrenschmidy , - * IBM Corp. - * - * 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. - */ - - -/* - * Note about this structure: - * - * This structure was historically called systemcfg and exposed to - * userland via /proc/ppc64/systemcfg. Unfortunately, this became an - * ABI issue as some proprietary software started relying on being able - * to mmap() it, thus we have to keep the base layout at least for a - * few kernel versions. - * - * However, since ppc32 doesn't suffer from this backward handicap, - * a simpler version of the data structure is used there with only the - * fields actually used by the vDSO. - * - */ - -/* - * If the major version changes we are incompatible. - * Minor version changes are a hint. - */ -#define SYSTEMCFG_MAJOR 1 -#define SYSTEMCFG_MINOR 1 - -#ifndef __ASSEMBLY__ - -#include - -#define SYSCALL_MAP_SIZE ((__NR_syscalls + 31) / 32) - -/* - * So here is the ppc64 backward compatible version - */ - -#ifdef CONFIG_PPC64 - -struct vdso_data { - __u8 eye_catcher[16]; /* Eyecatcher: SYSTEMCFG:PPC64 0x00 */ - struct { /* Systemcfg version numbers */ - __u32 major; /* Major number 0x10 */ - __u32 minor; /* Minor number 0x14 */ - } version; - - __u32 platform; /* Platform flags 0x18 */ - __u32 processor; /* Processor type 0x1C */ - __u64 processorCount; /* # of physical processors 0x20 */ - __u64 physicalMemorySize; /* Size of real memory(B) 0x28 */ - __u64 tb_orig_stamp; /* Timebase at boot 0x30 */ - __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */ - __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */ - __u64 stamp_xsec; /* 0x48 */ - __u64 tb_update_count; /* Timebase atomicity ctr 0x50 */ - __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */ - __u32 tz_dsttime; /* Type of dst correction 0x5C */ - __u32 dcache_size; /* L1 d-cache size 0x60 */ - __u32 dcache_line_size; /* L1 d-cache line size 0x64 */ - __u32 icache_size; /* L1 i-cache size 0x68 */ - __u32 icache_line_size; /* L1 i-cache line size 0x6C */ - - /* those additional ones don't have to be located anywhere - * special as they were not part of the original systemcfg - */ - __s64 wtom_clock_sec; /* Wall to monotonic clock */ - __s32 wtom_clock_nsec; - __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ - __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ -}; - -#else /* CONFIG_PPC64 */ - -/* - * And here is the simpler 32 bits version - */ -struct vdso_data { - __u64 tb_orig_stamp; /* Timebase at boot 0x30 */ - __u64 tb_ticks_per_sec; /* Timebase tics / sec 0x38 */ - __u64 tb_to_xs; /* Inverse of TB to 2^20 0x40 */ - __u64 stamp_xsec; /* 0x48 */ - __u32 tb_update_count; /* Timebase atomicity ctr 0x50 */ - __u32 tz_minuteswest; /* Minutes west of Greenwich 0x58 */ - __u32 tz_dsttime; /* Type of dst correction 0x5C */ - __s32 wtom_clock_sec; /* Wall to monotonic clock */ - __s32 wtom_clock_nsec; - __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ -}; - -#endif /* CONFIG_PPC64 */ - -#ifdef __KERNEL__ -extern struct vdso_data *vdso_data; -#endif - -#endif /* __ASSEMBLY__ */ - -#endif /* _SYSTEMCFG_H */ diff --git a/trunk/include/asm-ppc/page.h b/trunk/include/asm-ppc/page.h index 538e0c8ab243..fc44f7ca62d7 100644 --- a/trunk/include/asm-ppc/page.h +++ b/trunk/include/asm-ppc/page.h @@ -1,12 +1,9 @@ #ifndef _PPC_PAGE_H #define _PPC_PAGE_H -#include -#include - /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 -#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) +#define PAGE_SIZE (1UL << PAGE_SHIFT) /* * Subtle: this is an int (not an unsigned long) and so it @@ -172,8 +169,5 @@ extern __inline__ int get_order(unsigned long size) #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) -/* We do define AT_SYSINFO_EHDR but don't use the gate mecanism */ -#define __HAVE_ARCH_GATE_AREA 1 - #endif /* __KERNEL__ */ #endif /* _PPC_PAGE_H */ diff --git a/trunk/include/asm-ppc64/mmzone.h b/trunk/include/asm-ppc64/mmzone.h index 54958d6cae04..15e777ce0f4a 100644 --- a/trunk/include/asm-ppc64/mmzone.h +++ b/trunk/include/asm-ppc64/mmzone.h @@ -8,14 +8,15 @@ #define _ASM_MMZONE_H_ #include +#include -/* - * generic non-linear memory support: +/* generic non-linear memory support: * * 1) we will not split memory into more chunks than will fit into the * flags field of the struct page */ + #ifdef CONFIG_NEED_MULTIPLE_NODES extern struct pglist_data *node_data[]; @@ -29,11 +30,44 @@ extern struct pglist_data *node_data[]; */ extern int numa_cpu_lookup_table[]; +extern char *numa_memory_lookup_table; extern cpumask_t numa_cpumask_lookup_table[]; +extern int nr_cpus_in_node[]; #ifdef CONFIG_MEMORY_HOTPLUG extern unsigned long max_pfn; #endif +/* 16MB regions */ +#define MEMORY_INCREMENT_SHIFT 24 +#define MEMORY_INCREMENT (1UL << MEMORY_INCREMENT_SHIFT) + +/* NUMA debugging, will not work on a DLPAR machine */ +#undef DEBUG_NUMA + +static inline int pa_to_nid(unsigned long pa) +{ + int nid; + +#ifdef CONFIG_MEMORY_HOTPLUG + /* kludge hot added sections default to node 0 */ + if (pa >= (max_pfn << PAGE_SHIFT)) + return 0; +#endif + nid = numa_memory_lookup_table[pa >> MEMORY_INCREMENT_SHIFT]; + +#ifdef DEBUG_NUMA + /* the physical address passed in is not in the map for the system */ + if (nid == -1) { + printk("bad address: %lx\n", pa); + BUG(); + } +#endif + + return nid; +} + +#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) + /* * Following are macros that each numa implmentation must define. */ @@ -41,10 +75,39 @@ extern unsigned long max_pfn; #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) +#ifdef CONFIG_DISCONTIGMEM + +/* + * Given a kernel address, find the home node of the underlying memory. + */ +#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) + +#define pfn_to_nid(pfn) pa_to_nid((unsigned long)(pfn) << PAGE_SHIFT) + +/* Written this way to avoid evaluating arguments twice */ +#define discontigmem_pfn_to_page(pfn) \ +({ \ + unsigned long __tmp = pfn; \ + (NODE_DATA(pfn_to_nid(__tmp))->node_mem_map + \ + node_localnr(__tmp, pfn_to_nid(__tmp))); \ +}) + +#define discontigmem_page_to_pfn(p) \ +({ \ + struct page *__tmp = p; \ + (((__tmp) - page_zone(__tmp)->zone_mem_map) + \ + page_zone(__tmp)->zone_start_pfn); \ +}) + +/* XXX fix for discontiguous physical memory */ +#define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages) + +#endif /* CONFIG_DISCONTIGMEM */ + #endif /* CONFIG_NEED_MULTIPLE_NODES */ #ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID -extern int __init early_pfn_to_nid(unsigned long pfn); +#define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT) #endif #endif /* _ASM_MMZONE_H_ */ diff --git a/trunk/include/asm-ppc64/page.h b/trunk/include/asm-ppc64/page.h index 3efc3288f7e9..e32f1187aa29 100644 --- a/trunk/include/asm-ppc64/page.h +++ b/trunk/include/asm-ppc64/page.h @@ -279,6 +279,11 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */ #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) +#ifdef CONFIG_DISCONTIGMEM +#define page_to_pfn(page) discontigmem_page_to_pfn(page) +#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) +#define pfn_valid(pfn) discontigmem_pfn_valid(pfn) +#endif #ifdef CONFIG_FLATMEM #define pfn_to_page(pfn) (mem_map + (pfn)) #define page_to_pfn(page) ((unsigned long)((page) - mem_map)) diff --git a/trunk/include/asm-powerpc/udbg.h b/trunk/include/asm-ppc64/udbg.h similarity index 90% rename from trunk/include/asm-powerpc/udbg.h rename to trunk/include/asm-ppc64/udbg.h index a383383bc4d4..e3b927991851 100644 --- a/trunk/include/asm-powerpc/udbg.h +++ b/trunk/include/asm-ppc64/udbg.h @@ -1,3 +1,9 @@ +#ifndef __UDBG_HDR +#define __UDBG_HDR + +#include +#include + /* * c 2001 PPC 64 Team, IBM Corp * @@ -7,12 +13,6 @@ * 2 of the License, or (at your option) any later version. */ -#ifndef _ASM_POWERPC_UDBG_H -#define _ASM_POWERPC_UDBG_H - -#include -#include - extern void (*udbg_putc)(unsigned char c); extern unsigned char (*udbg_getc)(void); extern int (*udbg_getc_poll)(void); @@ -28,4 +28,4 @@ extern void udbg_init_uart(void __iomem *comport, unsigned int speed); struct device_node; extern void udbg_init_scc(struct device_node *np); -#endif /* _ASM_POWERPC_UDBG_H */ +#endif diff --git a/trunk/include/asm-powerpc/vdso.h b/trunk/include/asm-ppc64/vdso.h similarity index 100% rename from trunk/include/asm-powerpc/vdso.h rename to trunk/include/asm-ppc64/vdso.h diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index 1464a7586de8..6f0752219f64 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -405,7 +404,6 @@ struct ata_port_info { unsigned long mwdma_mask; unsigned long udma_mask; const struct ata_port_operations *port_ops; - void *private_data; }; struct ata_timing { diff --git a/trunk/include/linux/platform_device.h b/trunk/include/linux/platform_device.h index 17e336f40b47..1a165b7ae01b 100644 --- a/trunk/include/linux/platform_device.h +++ b/trunk/include/linux/platform_device.h @@ -43,19 +43,4 @@ extern int platform_device_add_data(struct platform_device *pdev, void *data, si extern int platform_device_add(struct platform_device *pdev); extern void platform_device_put(struct platform_device *pdev); -struct platform_driver { - int (*probe)(struct platform_device *); - int (*remove)(struct platform_device *); - void (*shutdown)(struct platform_device *); - int (*suspend)(struct platform_device *, pm_message_t state); - int (*resume)(struct platform_device *); - struct device_driver driver; -}; - -extern int platform_driver_register(struct platform_driver *); -extern void platform_driver_unregister(struct platform_driver *); - -#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) -#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) - #endif /* _PLATFORM_DEVICE_H_ */ diff --git a/trunk/net/ipv4/tcp_vegas.c b/trunk/net/ipv4/tcp_vegas.c index b7d296a8ac6d..4376814d29fb 100644 --- a/trunk/net/ipv4/tcp_vegas.c +++ b/trunk/net/ipv4/tcp_vegas.c @@ -236,7 +236,7 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, /* We don't have enough RTT samples to do the Vegas * calculation, so we'll behave like Reno. */ - tcp_reno_cong_avoid(sk, ack, seq_rtt, in_flight, flag); + tcp_reno_cong_avoid(sk, ack, seq_rtt, in_flight, cnt); } else { u32 rtt, target_cwnd, diff; diff --git a/trunk/sound/arm/pxa2xx-ac97.c b/trunk/sound/arm/pxa2xx-ac97.c index c96c8a2aa1c2..d1f9da498729 100644 --- a/trunk/sound/arm/pxa2xx-ac97.c +++ b/trunk/sound/arm/pxa2xx-ac97.c @@ -275,9 +275,9 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card) return 0; } -static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) +static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) { - snd_card_t *card = platform_get_drvdata(dev); + snd_card_t *card = dev_get_drvdata(_dev); int ret = 0; if (card) @@ -286,9 +286,9 @@ static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state) return ret; } -static int pxa2xx_ac97_resume(struct platform_device *dev) +static int pxa2xx_ac97_resume(struct device *_dev) { - snd_card_t *card = platform_get_drvdata(dev); + snd_card_t *card = dev_get_drvdata(_dev); int ret = 0; if (card) @@ -302,7 +302,7 @@ static int pxa2xx_ac97_resume(struct platform_device *dev) #define pxa2xx_ac97_resume NULL #endif -static int pxa2xx_ac97_probe(struct platform_device *dev) +static int pxa2xx_ac97_probe(struct device *dev) { snd_card_t *card; ac97_bus_t *ac97_bus; @@ -315,8 +315,8 @@ static int pxa2xx_ac97_probe(struct platform_device *dev) if (!card) goto err; - card->dev = &dev->dev; - strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver)); + card->dev = dev; + strncpy(card->driver, dev->driver->name, sizeof(card->driver)); ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); if (ret) @@ -347,13 +347,13 @@ static int pxa2xx_ac97_probe(struct platform_device *dev) snprintf(card->shortname, sizeof(card->shortname), "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97)); snprintf(card->longname, sizeof(card->longname), - "%s (%s)", dev->dev.driver->name, card->mixername); + "%s (%s)", dev->driver->name, card->mixername); snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend, pxa2xx_ac97_do_resume, NULL); ret = snd_card_register(card); if (ret == 0) { - platform_set_drvdata(dev, card); + dev_set_drvdata(dev, card); return 0; } @@ -368,13 +368,13 @@ static int pxa2xx_ac97_probe(struct platform_device *dev) return ret; } -static int pxa2xx_ac97_remove(struct platform_device *dev) +static int pxa2xx_ac97_remove(struct device *dev) { - snd_card_t *card = platform_get_drvdata(dev); + snd_card_t *card = dev_get_drvdata(dev); if (card) { snd_card_free(card); - platform_set_drvdata(dev, NULL); + dev_set_drvdata(dev, NULL); GCR |= GCR_ACLINK_OFF; free_irq(IRQ_AC97, NULL); pxa_set_cken(CKEN2_AC97, 0); @@ -383,24 +383,23 @@ static int pxa2xx_ac97_remove(struct platform_device *dev) return 0; } -static struct platform_driver pxa2xx_ac97_driver = { +static struct device_driver pxa2xx_ac97_driver = { + .name = "pxa2xx-ac97", + .bus = &platform_bus_type, .probe = pxa2xx_ac97_probe, .remove = pxa2xx_ac97_remove, .suspend = pxa2xx_ac97_suspend, .resume = pxa2xx_ac97_resume, - .driver = { - .name = "pxa2xx-ac97", - }, }; static int __init pxa2xx_ac97_init(void) { - return platform_driver_register(&pxa2xx_ac97_driver); + return driver_register(&pxa2xx_ac97_driver); } static void __exit pxa2xx_ac97_exit(void) { - platform_driver_unregister(&pxa2xx_ac97_driver); + driver_unregister(&pxa2xx_ac97_driver); } module_init(pxa2xx_ac97_init); diff --git a/trunk/sound/core/init.c b/trunk/sound/core/init.c index 33813f92ab52..d9ee27ae9a51 100644 --- a/trunk/sound/core/init.c +++ b/trunk/sound/core/init.c @@ -674,24 +674,23 @@ struct snd_generic_device { snd_card_t *card; }; -#define get_snd_generic_card(dev) container_of(dev, struct snd_generic_device, pdev)->card +#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card #define SND_GENERIC_NAME "snd_generic" #ifdef CONFIG_PM -static int snd_generic_suspend(struct platform_device *dev, pm_message_t state); -static int snd_generic_resume(struct platform_device *dev); +static int snd_generic_suspend(struct device *dev, pm_message_t state); +static int snd_generic_resume(struct device *dev); #endif /* initialized in sound.c */ -struct platform_driver snd_generic_driver = { +struct device_driver snd_generic_driver = { + .name = SND_GENERIC_NAME, + .bus = &platform_bus_type, #ifdef CONFIG_PM .suspend = snd_generic_suspend, .resume = snd_generic_resume, #endif - .driver = { - .name = SND_GENERIC_NAME, - }, }; void snd_generic_device_release(struct device *dev) @@ -822,7 +821,7 @@ int snd_card_set_pm_callback(snd_card_t *card, #ifdef CONFIG_SND_GENERIC_DRIVER /* suspend/resume callbacks for snd_generic platform device */ -static int snd_generic_suspend(struct platform_device *dev, pm_message_t state) +static int snd_generic_suspend(struct device *dev, pm_message_t state) { snd_card_t *card; @@ -835,7 +834,7 @@ static int snd_generic_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int snd_generic_resume(struct platform_device *dev) +static int snd_generic_resume(struct device *dev) { snd_card_t *card; diff --git a/trunk/sound/core/sound.c b/trunk/sound/core/sound.c index 6e7cad1e947e..1139dd8ca8eb 100644 --- a/trunk/sound/core/sound.c +++ b/trunk/sound/core/sound.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #define SNDRV_OS_MINORS 256 @@ -329,7 +329,7 @@ int __exit snd_minor_info_done(void) */ #ifdef CONFIG_SND_GENERIC_DRIVER -extern struct platform_driver snd_generic_driver; +extern struct device_driver snd_generic_driver; #endif static int __init alsa_sound_init(void) @@ -357,7 +357,7 @@ static int __init alsa_sound_init(void) } snd_info_minor_register(); #ifdef CONFIG_SND_GENERIC_DRIVER - platform_driver_register(&snd_generic_driver); + driver_register(&snd_generic_driver); #endif for (controlnum = 0; controlnum < cards_limit; controlnum++) devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); @@ -375,7 +375,7 @@ static void __exit alsa_sound_exit(void) devfs_remove("snd/controlC%d", controlnum); #ifdef CONFIG_SND_GENERIC_DRIVER - platform_driver_unregister(&snd_generic_driver); + driver_unregister(&snd_generic_driver); #endif snd_info_minor_unregister(); snd_info_done();