dect
/
linux-2.6
Archived
13
0
Fork 0

[DRIVER MODEL] Convert platform drivers to use struct platform_driver

This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Russell King 2005-11-09 22:32:44 +00:00 committed by Russell King
parent 00d3dcdd96
commit 3ae5eaec1d
93 changed files with 1413 additions and 1416 deletions

View File

@ -550,9 +550,9 @@ struct locomo_save_data {
u16 LCM_SPIMD; u16 LCM_SPIMD;
}; };
static int locomo_suspend(struct device *dev, pm_message_t state) static int locomo_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct locomo *lchip = dev_get_drvdata(dev); struct locomo *lchip = platform_get_drvdata(dev);
struct locomo_save_data *save; struct locomo_save_data *save;
unsigned long flags; unsigned long flags;
@ -560,7 +560,7 @@ static int locomo_suspend(struct device *dev, pm_message_t state)
if (!save) if (!save)
return -ENOMEM; return -ENOMEM;
dev->power.saved_state = (void *) save; dev->dev.power.saved_state = (void *) save;
spin_lock_irqsave(&lchip->lock, flags); spin_lock_irqsave(&lchip->lock, flags);
@ -594,14 +594,14 @@ static int locomo_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int locomo_resume(struct device *dev) static int locomo_resume(struct platform_device *dev)
{ {
struct locomo *lchip = dev_get_drvdata(dev); struct locomo *lchip = platform_get_drvdata(dev);
struct locomo_save_data *save; struct locomo_save_data *save;
unsigned long r; unsigned long r;
unsigned long flags; unsigned long flags;
save = (struct locomo_save_data *) dev->power.saved_state; save = (struct locomo_save_data *) dev->dev.power.saved_state;
if (!save) if (!save)
return 0; return 0;
@ -760,27 +760,26 @@ static void __locomo_remove(struct locomo *lchip)
kfree(lchip); kfree(lchip);
} }
static int locomo_probe(struct device *dev) static int locomo_probe(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *mem; struct resource *mem;
int irq; int irq;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!mem) if (!mem)
return -EINVAL; return -EINVAL;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(dev, 0);
return __locomo_probe(dev, mem, irq); return __locomo_probe(&dev->dev, mem, irq);
} }
static int locomo_remove(struct device *dev) static int locomo_remove(struct platform_device *dev)
{ {
struct locomo *lchip = dev_get_drvdata(dev); struct locomo *lchip = platform__get_drvdata(dev);
if (lchip) { if (lchip) {
__locomo_remove(lchip); __locomo_remove(lchip);
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
} }
return 0; return 0;
@ -792,15 +791,16 @@ static int locomo_remove(struct device *dev)
* the per-machine level, and then have this driver pick * the per-machine level, and then have this driver pick
* up the registered devices. * up the registered devices.
*/ */
static struct device_driver locomo_device_driver = { static struct platform_driver locomo_device_driver = {
.name = "locomo",
.bus = &platform_bus_type,
.probe = locomo_probe, .probe = locomo_probe,
.remove = locomo_remove, .remove = locomo_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = locomo_suspend, .suspend = locomo_suspend,
.resume = locomo_resume, .resume = locomo_resume,
#endif #endif
.driver = {
.name = "locomo",
},
}; };
/* /*
@ -1126,13 +1126,13 @@ static int __init locomo_init(void)
{ {
int ret = bus_register(&locomo_bus_type); int ret = bus_register(&locomo_bus_type);
if (ret == 0) if (ret == 0)
driver_register(&locomo_device_driver); platform_driver_register(&locomo_device_driver);
return ret; return ret;
} }
static void __exit locomo_exit(void) static void __exit locomo_exit(void)
{ {
driver_unregister(&locomo_device_driver); platform_driver_unregister(&locomo_device_driver);
bus_unregister(&locomo_bus_type); bus_unregister(&locomo_bus_type);
} }

View File

@ -801,9 +801,9 @@ struct sa1111_save_data {
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int sa1111_suspend(struct device *dev, pm_message_t state) static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct sa1111 *sachip = dev_get_drvdata(dev); struct sa1111 *sachip = platform_get_drvdata(dev);
struct sa1111_save_data *save; struct sa1111_save_data *save;
unsigned long flags; unsigned long flags;
unsigned int val; unsigned int val;
@ -812,7 +812,7 @@ static int sa1111_suspend(struct device *dev, pm_message_t state)
save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
if (!save) if (!save)
return -ENOMEM; return -ENOMEM;
dev->power.saved_state = save; dev->dev.power.saved_state = save;
spin_lock_irqsave(&sachip->lock, flags); spin_lock_irqsave(&sachip->lock, flags);
@ -859,14 +859,14 @@ static int sa1111_suspend(struct device *dev, pm_message_t state)
* restored by their respective drivers, and must be called * restored by their respective drivers, and must be called
* via LDM after this function. * via LDM after this function.
*/ */
static int sa1111_resume(struct device *dev) static int sa1111_resume(struct platform_device *dev)
{ {
struct sa1111 *sachip = dev_get_drvdata(dev); struct sa1111 *sachip = platform_get_drvdata(dev);
struct sa1111_save_data *save; struct sa1111_save_data *save;
unsigned long flags, id; unsigned long flags, id;
void __iomem *base; void __iomem *base;
save = (struct sa1111_save_data *)dev->power.saved_state; save = (struct sa1111_save_data *)dev->dev.power.saved_state;
if (!save) if (!save)
return 0; return 0;
@ -879,7 +879,7 @@ static int sa1111_resume(struct device *dev)
id = sa1111_readl(sachip->base + SA1111_SKID); id = sa1111_readl(sachip->base + SA1111_SKID);
if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { if ((id & SKID_ID_MASK) != SKID_SA1111_ID) {
__sa1111_remove(sachip); __sa1111_remove(sachip);
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
kfree(save); kfree(save);
return 0; return 0;
} }
@ -911,7 +911,7 @@ static int sa1111_resume(struct device *dev)
spin_unlock_irqrestore(&sachip->lock, flags); spin_unlock_irqrestore(&sachip->lock, flags);
dev->power.saved_state = NULL; dev->dev.power.saved_state = NULL;
kfree(save); kfree(save);
return 0; return 0;
@ -922,9 +922,8 @@ static int sa1111_resume(struct device *dev)
#define sa1111_resume NULL #define sa1111_resume NULL
#endif #endif
static int sa1111_probe(struct device *dev) static int sa1111_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *mem; struct resource *mem;
int irq; int irq;
@ -933,20 +932,20 @@ static int sa1111_probe(struct device *dev)
return -EINVAL; return -EINVAL;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
return __sa1111_probe(dev, mem, irq); return __sa1111_probe(&pdev->dev, mem, irq);
} }
static int sa1111_remove(struct device *dev) static int sa1111_remove(struct platform_device *pdev)
{ {
struct sa1111 *sachip = dev_get_drvdata(dev); struct sa1111 *sachip = platform_get_drvdata(pdev);
if (sachip) { if (sachip) {
__sa1111_remove(sachip); __sa1111_remove(sachip);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
#ifdef CONFIG_PM #ifdef CONFIG_PM
kfree(dev->power.saved_state); kfree(pdev->dev.power.saved_state);
dev->power.saved_state = NULL; pdev->dev.power.saved_state = NULL;
#endif #endif
} }
@ -962,13 +961,14 @@ static int sa1111_remove(struct device *dev)
* We also need to handle the SDRAM configuration for * We also need to handle the SDRAM configuration for
* PXA250/SA1110 machine classes. * PXA250/SA1110 machine classes.
*/ */
static struct device_driver sa1111_device_driver = { static struct platform_driver sa1111_device_driver = {
.name = "sa1111",
.bus = &platform_bus_type,
.probe = sa1111_probe, .probe = sa1111_probe,
.remove = sa1111_remove, .remove = sa1111_remove,
.suspend = sa1111_suspend, .suspend = sa1111_suspend,
.resume = sa1111_resume, .resume = sa1111_resume,
.driver = {
.name = "sa1111",
},
}; };
/* /*
@ -1256,13 +1256,13 @@ static int __init sa1111_init(void)
{ {
int ret = bus_register(&sa1111_bus_type); int ret = bus_register(&sa1111_bus_type);
if (ret == 0) if (ret == 0)
driver_register(&sa1111_device_driver); platform_driver_register(&sa1111_device_driver);
return ret; return ret;
} }
static void __exit sa1111_exit(void) static void __exit sa1111_exit(void)
{ {
driver_unregister(&sa1111_device_driver); platform_driver_unregister(&sa1111_device_driver);
bus_unregister(&sa1111_bus_type); bus_unregister(&sa1111_bus_type);
} }

View File

@ -98,9 +98,9 @@ static void check_scoop_reg(struct scoop_dev *sdev)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int scoop_suspend(struct device *dev, pm_message_t state) static int scoop_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct scoop_dev *sdev = dev_get_drvdata(dev); struct scoop_dev *sdev = platform_get_drvdata(dev);
check_scoop_reg(sdev); check_scoop_reg(sdev);
sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR); sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
@ -109,9 +109,9 @@ static int scoop_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int scoop_resume(struct device *dev) static int scoop_resume(struct platform_device *dev)
{ {
struct scoop_dev *sdev = dev_get_drvdata(dev); struct scoop_dev *sdev = platform_get_drvdata(dev);
check_scoop_reg(sdev); check_scoop_reg(sdev);
SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
@ -123,11 +123,10 @@ static int scoop_resume(struct device *dev)
#define scoop_resume NULL #define scoop_resume NULL
#endif #endif
int __init scoop_probe(struct device *dev) int __init scoop_probe(struct platform_device *pdev)
{ {
struct scoop_dev *devptr; struct scoop_dev *devptr;
struct scoop_config *inf; struct scoop_config *inf;
struct platform_device *pdev = to_platform_device(dev);
struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) if (!mem)
@ -141,7 +140,7 @@ int __init scoop_probe(struct device *dev)
memset(devptr, 0, sizeof(struct scoop_dev)); memset(devptr, 0, sizeof(struct scoop_dev));
spin_lock_init(&devptr->scoop_lock); spin_lock_init(&devptr->scoop_lock);
inf = dev->platform_data; inf = pdev->dev.platform_data;
devptr->base = ioremap(mem->start, mem->end - mem->start + 1); devptr->base = ioremap(mem->start, mem->end - mem->start + 1);
if (!devptr->base) { if (!devptr->base) {
@ -149,7 +148,7 @@ int __init scoop_probe(struct device *dev)
return -ENOMEM; return -ENOMEM;
} }
dev_set_drvdata(dev, devptr); platform_set_drvdata(pdev, devptr);
printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base); printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base);
@ -164,29 +163,30 @@ int __init scoop_probe(struct device *dev)
return 0; return 0;
} }
static int scoop_remove(struct device *dev) static int scoop_remove(struct platform_device *pdev)
{ {
struct scoop_dev *sdev = dev_get_drvdata(dev); struct scoop_dev *sdev = platform_get_drvdata(pdev);
if (sdev) { if (sdev) {
iounmap(sdev->base); iounmap(sdev->base);
kfree(sdev); kfree(sdev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
} }
return 0; return 0;
} }
static struct device_driver scoop_driver = { static struct platform_driver scoop_driver = {
.name = "sharp-scoop",
.bus = &platform_bus_type,
.probe = scoop_probe, .probe = scoop_probe,
.remove = scoop_remove, .remove = scoop_remove,
.suspend = scoop_suspend, .suspend = scoop_suspend,
.resume = scoop_resume, .resume = scoop_resume,
.driver = {
.name = "sharp-scoop",
},
}; };
int __init scoop_init(void) int __init scoop_init(void)
{ {
return driver_register(&scoop_driver); return platform_driver_register(&scoop_driver);
} }
subsys_initcall(scoop_init); subsys_initcall(scoop_init);

View File

@ -191,7 +191,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo)
ssp_machinfo = machinfo; ssp_machinfo = machinfo;
} }
static int __init corgi_ssp_probe(struct device *dev) static int __init corgi_ssp_probe(struct platform_device *dev)
{ {
int ret; int ret;
@ -216,13 +216,13 @@ static int __init corgi_ssp_probe(struct device *dev)
return ret; return ret;
} }
static int corgi_ssp_remove(struct device *dev) static int corgi_ssp_remove(struct platform_device *dev)
{ {
ssp_exit(&corgi_ssp_dev); ssp_exit(&corgi_ssp_dev);
return 0; return 0;
} }
static int corgi_ssp_suspend(struct device *dev, pm_message_t state) static int corgi_ssp_suspend(struct platform_device *dev, pm_message_t state)
{ {
ssp_flush(&corgi_ssp_dev); ssp_flush(&corgi_ssp_dev);
ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state); ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state);
@ -230,7 +230,7 @@ static int corgi_ssp_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int corgi_ssp_resume(struct device *dev) static int corgi_ssp_resume(struct platform_device *dev)
{ {
GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */ 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*/ GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/
@ -241,18 +241,19 @@ static int corgi_ssp_resume(struct device *dev)
return 0; return 0;
} }
static struct device_driver corgissp_driver = { static struct platform_driver corgissp_driver = {
.name = "corgi-ssp",
.bus = &platform_bus_type,
.probe = corgi_ssp_probe, .probe = corgi_ssp_probe,
.remove = corgi_ssp_remove, .remove = corgi_ssp_remove,
.suspend = corgi_ssp_suspend, .suspend = corgi_ssp_suspend,
.resume = corgi_ssp_resume, .resume = corgi_ssp_resume,
.driver = {
.name = "corgi-ssp",
},
}; };
int __init corgi_ssp_init(void) int __init corgi_ssp_init(void)
{ {
return driver_register(&corgissp_driver); return platform_driver_register(&corgissp_driver);
} }
arch_initcall(corgi_ssp_init); arch_initcall(corgi_ssp_init);

View File

@ -137,7 +137,7 @@ static struct sa1100_port_fns neponset_port_fns __initdata = {
.get_mctrl = neponset_get_mctrl, .get_mctrl = neponset_get_mctrl,
}; };
static int neponset_probe(struct device *dev) static int neponset_probe(struct platform_device *dev)
{ {
sa1100_register_uart_fns(&neponset_port_fns); sa1100_register_uart_fns(&neponset_port_fns);
@ -178,27 +178,27 @@ static int neponset_probe(struct device *dev)
/* /*
* LDM power management. * LDM power management.
*/ */
static int neponset_suspend(struct device *dev, pm_message_t state) static int neponset_suspend(struct platform_device *dev, pm_message_t state)
{ {
/* /*
* Save state. * Save state.
*/ */
if (!dev->power.saved_state) if (!dev->dev.power.saved_state)
dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL); dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->power.saved_state) if (!dev->dev.power.saved_state)
return -ENOMEM; return -ENOMEM;
*(unsigned int *)dev->power.saved_state = NCR_0; *(unsigned int *)dev->dev.power.saved_state = NCR_0;
return 0; return 0;
} }
static int neponset_resume(struct device *dev) static int neponset_resume(struct platform_device *dev)
{ {
if (dev->power.saved_state) { if (dev->dev.power.saved_state) {
NCR_0 = *(unsigned int *)dev->power.saved_state; NCR_0 = *(unsigned int *)dev->dev.power.saved_state;
kfree(dev->power.saved_state); kfree(dev->dev.power.saved_state);
dev->power.saved_state = NULL; dev->dev.power.saved_state = NULL;
} }
return 0; return 0;
@ -209,12 +209,13 @@ static int neponset_resume(struct device *dev)
#define neponset_resume NULL #define neponset_resume NULL
#endif #endif
static struct device_driver neponset_device_driver = { static struct platform_driver neponset_device_driver = {
.name = "neponset",
.bus = &platform_bus_type,
.probe = neponset_probe, .probe = neponset_probe,
.suspend = neponset_suspend, .suspend = neponset_suspend,
.resume = neponset_resume, .resume = neponset_resume,
.driver = {
.name = "neponset",
},
}; };
static struct resource neponset_resources[] = { static struct resource neponset_resources[] = {
@ -293,7 +294,7 @@ static struct platform_device *devices[] __initdata = {
static int __init neponset_init(void) static int __init neponset_init(void)
{ {
driver_register(&neponset_device_driver); platform_driver_register(&neponset_device_driver);
/* /*
* The Neponset is only present on the Assabet machine type. * The Neponset is only present on the Assabet machine type.

View File

@ -284,9 +284,10 @@ void uml_net_user_timer_expire(unsigned long _conn)
static DEFINE_SPINLOCK(devices_lock); static DEFINE_SPINLOCK(devices_lock);
static struct list_head devices = LIST_HEAD_INIT(devices); static struct list_head devices = LIST_HEAD_INIT(devices);
static struct device_driver uml_net_driver = { static struct platform_driver uml_net_driver = {
.name = DRIVER_NAME, .driver = {
.bus = &platform_bus_type, .name = DRIVER_NAME,
},
}; };
static int driver_registered; static int driver_registered;
@ -333,7 +334,7 @@ static int eth_configure(int n, void *init, char *mac,
/* sysfs register */ /* sysfs register */
if (!driver_registered) { if (!driver_registered) {
driver_register(&uml_net_driver); platform_driver_register(&uml_net_driver);
driver_registered = 1; driver_registered = 1;
} }
device->pdev.id = n; device->pdev.id = n;

View File

@ -823,9 +823,10 @@ static int ubd_mc_init(void)
__initcall(ubd_mc_init); __initcall(ubd_mc_init);
static struct device_driver ubd_driver = { static struct platform_driver ubd_driver = {
.name = DRIVER_NAME, .driver = {
.bus = &platform_bus_type, .name = DRIVER_NAME,
},
}; };
int ubd_init(void) int ubd_init(void)
@ -850,7 +851,7 @@ int ubd_init(void)
if (register_blkdev(fake_major, "ubd")) if (register_blkdev(fake_major, "ubd"))
return -1; return -1;
} }
driver_register(&ubd_driver); platform_driver_register(&ubd_driver);
for (i = 0; i < MAX_DEV; i++) for (i = 0; i < MAX_DEV; i++)
ubd_add(i); ubd_add(i);
return 0; return 0;

View File

@ -648,9 +648,10 @@ void iss_net_user_timer_expire(unsigned long _conn)
} }
static struct device_driver iss_net_driver = { static struct platform_driver iss_net_driver = {
.name = DRIVER_NAME, .driver = {
.bus = &platform_bus_type, .name = DRIVER_NAME,
},
}; };
static int driver_registered; static int driver_registered;
@ -701,7 +702,7 @@ static int iss_net_configure(int index, char *init)
/* sysfs register */ /* sysfs register */
if (!driver_registered) { if (!driver_registered) {
driver_register(&iss_net_driver); platform_driver_register(&iss_net_driver);
driver_registered = 1; driver_registered = 1;
} }

View File

@ -382,7 +382,7 @@ static struct rtc_ops s3c2410_rtcops = {
.proc = s3c2410_rtc_proc, .proc = s3c2410_rtc_proc,
}; };
static void s3c2410_rtc_enable(struct device *dev, int en) static void s3c2410_rtc_enable(struct platform_device *pdev, int en)
{ {
unsigned int tmp; unsigned int tmp;
@ -399,21 +399,21 @@ static void s3c2410_rtc_enable(struct device *dev, int en)
/* re-enable the device, and check it is ok */ /* re-enable the device, and check it is ok */
if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){
dev_info(dev, "rtc disabled, re-enabling\n"); dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
tmp = readb(S3C2410_RTCCON); tmp = readb(S3C2410_RTCCON);
writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON); writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON);
} }
if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){
dev_info(dev, "removing S3C2410_RTCCON_CNTSEL\n"); dev_info(&pdev->dev, "removing S3C2410_RTCCON_CNTSEL\n");
tmp = readb(S3C2410_RTCCON); tmp = readb(S3C2410_RTCCON);
writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON); writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON);
} }
if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){
dev_info(dev, "removing S3C2410_RTCCON_CLKRST\n"); dev_info(&pdev->dev, "removing S3C2410_RTCCON_CLKRST\n");
tmp = readb(S3C2410_RTCCON); tmp = readb(S3C2410_RTCCON);
writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON); writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON);
@ -421,7 +421,7 @@ static void s3c2410_rtc_enable(struct device *dev, int en)
} }
} }
static int s3c2410_rtc_remove(struct device *dev) static int s3c2410_rtc_remove(struct platform_device *dev)
{ {
unregister_rtc(&s3c2410_rtcops); unregister_rtc(&s3c2410_rtcops);
@ -438,25 +438,24 @@ static int s3c2410_rtc_remove(struct device *dev)
return 0; return 0;
} }
static int s3c2410_rtc_probe(struct device *dev) static int s3c2410_rtc_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *res; struct resource *res;
int ret; int ret;
pr_debug("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); pr_debug("%s: probe=%p\n", __FUNCTION__, pdev);
/* find the IRQs */ /* find the IRQs */
s3c2410_rtc_tickno = platform_get_irq(pdev, 1); s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
if (s3c2410_rtc_tickno <= 0) { if (s3c2410_rtc_tickno <= 0) {
dev_err(dev, "no irq for rtc tick\n"); dev_err(&pdev->dev, "no irq for rtc tick\n");
return -ENOENT; return -ENOENT;
} }
s3c2410_rtc_alarmno = platform_get_irq(pdev, 0); s3c2410_rtc_alarmno = platform_get_irq(pdev, 0);
if (s3c2410_rtc_alarmno <= 0) { if (s3c2410_rtc_alarmno <= 0) {
dev_err(dev, "no irq for alarm\n"); dev_err(&pdev->dev, "no irq for alarm\n");
return -ENOENT; return -ENOENT;
} }
@ -467,7 +466,7 @@ static int s3c2410_rtc_probe(struct device *dev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) { if (res == NULL) {
dev_err(dev, "failed to get memory region resource\n"); dev_err(&pdev->dev, "failed to get memory region resource\n");
return -ENOENT; return -ENOENT;
} }
@ -475,14 +474,14 @@ static int s3c2410_rtc_probe(struct device *dev)
pdev->name); pdev->name);
if (s3c2410_rtc_mem == NULL) { if (s3c2410_rtc_mem == NULL) {
dev_err(dev, "failed to reserve memory region\n"); dev_err(&pdev->dev, "failed to reserve memory region\n");
ret = -ENOENT; ret = -ENOENT;
goto exit_err; goto exit_err;
} }
s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1); s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1);
if (s3c2410_rtc_base == NULL) { if (s3c2410_rtc_base == NULL) {
dev_err(dev, "failed ioremap()\n"); dev_err(&pdev->dev, "failed ioremap()\n");
ret = -EINVAL; ret = -EINVAL;
goto exit_err; goto exit_err;
} }
@ -494,7 +493,7 @@ static int s3c2410_rtc_probe(struct device *dev)
/* check to see if everything is setup correctly */ /* check to see if everything is setup correctly */
s3c2410_rtc_enable(dev, 1); s3c2410_rtc_enable(pdev, 1);
pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON)); pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON));
@ -506,7 +505,7 @@ static int s3c2410_rtc_probe(struct device *dev)
return 0; return 0;
exit_err: exit_err:
dev_err(dev, "error %d during initialisation\n", ret); dev_err(&pdev->dev, "error %d during initialisation\n", ret);
return ret; return ret;
} }
@ -519,7 +518,7 @@ static struct timespec s3c2410_rtc_delta;
static int ticnt_save; static int ticnt_save;
static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state) static int s3c2410_rtc_suspend(struct platform_device *pdev, pm_message_t state)
{ {
struct rtc_time tm; struct rtc_time tm;
struct timespec time; struct timespec time;
@ -535,19 +534,19 @@ static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state)
s3c2410_rtc_gettime(&tm); s3c2410_rtc_gettime(&tm);
rtc_tm_to_time(&tm, &time.tv_sec); rtc_tm_to_time(&tm, &time.tv_sec);
save_time_delta(&s3c2410_rtc_delta, &time); save_time_delta(&s3c2410_rtc_delta, &time);
s3c2410_rtc_enable(dev, 0); s3c2410_rtc_enable(pdev, 0);
return 0; return 0;
} }
static int s3c2410_rtc_resume(struct device *dev) static int s3c2410_rtc_resume(struct platform_device *pdev)
{ {
struct rtc_time tm; struct rtc_time tm;
struct timespec time; struct timespec time;
time.tv_nsec = 0; time.tv_nsec = 0;
s3c2410_rtc_enable(dev, 1); s3c2410_rtc_enable(pdev, 1);
s3c2410_rtc_gettime(&tm); s3c2410_rtc_gettime(&tm);
rtc_tm_to_time(&tm, &time.tv_sec); rtc_tm_to_time(&tm, &time.tv_sec);
restore_time_delta(&s3c2410_rtc_delta, &time); restore_time_delta(&s3c2410_rtc_delta, &time);
@ -560,14 +559,15 @@ static int s3c2410_rtc_resume(struct device *dev)
#define s3c2410_rtc_resume NULL #define s3c2410_rtc_resume NULL
#endif #endif
static struct device_driver s3c2410_rtcdrv = { static struct platform_driver s3c2410_rtcdrv = {
.name = "s3c2410-rtc",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = s3c2410_rtc_probe, .probe = s3c2410_rtc_probe,
.remove = s3c2410_rtc_remove, .remove = s3c2410_rtc_remove,
.suspend = s3c2410_rtc_suspend, .suspend = s3c2410_rtc_suspend,
.resume = s3c2410_rtc_resume, .resume = s3c2410_rtc_resume,
.driver = {
.name = "s3c2410-rtc",
.owner = THIS_MODULE,
},
}; };
static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; 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) static int __init s3c2410_rtc_init(void)
{ {
printk(banner); printk(banner);
return driver_register(&s3c2410_rtcdrv); return platform_driver_register(&s3c2410_rtcdrv);
} }
static void __exit s3c2410_rtc_exit(void) static void __exit s3c2410_rtc_exit(void)
{ {
driver_unregister(&s3c2410_rtcdrv); platform_driver_unregister(&s3c2410_rtcdrv);
} }
module_init(s3c2410_rtc_init); module_init(s3c2410_rtc_init);

View File

@ -1168,7 +1168,7 @@ static int sonypi_disable(void)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int old_camera_power; static int old_camera_power;
static int sonypi_suspend(struct device *dev, pm_message_t state) static int sonypi_suspend(struct platform_device *dev, pm_message_t state)
{ {
old_camera_power = sonypi_device.camera_power; old_camera_power = sonypi_device.camera_power;
sonypi_disable(); sonypi_disable();
@ -1176,26 +1176,27 @@ static int sonypi_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int sonypi_resume(struct device *dev) static int sonypi_resume(struct platform_device *dev)
{ {
sonypi_enable(old_camera_power); sonypi_enable(old_camera_power);
return 0; return 0;
} }
#endif #endif
static void sonypi_shutdown(struct device *dev) static void sonypi_shutdown(struct platform_device *dev)
{ {
sonypi_disable(); sonypi_disable();
} }
static struct device_driver sonypi_driver = { static struct platform_driver sonypi_driver = {
.name = "sonypi",
.bus = &platform_bus_type,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = sonypi_suspend, .suspend = sonypi_suspend,
.resume = sonypi_resume, .resume = sonypi_resume,
#endif #endif
.shutdown = sonypi_shutdown, .shutdown = sonypi_shutdown,
.driver = {
.name = "sonypi",
},
}; };
static int __devinit sonypi_create_input_devices(void) static int __devinit sonypi_create_input_devices(void)
@ -1455,20 +1456,20 @@ static int __init sonypi_init(void)
if (!dmi_check_system(sonypi_dmi_table)) if (!dmi_check_system(sonypi_dmi_table))
return -ENODEV; return -ENODEV;
ret = driver_register(&sonypi_driver); ret = platform_driver_register(&sonypi_driver);
if (ret) if (ret)
return ret; return ret;
ret = sonypi_probe(); ret = sonypi_probe();
if (ret) if (ret)
driver_unregister(&sonypi_driver); platform_driver_unregister(&sonypi_driver);
return ret; return ret;
} }
static void __exit sonypi_exit(void) static void __exit sonypi_exit(void)
{ {
driver_unregister(&sonypi_driver); platform_driver_unregister(&sonypi_driver);
sonypi_remove(); sonypi_remove();
} }

View File

@ -283,7 +283,7 @@ static void tb0219_pci_irq_init(void)
vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW); vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW);
} }
static int tb0219_probe(struct device *dev) static int tb0219_probe(struct platform_device *dev)
{ {
int retval; int retval;
@ -319,7 +319,7 @@ static int tb0219_probe(struct device *dev)
return 0; return 0;
} }
static int tb0219_remove(struct device *dev) static int tb0219_remove(struct platform_device *dev)
{ {
_machine_restart = old_machine_restart; _machine_restart = old_machine_restart;
@ -333,11 +333,12 @@ static int tb0219_remove(struct device *dev)
static struct platform_device *tb0219_platform_device; static struct platform_device *tb0219_platform_device;
static struct device_driver tb0219_device_driver = { static struct platform_driver tb0219_device_driver = {
.name = "TB0219",
.bus = &platform_bus_type,
.probe = tb0219_probe, .probe = tb0219_probe,
.remove = tb0219_remove, .remove = tb0219_remove,
.driver = {
.name = "TB0219",
},
}; };
static int __devinit tanbac_tb0219_init(void) static int __devinit tanbac_tb0219_init(void)
@ -348,7 +349,7 @@ static int __devinit tanbac_tb0219_init(void)
if (IS_ERR(tb0219_platform_device)) if (IS_ERR(tb0219_platform_device))
return PTR_ERR(tb0219_platform_device); return PTR_ERR(tb0219_platform_device);
retval = driver_register(&tb0219_device_driver); retval = platform_driver_register(&tb0219_device_driver);
if (retval < 0) if (retval < 0)
platform_device_unregister(tb0219_platform_device); platform_device_unregister(tb0219_platform_device);
@ -357,7 +358,7 @@ static int __devinit tanbac_tb0219_init(void)
static void __devexit tanbac_tb0219_exit(void) static void __devexit tanbac_tb0219_exit(void)
{ {
driver_unregister(&tb0219_device_driver); platform_driver_unregister(&tb0219_device_driver);
platform_device_unregister(tb0219_platform_device); platform_device_unregister(tb0219_platform_device);
} }

View File

@ -613,7 +613,7 @@ static struct file_operations gpio_fops = {
.release = gpio_release, .release = gpio_release,
}; };
static int giu_probe(struct device *dev) static int giu_probe(struct platform_device *dev)
{ {
unsigned long start, size, flags = 0; unsigned long start, size, flags = 0;
unsigned int nr_pins = 0; unsigned int nr_pins = 0;
@ -697,7 +697,7 @@ static int giu_probe(struct device *dev)
return cascade_irq(GIUINT_IRQ, giu_get_irq); return cascade_irq(GIUINT_IRQ, giu_get_irq);
} }
static int giu_remove(struct device *dev) static int giu_remove(struct platform_device *dev)
{ {
iounmap(giu_base); iounmap(giu_base);
@ -710,11 +710,12 @@ static int giu_remove(struct device *dev)
static struct platform_device *giu_platform_device; static struct platform_device *giu_platform_device;
static struct device_driver giu_device_driver = { static struct platform_driver giu_device_driver = {
.name = "GIU",
.bus = &platform_bus_type,
.probe = giu_probe, .probe = giu_probe,
.remove = giu_remove, .remove = giu_remove,
.driver = {
.name = "GIU",
},
}; };
static int __devinit vr41xx_giu_init(void) static int __devinit vr41xx_giu_init(void)
@ -725,7 +726,7 @@ static int __devinit vr41xx_giu_init(void)
if (IS_ERR(giu_platform_device)) if (IS_ERR(giu_platform_device))
return PTR_ERR(giu_platform_device); return PTR_ERR(giu_platform_device);
retval = driver_register(&giu_device_driver); retval = platform_driver_register(&giu_device_driver);
if (retval < 0) if (retval < 0)
platform_device_unregister(giu_platform_device); platform_device_unregister(giu_platform_device);
@ -734,7 +735,7 @@ static int __devinit vr41xx_giu_init(void)
static void __devexit vr41xx_giu_exit(void) static void __devexit vr41xx_giu_exit(void)
{ {
driver_unregister(&giu_device_driver); platform_driver_unregister(&giu_device_driver);
platform_device_unregister(giu_platform_device); platform_device_unregister(giu_platform_device);
} }

View File

@ -560,13 +560,11 @@ static struct miscdevice rtc_miscdevice = {
.fops = &rtc_fops, .fops = &rtc_fops,
}; };
static int rtc_probe(struct device *dev) static int rtc_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev;
unsigned int irq; unsigned int irq;
int retval; int retval;
pdev = to_platform_device(dev);
if (pdev->num_resources != 2) if (pdev->num_resources != 2)
return -EBUSY; return -EBUSY;
@ -635,7 +633,7 @@ static int rtc_probe(struct device *dev)
return 0; return 0;
} }
static int rtc_remove(struct device *dev) static int rtc_remove(struct platform_device *dev)
{ {
int retval; int retval;
@ -655,11 +653,12 @@ static int rtc_remove(struct device *dev)
static struct platform_device *rtc_platform_device; static struct platform_device *rtc_platform_device;
static struct device_driver rtc_device_driver = { static struct platform_driver rtc_device_driver = {
.name = rtc_name,
.bus = &platform_bus_type,
.probe = rtc_probe, .probe = rtc_probe,
.remove = rtc_remove, .remove = rtc_remove,
.driver = {
.name = rtc_name,
},
}; };
static int __devinit vr41xx_rtc_init(void) static int __devinit vr41xx_rtc_init(void)
@ -691,7 +690,7 @@ static int __devinit vr41xx_rtc_init(void)
if (IS_ERR(rtc_platform_device)) if (IS_ERR(rtc_platform_device))
return PTR_ERR(rtc_platform_device); return PTR_ERR(rtc_platform_device);
retval = driver_register(&rtc_device_driver); retval = platform_driver_register(&rtc_device_driver);
if (retval < 0) if (retval < 0)
platform_device_unregister(rtc_platform_device); platform_device_unregister(rtc_platform_device);
@ -700,7 +699,7 @@ static int __devinit vr41xx_rtc_init(void)
static void __devexit vr41xx_rtc_exit(void) static void __devexit vr41xx_rtc_exit(void)
{ {
driver_unregister(&rtc_device_driver); platform_driver_unregister(&rtc_device_driver);
platform_device_unregister(rtc_platform_device); platform_device_unregister(rtc_platform_device);
} }

View File

@ -139,7 +139,7 @@ static int mpcore_wdt_set_heartbeat(int t)
*/ */
static int mpcore_wdt_open(struct inode *inode, struct file *file) static int mpcore_wdt_open(struct inode *inode, struct file *file)
{ {
struct mpcore_wdt *wdt = dev_get_drvdata(&mpcore_wdt_dev->dev); struct mpcore_wdt *wdt = platform_get_drvdata(mpcore_wdt_dev);
if (test_and_set_bit(0, &wdt->timer_alive)) if (test_and_set_bit(0, &wdt->timer_alive))
return -EBUSY; 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 * System shutdown handler. Turn off the watchdog if we're
* restarting or halting the system. * restarting or halting the system.
*/ */
static void mpcore_wdt_shutdown(struct device *_dev) static void mpcore_wdt_shutdown(struct platform_device *dev)
{ {
struct mpcore_wdt *wdt = dev_get_drvdata(_dev); struct mpcore_wdt *wdt = platform_get_drvdata(dev);
if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT) if (system_state == SYSTEM_RESTART || system_state == SYSTEM_HALT)
mpcore_wdt_stop(wdt); mpcore_wdt_stop(wdt);
@ -317,9 +317,8 @@ static struct miscdevice mpcore_wdt_miscdev = {
.fops = &mpcore_wdt_fops, .fops = &mpcore_wdt_fops,
}; };
static int __devinit mpcore_wdt_probe(struct device *_dev) static int __devinit mpcore_wdt_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev);
struct mpcore_wdt *wdt; struct mpcore_wdt *wdt;
struct resource *res; struct resource *res;
int ret; int ret;
@ -364,7 +363,7 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
} }
mpcore_wdt_stop(wdt); mpcore_wdt_stop(wdt);
dev_set_drvdata(&dev->dev, wdt); platform_set_drvdata(&dev->dev, wdt);
mpcore_wdt_dev = dev; mpcore_wdt_dev = dev;
return 0; return 0;
@ -379,11 +378,11 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
return ret; return ret;
} }
static int __devexit mpcore_wdt_remove(struct device *dev) static int __devexit mpcore_wdt_remove(struct platform_device *dev)
{ {
struct mpcore_wdt *wdt = dev_get_drvdata(dev); struct mpcore_wdt *wdt = platform_get_drvdata(dev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
misc_deregister(&mpcore_wdt_miscdev); misc_deregister(&mpcore_wdt_miscdev);
@ -395,13 +394,14 @@ static int __devexit mpcore_wdt_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver mpcore_wdt_driver = { static struct platform_driver mpcore_wdt_driver = {
.owner = THIS_MODULE,
.name = "mpcore_wdt",
.bus = &platform_bus_type,
.probe = mpcore_wdt_probe, .probe = mpcore_wdt_probe,
.remove = __devexit_p(mpcore_wdt_remove), .remove = __devexit_p(mpcore_wdt_remove),
.shutdown = mpcore_wdt_shutdown, .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"; 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); printk(banner, mpcore_noboot, mpcore_margin, nowayout);
return driver_register(&mpcore_wdt_driver); return platform_driver_register(&mpcore_wdt_driver);
} }
static void __exit mpcore_wdt_exit(void) static void __exit mpcore_wdt_exit(void)
{ {
driver_unregister(&mpcore_wdt_driver); platform_driver_unregister(&mpcore_wdt_driver);
} }
module_init(mpcore_wdt_init); module_init(mpcore_wdt_init);

View File

@ -182,10 +182,9 @@ static struct miscdevice mv64x60_wdt_miscdev = {
.fops = &mv64x60_wdt_fops, .fops = &mv64x60_wdt_fops,
}; };
static int __devinit mv64x60_wdt_probe(struct device *dev) static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
{ {
struct platform_device *pd = to_platform_device(dev); struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data;
struct mv64x60_wdt_pdata *pdata = pd->dev.platform_data;
int bus_clk = 133; int bus_clk = 133;
mv64x60_wdt_timeout = 10; mv64x60_wdt_timeout = 10;
@ -202,7 +201,7 @@ static int __devinit mv64x60_wdt_probe(struct device *dev)
return misc_register(&mv64x60_wdt_miscdev); return misc_register(&mv64x60_wdt_miscdev);
} }
static int __devexit mv64x60_wdt_remove(struct device *dev) static int __devexit mv64x60_wdt_remove(struct platform_device *dev)
{ {
misc_deregister(&mv64x60_wdt_miscdev); misc_deregister(&mv64x60_wdt_miscdev);
@ -212,12 +211,13 @@ static int __devexit mv64x60_wdt_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver mv64x60_wdt_driver = { static struct platform_driver mv64x60_wdt_driver = {
.owner = THIS_MODULE,
.name = MV64x60_WDT_NAME,
.bus = &platform_bus_type,
.probe = mv64x60_wdt_probe, .probe = mv64x60_wdt_probe,
.remove = __devexit_p(mv64x60_wdt_remove), .remove = __devexit_p(mv64x60_wdt_remove),
.driver = {
.owner = THIS_MODULE,
.name = MV64x60_WDT_NAME,
},
}; };
static struct platform_device *mv64x60_wdt_dev; static struct platform_device *mv64x60_wdt_dev;
@ -235,14 +235,14 @@ static int __init mv64x60_wdt_init(void)
goto out; goto out;
} }
ret = driver_register(&mv64x60_wdt_driver); ret = platform_driver_register(&mv64x60_wdt_driver);
out: out:
return ret; return ret;
} }
static void __exit mv64x60_wdt_exit(void) static void __exit mv64x60_wdt_exit(void)
{ {
driver_unregister(&mv64x60_wdt_driver); platform_driver_unregister(&mv64x60_wdt_driver);
platform_device_unregister(mv64x60_wdt_dev); platform_device_unregister(mv64x60_wdt_dev);
} }

View File

@ -347,15 +347,14 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
} }
/* device interface */ /* device interface */
static int s3c2410wdt_probe(struct device *dev) static int s3c2410wdt_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *res; struct resource *res;
int started = 0; int started = 0;
int ret; int ret;
int size; int size;
DBG("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); DBG("%s: probe=%p\n", __FUNCTION__, pdev);
/* get the memory region for the watchdog timer */ /* get the memory region for the watchdog timer */
@ -386,13 +385,13 @@ static int s3c2410wdt_probe(struct device *dev)
return -ENOENT; return -ENOENT;
} }
ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, dev); ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev);
if (ret != 0) { if (ret != 0) {
printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); printk(KERN_INFO PFX "failed to install irq (%d)\n", ret);
return ret; return ret;
} }
wdt_clock = clk_get(dev, "watchdog"); wdt_clock = clk_get(&pdev->dev, "watchdog");
if (wdt_clock == NULL) { if (wdt_clock == NULL) {
printk(KERN_INFO PFX "failed to find watchdog clock source\n"); printk(KERN_INFO PFX "failed to find watchdog clock source\n");
return -ENOENT; return -ENOENT;
@ -430,7 +429,7 @@ static int s3c2410wdt_probe(struct device *dev)
return 0; return 0;
} }
static int s3c2410wdt_remove(struct device *dev) static int s3c2410wdt_remove(struct platform_device *dev)
{ {
if (wdt_mem != NULL) { if (wdt_mem != NULL) {
release_resource(wdt_mem); release_resource(wdt_mem);
@ -454,7 +453,7 @@ static int s3c2410wdt_remove(struct device *dev)
return 0; return 0;
} }
static void s3c2410wdt_shutdown(struct device *dev) static void s3c2410wdt_shutdown(struct platform_device *dev)
{ {
s3c2410wdt_stop(); s3c2410wdt_stop();
} }
@ -464,7 +463,7 @@ static void s3c2410wdt_shutdown(struct device *dev)
static unsigned long wtcon_save; static unsigned long wtcon_save;
static unsigned long wtdat_save; static unsigned long wtdat_save;
static int s3c2410wdt_suspend(struct device *dev, pm_message_t state) static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state)
{ {
/* Save watchdog state, and turn it off. */ /* Save watchdog state, and turn it off. */
wtcon_save = readl(wdt_base + S3C2410_WTCON); wtcon_save = readl(wdt_base + S3C2410_WTCON);
@ -476,7 +475,7 @@ static int s3c2410wdt_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int s3c2410wdt_resume(struct device *dev) static int s3c2410wdt_resume(struct platform_device *dev)
{ {
/* Restore watchdog state. */ /* Restore watchdog state. */
@ -496,15 +495,16 @@ static int s3c2410wdt_resume(struct device *dev)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct device_driver s3c2410wdt_driver = { static struct platform_driver s3c2410wdt_driver = {
.owner = THIS_MODULE,
.name = "s3c2410-wdt",
.bus = &platform_bus_type,
.probe = s3c2410wdt_probe, .probe = s3c2410wdt_probe,
.remove = s3c2410wdt_remove, .remove = s3c2410wdt_remove,
.shutdown = s3c2410wdt_shutdown, .shutdown = s3c2410wdt_shutdown,
.suspend = s3c2410wdt_suspend, .suspend = s3c2410wdt_suspend,
.resume = s3c2410wdt_resume, .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) static int __init watchdog_init(void)
{ {
printk(banner); printk(banner);
return driver_register(&s3c2410wdt_driver); return platform_driver_register(&s3c2410wdt_driver);
} }
static void __exit watchdog_exit(void) static void __exit watchdog_exit(void)
{ {
driver_unregister(&s3c2410wdt_driver); platform_driver_unregister(&s3c2410wdt_driver);
} }
module_init(watchdog_init); module_init(watchdog_init);

View File

@ -284,7 +284,7 @@ out:
/* Device model stuff */ /* Device model stuff */
static int hdaps_probe(struct device *dev) static int hdaps_probe(struct platform_device *dev)
{ {
int ret; int ret;
@ -296,17 +296,18 @@ static int hdaps_probe(struct device *dev)
return 0; return 0;
} }
static int hdaps_resume(struct device *dev) static int hdaps_resume(struct platform_device *dev)
{ {
return hdaps_device_init(); return hdaps_device_init();
} }
static struct device_driver hdaps_driver = { static struct platform_driver hdaps_driver = {
.name = "hdaps",
.bus = &platform_bus_type,
.owner = THIS_MODULE,
.probe = hdaps_probe, .probe = hdaps_probe,
.resume = hdaps_resume .resume = hdaps_resume,
.driver = {
.name = "hdaps",
.owner = THIS_MODULE,
},
}; };
/* Input class stuff */ /* Input class stuff */
@ -550,7 +551,7 @@ static int __init hdaps_init(void)
goto out; goto out;
} }
ret = driver_register(&hdaps_driver); ret = platform_driver_register(&hdaps_driver);
if (ret) if (ret)
goto out_region; goto out_region;
@ -583,7 +584,7 @@ static int __init hdaps_init(void)
out_device: out_device:
platform_device_unregister(pdev); platform_device_unregister(pdev);
out_driver: out_driver:
driver_unregister(&hdaps_driver); platform_driver_unregister(&hdaps_driver);
out_region: out_region:
release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
out: out:
@ -597,7 +598,7 @@ static void __exit hdaps_exit(void)
input_unregister_device(&hdaps_idev); input_unregister_device(&hdaps_idev);
sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
platform_device_unregister(pdev); platform_device_unregister(pdev);
driver_unregister(&hdaps_driver); platform_driver_unregister(&hdaps_driver);
release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS); release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
printk(KERN_INFO "hdaps: driver unloaded.\n"); printk(KERN_INFO "hdaps: driver unloaded.\n");

View File

@ -405,10 +405,9 @@ static struct i2c_algorithm iop3xx_i2c_algo = {
}; };
static int static int
iop3xx_i2c_remove(struct device *device) iop3xx_i2c_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(device); struct i2c_adapter *padapter = platform_get_drvdata(pdev);
struct i2c_adapter *padapter = dev_get_drvdata(&pdev->dev);
struct i2c_algo_iop3xx_data *adapter_data = struct i2c_algo_iop3xx_data *adapter_data =
(struct i2c_algo_iop3xx_data *)padapter->algo_data; (struct i2c_algo_iop3xx_data *)padapter->algo_data;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@ -426,15 +425,14 @@ iop3xx_i2c_remove(struct device *device)
kfree(adapter_data); kfree(adapter_data);
kfree(padapter); kfree(padapter);
dev_set_drvdata(&pdev->dev, NULL); platform_set_drvdata(pdev, NULL);
return 0; return 0;
} }
static int static int
iop3xx_i2c_probe(struct device *dev) iop3xx_i2c_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *res; struct resource *res;
int ret; int ret;
struct i2c_adapter *new_adapter; struct i2c_adapter *new_adapter;
@ -499,7 +497,7 @@ iop3xx_i2c_probe(struct device *dev)
iop3xx_i2c_set_slave_addr(adapter_data); iop3xx_i2c_set_slave_addr(adapter_data);
iop3xx_i2c_enable(adapter_data); iop3xx_i2c_enable(adapter_data);
dev_set_drvdata(&pdev->dev, new_adapter); platform_set_drvdata(pdev, new_adapter);
new_adapter->algo_data = adapter_data; new_adapter->algo_data = adapter_data;
i2c_add_adapter(new_adapter); i2c_add_adapter(new_adapter);
@ -523,24 +521,25 @@ out:
} }
static struct device_driver iop3xx_i2c_driver = { static struct platform_driver iop3xx_i2c_driver = {
.owner = THIS_MODULE,
.name = "IOP3xx-I2C",
.bus = &platform_bus_type,
.probe = iop3xx_i2c_probe, .probe = iop3xx_i2c_probe,
.remove = iop3xx_i2c_remove .remove = iop3xx_i2c_remove,
.driver = {
.owner = THIS_MODULE,
.name = "IOP3xx-I2C",
},
}; };
static int __init static int __init
i2c_iop3xx_init (void) i2c_iop3xx_init (void)
{ {
return driver_register(&iop3xx_i2c_driver); return platform_driver_register(&iop3xx_i2c_driver);
} }
static void __exit static void __exit
i2c_iop3xx_exit (void) i2c_iop3xx_exit (void)
{ {
driver_unregister(&iop3xx_i2c_driver); platform_driver_unregister(&iop3xx_i2c_driver);
return; return;
} }

View File

@ -86,12 +86,11 @@ struct ixp2000_i2c_data {
struct i2c_algo_bit_data algo_data; struct i2c_algo_bit_data algo_data;
}; };
static int ixp2000_i2c_remove(struct device *dev) static int ixp2000_i2c_remove(struct platform_device *plat_dev)
{ {
struct platform_device *plat_dev = to_platform_device(dev); struct ixp2000_i2c_data *drv_data = platform_get_drvdata(plat_dev);
struct ixp2000_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
dev_set_drvdata(&plat_dev->dev, NULL); platform_set_drvdata(plat_dev, NULL);
i2c_bit_del_bus(&drv_data->adapter); i2c_bit_del_bus(&drv_data->adapter);
@ -100,10 +99,9 @@ static int ixp2000_i2c_remove(struct device *dev)
return 0; return 0;
} }
static int ixp2000_i2c_probe(struct device *dev) static int ixp2000_i2c_probe(struct platform_device *plat_dev)
{ {
int err; int err;
struct platform_device *plat_dev = to_platform_device(dev);
struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data;
struct ixp2000_i2c_data *drv_data = struct ixp2000_i2c_data *drv_data =
kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL);
@ -139,27 +137,28 @@ static int ixp2000_i2c_probe(struct device *dev)
return err; return err;
} }
dev_set_drvdata(&plat_dev->dev, drv_data); platform_set_drvdata(plat_dev, drv_data);
return 0; return 0;
} }
static struct device_driver ixp2000_i2c_driver = { static struct platform_driver ixp2000_i2c_driver = {
.owner = THIS_MODULE,
.name = "IXP2000-I2C",
.bus = &platform_bus_type,
.probe = ixp2000_i2c_probe, .probe = ixp2000_i2c_probe,
.remove = ixp2000_i2c_remove, .remove = ixp2000_i2c_remove,
.driver = {
.name = "IXP2000-I2C",
.owner = THIS_MODULE,
},
}; };
static int __init ixp2000_i2c_init(void) static int __init ixp2000_i2c_init(void)
{ {
return driver_register(&ixp2000_i2c_driver); return platform_driver_register(&ixp2000_i2c_driver);
} }
static void __exit ixp2000_i2c_exit(void) static void __exit ixp2000_i2c_exit(void)
{ {
driver_unregister(&ixp2000_i2c_driver); platform_driver_unregister(&ixp2000_i2c_driver);
} }
module_init(ixp2000_i2c_init); module_init(ixp2000_i2c_init);

View File

@ -87,12 +87,11 @@ struct ixp4xx_i2c_data {
struct i2c_algo_bit_data algo_data; struct i2c_algo_bit_data algo_data;
}; };
static int ixp4xx_i2c_remove(struct device *dev) static int ixp4xx_i2c_remove(struct platform_device *plat_dev)
{ {
struct platform_device *plat_dev = to_platform_device(dev); struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev);
struct ixp4xx_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
dev_set_drvdata(&plat_dev->dev, NULL); platform_set_drvdata(plat_dev, NULL);
i2c_bit_del_bus(&drv_data->adapter); i2c_bit_del_bus(&drv_data->adapter);
@ -101,10 +100,9 @@ static int ixp4xx_i2c_remove(struct device *dev)
return 0; return 0;
} }
static int ixp4xx_i2c_probe(struct device *dev) static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
{ {
int err; int err;
struct platform_device *plat_dev = to_platform_device(dev);
struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data;
struct ixp4xx_i2c_data *drv_data = struct ixp4xx_i2c_data *drv_data =
kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
@ -148,27 +146,28 @@ static int ixp4xx_i2c_probe(struct device *dev)
return err; return err;
} }
dev_set_drvdata(&plat_dev->dev, drv_data); platform_set_drvdata(plat_dev, drv_data);
return 0; return 0;
} }
static struct device_driver ixp4xx_i2c_driver = { static struct platform_driver ixp4xx_i2c_driver = {
.owner = THIS_MODULE,
.name = "IXP4XX-I2C",
.bus = &platform_bus_type,
.probe = ixp4xx_i2c_probe, .probe = ixp4xx_i2c_probe,
.remove = ixp4xx_i2c_remove, .remove = ixp4xx_i2c_remove,
.driver = {
.name = "IXP4XX-I2C",
.owner = THIS_MODULE,
},
}; };
static int __init ixp4xx_i2c_init(void) static int __init ixp4xx_i2c_init(void)
{ {
return driver_register(&ixp4xx_i2c_driver); return platform_driver_register(&ixp4xx_i2c_driver);
} }
static void __exit ixp4xx_i2c_exit(void) static void __exit ixp4xx_i2c_exit(void)
{ {
driver_unregister(&ixp4xx_i2c_driver); platform_driver_unregister(&ixp4xx_i2c_driver);
} }
module_init(ixp4xx_i2c_init); module_init(ixp4xx_i2c_init);

View File

@ -288,11 +288,10 @@ static struct i2c_adapter mpc_ops = {
.retries = 1 .retries = 1
}; };
static int fsl_i2c_probe(struct device *device) static int fsl_i2c_probe(struct platform_device *pdev)
{ {
int result = 0; int result = 0;
struct mpc_i2c *i2c; struct mpc_i2c *i2c;
struct platform_device *pdev = to_platform_device(device);
struct fsl_i2c_platform_data *pdata; struct fsl_i2c_platform_data *pdata;
struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@ -323,7 +322,7 @@ static int fsl_i2c_probe(struct device *device)
} }
mpc_i2c_setclock(i2c); mpc_i2c_setclock(i2c);
dev_set_drvdata(device, i2c); platform_set_drvdata(pdev, i2c);
i2c->adap = mpc_ops; i2c->adap = mpc_ops;
i2c_set_adapdata(&i2c->adap, i2c); i2c_set_adapdata(&i2c->adap, i2c);
@ -345,12 +344,12 @@ static int fsl_i2c_probe(struct device *device)
return result; return result;
}; };
static int fsl_i2c_remove(struct device *device) static int fsl_i2c_remove(struct platform_device *pdev)
{ {
struct mpc_i2c *i2c = dev_get_drvdata(device); struct mpc_i2c *i2c = platform_get_drvdata(pdev);
i2c_del_adapter(&i2c->adap); i2c_del_adapter(&i2c->adap);
dev_set_drvdata(device, NULL); platform_set_drvdata(pdev, NULL);
if (i2c->irq != 0) if (i2c->irq != 0)
free_irq(i2c->irq, i2c); free_irq(i2c->irq, i2c);
@ -361,22 +360,23 @@ static int fsl_i2c_remove(struct device *device)
}; };
/* Structure for a device driver */ /* Structure for a device driver */
static struct device_driver fsl_i2c_driver = { static struct platform_driver fsl_i2c_driver = {
.owner = THIS_MODULE,
.name = "fsl-i2c",
.bus = &platform_bus_type,
.probe = fsl_i2c_probe, .probe = fsl_i2c_probe,
.remove = fsl_i2c_remove, .remove = fsl_i2c_remove,
.driver = {
.owner = THIS_MODULE,
.name = "fsl-i2c",
},
}; };
static int __init fsl_i2c_init(void) static int __init fsl_i2c_init(void)
{ {
return driver_register(&fsl_i2c_driver); return platform_driver_register(&fsl_i2c_driver);
} }
static void __exit fsl_i2c_exit(void) static void __exit fsl_i2c_exit(void)
{ {
driver_unregister(&fsl_i2c_driver); platform_driver_unregister(&fsl_i2c_driver);
} }
module_init(fsl_i2c_init); module_init(fsl_i2c_init);

View File

@ -492,11 +492,10 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
} }
static int __devinit static int __devinit
mv64xxx_i2c_probe(struct device *dev) mv64xxx_i2c_probe(struct platform_device *pd)
{ {
struct platform_device *pd = to_platform_device(dev);
struct mv64xxx_i2c_data *drv_data; struct mv64xxx_i2c_data *drv_data;
struct mv64xxx_i2c_pdata *pdata = dev->platform_data; struct mv64xxx_i2c_pdata *pdata = pd->dev.platform_data;
int rc; int rc;
if ((pd->id != 0) || !pdata) if ((pd->id != 0) || !pdata)
@ -526,7 +525,7 @@ mv64xxx_i2c_probe(struct device *dev)
drv_data->adapter.class = I2C_CLASS_HWMON; drv_data->adapter.class = I2C_CLASS_HWMON;
drv_data->adapter.timeout = pdata->timeout; drv_data->adapter.timeout = pdata->timeout;
drv_data->adapter.retries = pdata->retries; drv_data->adapter.retries = pdata->retries;
dev_set_drvdata(dev, drv_data); platform_set_drvdata(pd, drv_data);
i2c_set_adapdata(&drv_data->adapter, drv_data); i2c_set_adapdata(&drv_data->adapter, drv_data);
if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0, if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0,
@ -555,9 +554,9 @@ mv64xxx_i2c_probe(struct device *dev)
} }
static int __devexit static int __devexit
mv64xxx_i2c_remove(struct device *dev) mv64xxx_i2c_remove(struct platform_device *dev)
{ {
struct mv64xxx_i2c_data *drv_data = dev_get_drvdata(dev); struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev);
int rc; int rc;
rc = i2c_del_adapter(&drv_data->adapter); rc = i2c_del_adapter(&drv_data->adapter);
@ -568,24 +567,25 @@ mv64xxx_i2c_remove(struct device *dev)
return rc; return rc;
} }
static struct device_driver mv64xxx_i2c_driver = { static struct platform_driver mv64xxx_i2c_driver = {
.owner = THIS_MODULE,
.name = MV64XXX_I2C_CTLR_NAME,
.bus = &platform_bus_type,
.probe = mv64xxx_i2c_probe, .probe = mv64xxx_i2c_probe,
.remove = mv64xxx_i2c_remove, .remove = mv64xxx_i2c_remove,
.driver = {
.owner = THIS_MODULE,
.name = MV64XXX_I2C_CTLR_NAME,
},
}; };
static int __init static int __init
mv64xxx_i2c_init(void) mv64xxx_i2c_init(void)
{ {
return driver_register(&mv64xxx_i2c_driver); return platform_driver_register(&mv64xxx_i2c_driver);
} }
static void __exit static void __exit
mv64xxx_i2c_exit(void) mv64xxx_i2c_exit(void)
{ {
driver_unregister(&mv64xxx_i2c_driver); platform_driver_unregister(&mv64xxx_i2c_driver);
} }
module_init(mv64xxx_i2c_init); module_init(mv64xxx_i2c_init);

View File

@ -936,10 +936,10 @@ static struct pxa_i2c i2c_pxa = {
}, },
}; };
static int i2c_pxa_probe(struct device *dev) static int i2c_pxa_probe(struct platform_device *dev)
{ {
struct pxa_i2c *i2c = &i2c_pxa; struct pxa_i2c *i2c = &i2c_pxa;
struct i2c_pxa_platform_data *plat = dev->platform_data; struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
int ret; int ret;
#ifdef CONFIG_PXA27x #ifdef CONFIG_PXA27x
@ -968,7 +968,7 @@ static int i2c_pxa_probe(struct device *dev)
i2c_pxa_reset(i2c); i2c_pxa_reset(i2c);
i2c->adap.algo_data = i2c; i2c->adap.algo_data = i2c;
i2c->adap.dev.parent = dev; i2c->adap.dev.parent = &dev->dev;
ret = i2c_add_adapter(&i2c->adap); ret = i2c_add_adapter(&i2c->adap);
if (ret < 0) { if (ret < 0) {
@ -976,7 +976,7 @@ static int i2c_pxa_probe(struct device *dev)
goto err_irq; goto err_irq;
} }
dev_set_drvdata(dev, i2c); platform_set_drvdata(dev, i2c);
#ifdef CONFIG_I2C_PXA_SLAVE #ifdef CONFIG_I2C_PXA_SLAVE
printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
@ -993,11 +993,11 @@ static int i2c_pxa_probe(struct device *dev)
return ret; return ret;
} }
static int i2c_pxa_remove(struct device *dev) static int i2c_pxa_remove(struct platform_device *dev)
{ {
struct pxa_i2c *i2c = dev_get_drvdata(dev); struct pxa_i2c *i2c = platform_get_drvdata(dev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
i2c_del_adapter(&i2c->adap); i2c_del_adapter(&i2c->adap);
free_irq(IRQ_I2C, i2c); free_irq(IRQ_I2C, i2c);
@ -1006,21 +1006,22 @@ static int i2c_pxa_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver i2c_pxa_driver = { static struct platform_driver i2c_pxa_driver = {
.name = "pxa2xx-i2c",
.bus = &platform_bus_type,
.probe = i2c_pxa_probe, .probe = i2c_pxa_probe,
.remove = i2c_pxa_remove, .remove = i2c_pxa_remove,
.driver = {
.name = "pxa2xx-i2c",
},
}; };
static int __init i2c_adap_pxa_init(void) static int __init i2c_adap_pxa_init(void)
{ {
return driver_register(&i2c_pxa_driver); return platform_driver_register(&i2c_pxa_driver);
} }
static void i2c_adap_pxa_exit(void) static void i2c_adap_pxa_exit(void)
{ {
return driver_unregister(&i2c_pxa_driver); return platform_driver_unregister(&i2c_pxa_driver);
} }
module_init(i2c_adap_pxa_init); module_init(i2c_adap_pxa_init);

View File

@ -760,24 +760,23 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c)
* called by the bus driver when a suitable device is found * called by the bus driver when a suitable device is found
*/ */
static int s3c24xx_i2c_probe(struct device *dev) static int s3c24xx_i2c_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct s3c24xx_i2c *i2c = &s3c24xx_i2c; struct s3c24xx_i2c *i2c = &s3c24xx_i2c;
struct resource *res; struct resource *res;
int ret; int ret;
/* find the clock and enable it */ /* find the clock and enable it */
i2c->dev = dev; i2c->dev = &pdev->dev;
i2c->clk = clk_get(dev, "i2c"); i2c->clk = clk_get(&pdev->dev, "i2c");
if (IS_ERR(i2c->clk)) { if (IS_ERR(i2c->clk)) {
dev_err(dev, "cannot get clock\n"); dev_err(&pdev->dev, "cannot get clock\n");
ret = -ENOENT; ret = -ENOENT;
goto out; goto out;
} }
dev_dbg(dev, "clock source %p\n", i2c->clk); dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);
clk_use(i2c->clk); clk_use(i2c->clk);
clk_enable(i2c->clk); clk_enable(i2c->clk);
@ -786,7 +785,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) { if (res == NULL) {
dev_err(dev, "cannot find IO resource\n"); dev_err(&pdev->dev, "cannot find IO resource\n");
ret = -ENOENT; ret = -ENOENT;
goto out; goto out;
} }
@ -795,7 +794,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
pdev->name); pdev->name);
if (i2c->ioarea == NULL) { if (i2c->ioarea == NULL) {
dev_err(dev, "cannot request IO\n"); dev_err(&pdev->dev, "cannot request IO\n");
ret = -ENXIO; ret = -ENXIO;
goto out; goto out;
} }
@ -803,17 +802,17 @@ static int s3c24xx_i2c_probe(struct device *dev)
i2c->regs = ioremap(res->start, (res->end-res->start)+1); i2c->regs = ioremap(res->start, (res->end-res->start)+1);
if (i2c->regs == NULL) { if (i2c->regs == NULL) {
dev_err(dev, "cannot map IO\n"); dev_err(&pdev->dev, "cannot map IO\n");
ret = -ENXIO; ret = -ENXIO;
goto out; goto out;
} }
dev_dbg(dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res);
/* setup info block for the i2c core */ /* setup info block for the i2c core */
i2c->adap.algo_data = i2c; i2c->adap.algo_data = i2c;
i2c->adap.dev.parent = dev; i2c->adap.dev.parent = &pdev->dev;
/* initialise the i2c controller */ /* initialise the i2c controller */
@ -827,7 +826,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) { if (res == NULL) {
dev_err(dev, "cannot find IRQ\n"); dev_err(&pdev->dev, "cannot find IRQ\n");
ret = -ENOENT; ret = -ENOENT;
goto out; goto out;
} }
@ -836,23 +835,23 @@ static int s3c24xx_i2c_probe(struct device *dev)
pdev->name, i2c); pdev->name, i2c);
if (ret != 0) { if (ret != 0) {
dev_err(dev, "cannot claim IRQ\n"); dev_err(&pdev->dev, "cannot claim IRQ\n");
goto out; goto out;
} }
i2c->irq = res; i2c->irq = res;
dev_dbg(dev, "irq resource %p (%ld)\n", res, res->start); dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start);
ret = i2c_add_adapter(&i2c->adap); ret = i2c_add_adapter(&i2c->adap);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to add bus to i2c core\n"); dev_err(&pdev->dev, "failed to add bus to i2c core\n");
goto out; goto out;
} }
dev_set_drvdata(dev, i2c); platform_set_drvdata(pdev, i2c);
dev_info(dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
out: out:
if (ret < 0) if (ret < 0)
@ -866,22 +865,22 @@ static int s3c24xx_i2c_probe(struct device *dev)
* called when device is removed from the bus * called when device is removed from the bus
*/ */
static int s3c24xx_i2c_remove(struct device *dev) static int s3c24xx_i2c_remove(struct platform_device *pdev)
{ {
struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
if (i2c != NULL) { if (i2c != NULL) {
s3c24xx_i2c_free(i2c); s3c24xx_i2c_free(i2c);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
} }
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int s3c24xx_i2c_resume(struct device *dev) static int s3c24xx_i2c_resume(struct platform_device *dev)
{ {
struct s3c24xx_i2c *i2c = dev_get_drvdata(dev); struct s3c24xx_i2c *i2c = platform_get_drvdata(dev);
if (i2c != NULL) if (i2c != NULL)
s3c24xx_i2c_init(i2c); s3c24xx_i2c_init(i2c);
@ -895,33 +894,35 @@ static int s3c24xx_i2c_resume(struct device *dev)
/* device driver for platform bus bits */ /* device driver for platform bus bits */
static struct device_driver s3c2410_i2c_driver = { static struct platform_driver s3c2410_i2c_driver = {
.owner = THIS_MODULE,
.name = "s3c2410-i2c",
.bus = &platform_bus_type,
.probe = s3c24xx_i2c_probe, .probe = s3c24xx_i2c_probe,
.remove = s3c24xx_i2c_remove, .remove = s3c24xx_i2c_remove,
.resume = s3c24xx_i2c_resume, .resume = s3c24xx_i2c_resume,
.driver = {
.owner = THIS_MODULE,
.name = "s3c2410-i2c",
},
}; };
static struct device_driver s3c2440_i2c_driver = { static struct platform_driver s3c2440_i2c_driver = {
.owner = THIS_MODULE,
.name = "s3c2440-i2c",
.bus = &platform_bus_type,
.probe = s3c24xx_i2c_probe, .probe = s3c24xx_i2c_probe,
.remove = s3c24xx_i2c_remove, .remove = s3c24xx_i2c_remove,
.resume = s3c24xx_i2c_resume, .resume = s3c24xx_i2c_resume,
.driver = {
.owner = THIS_MODULE,
.name = "s3c2440-i2c",
},
}; };
static int __init i2c_adap_s3c_init(void) static int __init i2c_adap_s3c_init(void)
{ {
int ret; int ret;
ret = driver_register(&s3c2410_i2c_driver); ret = platform_driver_register(&s3c2410_i2c_driver);
if (ret == 0) { if (ret == 0) {
ret = driver_register(&s3c2440_i2c_driver); ret = platform_driver_register(&s3c2440_i2c_driver);
if (ret) if (ret)
driver_unregister(&s3c2410_i2c_driver); platform_driver_unregister(&s3c2410_i2c_driver);
} }
return ret; return ret;
@ -929,8 +930,8 @@ static int __init i2c_adap_s3c_init(void)
static void __exit i2c_adap_s3c_exit(void) static void __exit i2c_adap_s3c_exit(void)
{ {
driver_unregister(&s3c2410_i2c_driver); platform_driver_unregister(&s3c2410_i2c_driver);
driver_unregister(&s3c2440_i2c_driver); platform_driver_unregister(&s3c2440_i2c_driver);
} }
module_init(i2c_adap_s3c_init); module_init(i2c_adap_s3c_init);

View File

@ -873,26 +873,27 @@ static int otg_init(struct isp1301 *isp)
return 0; return 0;
} }
static int otg_probe(struct device *dev) static int otg_probe(struct platform_device *dev)
{ {
// struct omap_usb_config *config = dev->platform_data; // struct omap_usb_config *config = dev->platform_data;
otg_dev = to_platform_device(dev); otg_dev = dev;
return 0; return 0;
} }
static int otg_remove(struct device *dev) static int otg_remove(struct platform_device *dev)
{ {
otg_dev = 0; otg_dev = 0;
return 0; return 0;
} }
struct device_driver omap_otg_driver = { struct platform_driver omap_otg_driver = {
.owner = THIS_MODULE,
.name = "omap_otg",
.bus = &platform_bus_type,
.probe = otg_probe, .probe = otg_probe,
.remove = otg_remove, .remove = otg_remove,
.driver = {
.owner = THIS_MODULE,
.name = "omap_otg",
},
}; };
static int otg_bind(struct isp1301 *isp) static int otg_bind(struct isp1301 *isp)
@ -902,7 +903,7 @@ static int otg_bind(struct isp1301 *isp)
if (otg_dev) if (otg_dev)
return -EBUSY; return -EBUSY;
status = driver_register(&omap_otg_driver); status = platform_driver_register(&omap_otg_driver);
if (status < 0) if (status < 0)
return status; return status;
@ -913,7 +914,7 @@ static int otg_bind(struct isp1301 *isp)
status = -ENODEV; status = -ENODEV;
if (status < 0) if (status < 0)
driver_unregister(&omap_otg_driver); platform_driver_unregister(&omap_otg_driver);
return status; return status;
} }

View File

@ -259,17 +259,17 @@ static void corgikbd_hinge_timer(unsigned long data)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int corgikbd_suspend(struct device *dev, pm_message_t state) static int corgikbd_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct corgikbd *corgikbd = dev_get_drvdata(dev); struct corgikbd *corgikbd = platform_get_drvdata(dev);
corgikbd->suspended = 1; corgikbd->suspended = 1;
return 0; return 0;
} }
static int corgikbd_resume(struct device *dev) static int corgikbd_resume(struct platform_device *dev)
{ {
struct corgikbd *corgikbd = dev_get_drvdata(dev); struct corgikbd *corgikbd = platform_get_drvdata(dev);
/* Upon resume, ignore the suspend key for a short while */ /* Upon resume, ignore the suspend key for a short while */
corgikbd->suspend_jiffies=jiffies; corgikbd->suspend_jiffies=jiffies;
@ -282,7 +282,7 @@ static int corgikbd_resume(struct device *dev)
#define corgikbd_resume NULL #define corgikbd_resume NULL
#endif #endif
static int __init corgikbd_probe(struct device *dev) static int __init corgikbd_probe(struct platform_device *pdev)
{ {
struct corgikbd *corgikbd; struct corgikbd *corgikbd;
struct input_dev *input_dev; struct input_dev *input_dev;
@ -296,7 +296,7 @@ static int __init corgikbd_probe(struct device *dev)
return -ENOMEM; return -ENOMEM;
} }
dev_set_drvdata(dev, corgikbd); platform_set_drvdata(pdev, corgikbd);
corgikbd->input = input_dev; corgikbd->input = input_dev;
spin_lock_init(&corgikbd->lock); spin_lock_init(&corgikbd->lock);
@ -321,7 +321,7 @@ static int __init corgikbd_probe(struct device *dev)
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = dev; input_dev->cdev.dev = &pdev->dev;
input_dev->private = corgikbd; input_dev->private = corgikbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); 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 device *dev)
return 0; return 0;
} }
static int corgikbd_remove(struct device *dev) static int corgikbd_remove(struct platform_device *pdev)
{ {
int i; int i;
struct corgikbd *corgikbd = dev_get_drvdata(dev); struct corgikbd *corgikbd = platform_get_drvdata(pdev);
for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) for (i = 0; i < CORGI_KEY_SENSE_NUM; i++)
free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd); free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd);
@ -374,23 +374,24 @@ static int corgikbd_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver corgikbd_driver = { static struct platform_driver corgikbd_driver = {
.name = "corgi-keyboard",
.bus = &platform_bus_type,
.probe = corgikbd_probe, .probe = corgikbd_probe,
.remove = corgikbd_remove, .remove = corgikbd_remove,
.suspend = corgikbd_suspend, .suspend = corgikbd_suspend,
.resume = corgikbd_resume, .resume = corgikbd_resume,
.driver = {
.name = "corgi-keyboard",
},
}; };
static int __devinit corgikbd_init(void) static int __devinit corgikbd_init(void)
{ {
return driver_register(&corgikbd_driver); return platform_driver_register(&corgikbd_driver);
} }
static void __exit corgikbd_exit(void) static void __exit corgikbd_exit(void)
{ {
driver_unregister(&corgikbd_driver); platform_driver_unregister(&corgikbd_driver);
} }
module_init(corgikbd_init); module_init(corgikbd_init);

View File

@ -309,10 +309,10 @@ static void spitzkbd_hinge_timer(unsigned long data)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int spitzkbd_suspend(struct device *dev, pm_message_t state) static int spitzkbd_suspend(struct platform_device *dev, pm_message_t state)
{ {
int i; int i;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev); struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
spitzkbd->suspended = 1; spitzkbd->suspended = 1;
/* Set Strobe lines as inputs - *except* strobe line 0 leave this /* Set Strobe lines as inputs - *except* strobe line 0 leave this
@ -323,10 +323,10 @@ static int spitzkbd_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int spitzkbd_resume(struct device *dev) static int spitzkbd_resume(struct platform_device *dev)
{ {
int i; int i;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev); struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++) for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH); pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
@ -342,7 +342,7 @@ static int spitzkbd_resume(struct device *dev)
#define spitzkbd_resume NULL #define spitzkbd_resume NULL
#endif #endif
static int __init spitzkbd_probe(struct device *dev) static int __init spitzkbd_probe(struct platform_device *dev)
{ {
struct spitzkbd *spitzkbd; struct spitzkbd *spitzkbd;
struct input_dev *input_dev; struct input_dev *input_dev;
@ -358,7 +358,7 @@ static int __init spitzkbd_probe(struct device *dev)
return -ENOMEM; return -ENOMEM;
} }
dev_set_drvdata(dev, spitzkbd); platform_set_drvdata(dev, spitzkbd);
strcpy(spitzkbd->phys, "spitzkbd/input0"); strcpy(spitzkbd->phys, "spitzkbd/input0");
spin_lock_init(&spitzkbd->lock); spin_lock_init(&spitzkbd->lock);
@ -380,7 +380,7 @@ static int __init spitzkbd_probe(struct device *dev)
input_dev->private = spitzkbd; input_dev->private = spitzkbd;
input_dev->name = "Spitz Keyboard"; input_dev->name = "Spitz Keyboard";
input_dev->phys = spitzkbd->phys; input_dev->phys = spitzkbd->phys;
input_dev->cdev.dev = dev; input_dev->cdev.dev = &dev->dev;
input_dev->id.bustype = BUS_HOST; input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
@ -437,10 +437,10 @@ static int __init spitzkbd_probe(struct device *dev)
return 0; return 0;
} }
static int spitzkbd_remove(struct device *dev) static int spitzkbd_remove(struct platform_device *dev)
{ {
int i; int i;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev); struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++)
free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd); free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd);
@ -460,23 +460,24 @@ static int spitzkbd_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver spitzkbd_driver = { static struct platform_driver spitzkbd_driver = {
.name = "spitz-keyboard",
.bus = &platform_bus_type,
.probe = spitzkbd_probe, .probe = spitzkbd_probe,
.remove = spitzkbd_remove, .remove = spitzkbd_remove,
.suspend = spitzkbd_suspend, .suspend = spitzkbd_suspend,
.resume = spitzkbd_resume, .resume = spitzkbd_resume,
.driver = {
.name = "spitz-keyboard",
},
}; };
static int __devinit spitzkbd_init(void) static int __devinit spitzkbd_init(void)
{ {
return driver_register(&spitzkbd_driver); return platform_driver_register(&spitzkbd_driver);
} }
static void __exit spitzkbd_exit(void) static void __exit spitzkbd_exit(void)
{ {
driver_unregister(&spitzkbd_driver); platform_driver_unregister(&spitzkbd_driver);
} }
module_init(spitzkbd_init); module_init(spitzkbd_init);

View File

@ -912,7 +912,7 @@ static long i8042_panic_blink(long count)
* Here we try to restore the original BIOS settings * Here we try to restore the original BIOS settings
*/ */
static int i8042_suspend(struct device *dev, pm_message_t state) static int i8042_suspend(struct platform_device *dev, pm_message_t state)
{ {
del_timer_sync(&i8042_timer); del_timer_sync(&i8042_timer);
i8042_controller_reset(); i8042_controller_reset();
@ -925,7 +925,7 @@ static int i8042_suspend(struct device *dev, pm_message_t state)
* Here we try to reset everything back to a state in which suspended * Here we try to reset everything back to a state in which suspended
*/ */
static int i8042_resume(struct device *dev) static int i8042_resume(struct platform_device *dev)
{ {
int i; int i;
@ -964,17 +964,18 @@ static int i8042_resume(struct device *dev)
* because otherwise BIOSes will be confused. * because otherwise BIOSes will be confused.
*/ */
static void i8042_shutdown(struct device *dev) static void i8042_shutdown(struct platform_device *dev)
{ {
i8042_controller_cleanup(); i8042_controller_cleanup();
} }
static struct device_driver i8042_driver = { static struct platform_driver i8042_driver = {
.name = "i8042",
.bus = &platform_bus_type,
.suspend = i8042_suspend, .suspend = i8042_suspend,
.resume = i8042_resume, .resume = i8042_resume,
.shutdown = i8042_shutdown, .shutdown = i8042_shutdown,
.driver = {
.name = "i8042",
},
}; };
static int __init i8042_create_kbd_port(void) static int __init i8042_create_kbd_port(void)
@ -1078,7 +1079,7 @@ static int __init i8042_init(void)
goto err_platform_exit; goto err_platform_exit;
} }
err = driver_register(&i8042_driver); err = platform_driver_register(&i8042_driver);
if (err) if (err)
goto err_controller_cleanup; goto err_controller_cleanup;
@ -1126,7 +1127,7 @@ static int __init i8042_init(void)
err_unregister_device: err_unregister_device:
platform_device_unregister(i8042_platform_device); platform_device_unregister(i8042_platform_device);
err_unregister_driver: err_unregister_driver:
driver_unregister(&i8042_driver); platform_driver_unregister(&i8042_driver);
err_controller_cleanup: err_controller_cleanup:
i8042_controller_cleanup(); i8042_controller_cleanup();
err_platform_exit: err_platform_exit:
@ -1148,7 +1149,7 @@ static void __exit i8042_exit(void)
del_timer_sync(&i8042_timer); del_timer_sync(&i8042_timer);
platform_device_unregister(i8042_platform_device); platform_device_unregister(i8042_platform_device);
driver_unregister(&i8042_driver); platform_driver_unregister(&i8042_driver);
i8042_platform_exit(); i8042_platform_exit();

View File

@ -107,7 +107,7 @@ static void rpckbd_close(struct serio *port)
* Allocate and initialize serio structure for subsequent registration * Allocate and initialize serio structure for subsequent registration
* with serio core. * with serio core.
*/ */
static int __devinit rpckbd_probe(struct device *dev) static int __devinit rpckbd_probe(struct platform_device *dev)
{ {
struct serio *serio; struct serio *serio;
@ -120,37 +120,38 @@ static int __devinit rpckbd_probe(struct device *dev)
serio->write = rpckbd_write; serio->write = rpckbd_write;
serio->open = rpckbd_open; serio->open = rpckbd_open;
serio->close = rpckbd_close; serio->close = rpckbd_close;
serio->dev.parent = dev; serio->dev.parent = &dev->dev;
strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name));
strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys));
dev_set_drvdata(dev, serio); platform_set_drvdata(dev, serio);
serio_register_port(serio); serio_register_port(serio);
return 0; return 0;
} }
static int __devexit rpckbd_remove(struct device *dev) static int __devexit rpckbd_remove(struct platform_device *dev)
{ {
struct serio *serio = dev_get_drvdata(dev); struct serio *serio = platform_get_drvdata(dev);
serio_unregister_port(serio); serio_unregister_port(serio);
return 0; return 0;
} }
static struct device_driver rpckbd_driver = { static struct platform_driver rpckbd_driver = {
.name = "kart",
.bus = &platform_bus_type,
.probe = rpckbd_probe, .probe = rpckbd_probe,
.remove = __devexit_p(rpckbd_remove), .remove = __devexit_p(rpckbd_remove),
.driver = {
.name = "kart",
},
}; };
static int __init rpckbd_init(void) static int __init rpckbd_init(void)
{ {
return driver_register(&rpckbd_driver); return platform_driver_register(&rpckbd_driver);
} }
static void __exit rpckbd_exit(void) static void __exit rpckbd_exit(void)
{ {
driver_unregister(&rpckbd_driver); platform_driver_unregister(&rpckbd_driver);
} }
module_init(rpckbd_init); module_init(rpckbd_init);

View File

@ -231,9 +231,9 @@ static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int corgits_suspend(struct device *dev, pm_message_t state) static int corgits_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct corgi_ts *corgi_ts = dev_get_drvdata(dev); struct corgi_ts *corgi_ts = platform_get_drvdata(dev);
if (corgi_ts->pendown) { if (corgi_ts->pendown) {
del_timer_sync(&corgi_ts->timer); del_timer_sync(&corgi_ts->timer);
@ -248,9 +248,9 @@ static int corgits_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int corgits_resume(struct device *dev) static int corgits_resume(struct platform_device *dev)
{ {
struct corgi_ts *corgi_ts = dev_get_drvdata(dev); struct corgi_ts *corgi_ts = platform_get_drvdata(dev);
corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS); corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
/* Enable Falling Edge */ /* Enable Falling Edge */
@ -264,10 +264,9 @@ static int corgits_resume(struct device *dev)
#define corgits_resume NULL #define corgits_resume NULL
#endif #endif
static int __init corgits_probe(struct device *dev) static int __init corgits_probe(struct platform_device *pdev)
{ {
struct corgi_ts *corgi_ts; struct corgi_ts *corgi_ts;
struct platform_device *pdev = to_platform_device(dev);
struct input_dev *input_dev; struct input_dev *input_dev;
int err = -ENOMEM; int err = -ENOMEM;
@ -276,9 +275,9 @@ static int __init corgits_probe(struct device *dev)
if (!corgi_ts || !input_dev) if (!corgi_ts || !input_dev)
goto fail; goto fail;
dev_set_drvdata(dev, corgi_ts); platform_set_drvdata(pdev, corgi_ts);
corgi_ts->machinfo = dev->platform_data; corgi_ts->machinfo = pdev->dev.platform_data;
corgi_ts->irq_gpio = platform_get_irq(pdev, 0); corgi_ts->irq_gpio = platform_get_irq(pdev, 0);
if (corgi_ts->irq_gpio < 0) { if (corgi_ts->irq_gpio < 0) {
@ -298,7 +297,7 @@ static int __init corgits_probe(struct device *dev)
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0002; input_dev->id.product = 0x0002;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = dev; input_dev->cdev.dev = &pdev->dev;
input_dev->private = corgi_ts; input_dev->private = corgi_ts;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
@ -339,9 +338,9 @@ static int __init corgits_probe(struct device *dev)
} }
static int corgits_remove(struct device *dev) static int corgits_remove(struct platform_device *pdev)
{ {
struct corgi_ts *corgi_ts = dev_get_drvdata(dev); struct corgi_ts *corgi_ts = platform_get_drvdata(pdev);
free_irq(corgi_ts->irq_gpio, NULL); free_irq(corgi_ts->irq_gpio, NULL);
del_timer_sync(&corgi_ts->timer); del_timer_sync(&corgi_ts->timer);
@ -351,23 +350,24 @@ static int corgits_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver corgits_driver = { static struct platform_driver corgits_driver = {
.name = "corgi-ts",
.bus = &platform_bus_type,
.probe = corgits_probe, .probe = corgits_probe,
.remove = corgits_remove, .remove = corgits_remove,
.suspend = corgits_suspend, .suspend = corgits_suspend,
.resume = corgits_resume, .resume = corgits_resume,
.driver = {
.name = "corgi-ts",
},
}; };
static int __devinit corgits_init(void) static int __devinit corgits_init(void)
{ {
return driver_register(&corgits_driver); return platform_driver_register(&corgits_driver);
} }
static void __exit corgits_exit(void) static void __exit corgits_exit(void)
{ {
driver_unregister(&corgits_driver); platform_driver_unregister(&corgits_driver);
} }
module_init(corgits_init); module_init(corgits_init);

View File

@ -138,9 +138,8 @@ static struct mcp_ops mcp_sa11x0 = {
.disable = mcp_sa11x0_disable, .disable = mcp_sa11x0_disable,
}; };
static int mcp_sa11x0_probe(struct device *dev) static int mcp_sa11x0_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct mcp_plat_data *data = pdev->dev.platform_data; struct mcp_plat_data *data = pdev->dev.platform_data;
struct mcp *mcp; struct mcp *mcp;
int ret; int ret;
@ -165,7 +164,7 @@ static int mcp_sa11x0_probe(struct device *dev)
mcp->dma_telco_rd = DMA_Ser4MCP1Rd; mcp->dma_telco_rd = DMA_Ser4MCP1Rd;
mcp->dma_telco_wr = DMA_Ser4MCP1Wr; mcp->dma_telco_wr = DMA_Ser4MCP1Wr;
dev_set_drvdata(dev, mcp); platform_set_drvdata(pdev, mcp);
if (machine_is_assabet()) { if (machine_is_assabet()) {
ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); ASSABET_BCR_set(ASSABET_BCR_CODEC_RST);
@ -202,26 +201,26 @@ static int mcp_sa11x0_probe(struct device *dev)
release: release:
release_mem_region(0x80060000, 0x60); release_mem_region(0x80060000, 0x60);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
out: out:
return ret; return ret;
} }
static int mcp_sa11x0_remove(struct device *dev) static int mcp_sa11x0_remove(struct platform_device *dev)
{ {
struct mcp *mcp = dev_get_drvdata(dev); struct mcp *mcp = platform_get_drvdata(dev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
mcp_host_unregister(mcp); mcp_host_unregister(mcp);
release_mem_region(0x80060000, 0x60); release_mem_region(0x80060000, 0x60);
return 0; return 0;
} }
static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state) static int mcp_sa11x0_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct mcp *mcp = dev_get_drvdata(dev); struct mcp *mcp = platform_get_drvdata(dev);
priv(mcp)->mccr0 = Ser4MCCR0; priv(mcp)->mccr0 = Ser4MCCR0;
priv(mcp)->mccr1 = Ser4MCCR1; priv(mcp)->mccr1 = Ser4MCCR1;
@ -230,9 +229,9 @@ static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int mcp_sa11x0_resume(struct device *dev) static int mcp_sa11x0_resume(struct platform_device *dev)
{ {
struct mcp *mcp = dev_get_drvdata(dev); struct mcp *mcp = platform_get_drvdata(dev);
Ser4MCCR1 = priv(mcp)->mccr1; Ser4MCCR1 = priv(mcp)->mccr1;
Ser4MCCR0 = priv(mcp)->mccr0; Ser4MCCR0 = priv(mcp)->mccr0;
@ -243,13 +242,14 @@ static int mcp_sa11x0_resume(struct device *dev)
/* /*
* The driver for the SA11x0 MCP port. * The driver for the SA11x0 MCP port.
*/ */
static struct device_driver mcp_sa11x0_driver = { static struct platform_driver mcp_sa11x0_driver = {
.name = "sa11x0-mcp",
.bus = &platform_bus_type,
.probe = mcp_sa11x0_probe, .probe = mcp_sa11x0_probe,
.remove = mcp_sa11x0_remove, .remove = mcp_sa11x0_remove,
.suspend = mcp_sa11x0_suspend, .suspend = mcp_sa11x0_suspend,
.resume = mcp_sa11x0_resume, .resume = mcp_sa11x0_resume,
.driver = {
.name = "sa11x0-mcp",
},
}; };
/* /*
@ -257,12 +257,12 @@ static struct device_driver mcp_sa11x0_driver = {
*/ */
static int __init mcp_sa11x0_init(void) static int __init mcp_sa11x0_init(void)
{ {
return driver_register(&mcp_sa11x0_driver); return platform_driver_register(&mcp_sa11x0_driver);
} }
static void __exit mcp_sa11x0_exit(void) static void __exit mcp_sa11x0_exit(void)
{ {
driver_unregister(&mcp_sa11x0_driver); platform_driver_unregister(&mcp_sa11x0_driver);
} }
module_init(mcp_sa11x0_init); module_init(mcp_sa11x0_init);

View File

@ -27,8 +27,8 @@
#define SKY_CPUSTATE_VERSION "1.1" #define SKY_CPUSTATE_VERSION "1.1"
static int hdpu_cpustate_probe(struct device *ddev); static int hdpu_cpustate_probe(struct platform_device *pdev);
static int hdpu_cpustate_remove(struct device *ddev); static int hdpu_cpustate_remove(struct platform_device *pdev);
struct cpustate_t cpustate; struct cpustate_t cpustate;
@ -159,11 +159,12 @@ static int cpustate_read_proc(char *page, char **start, off_t off,
return len; return len;
} }
static struct device_driver hdpu_cpustate_driver = { static struct platform_driver hdpu_cpustate_driver = {
.name = HDPU_CPUSTATE_NAME,
.bus = &platform_bus_type,
.probe = hdpu_cpustate_probe, .probe = hdpu_cpustate_probe,
.remove = hdpu_cpustate_remove, .remove = hdpu_cpustate_remove,
.driver = {
.name = HDPU_CPUSTATE_NAME,
},
}; };
/* /*
@ -188,9 +189,8 @@ static struct miscdevice cpustate_dev = {
&cpustate_fops &cpustate_fops
}; };
static int hdpu_cpustate_probe(struct device *ddev) static int hdpu_cpustate_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(ddev);
struct resource *res; struct resource *res;
struct proc_dir_entry *proc_de; struct proc_dir_entry *proc_de;
int ret; int ret;
@ -218,7 +218,7 @@ static int hdpu_cpustate_probe(struct device *ddev)
return 0; return 0;
} }
static int hdpu_cpustate_remove(struct device *ddev) static int hdpu_cpustate_remove(struct platform_device *pdev)
{ {
cpustate.set_addr = NULL; cpustate.set_addr = NULL;
@ -233,13 +233,13 @@ static int hdpu_cpustate_remove(struct device *ddev)
static int __init cpustate_init(void) static int __init cpustate_init(void)
{ {
int rc; int rc;
rc = driver_register(&hdpu_cpustate_driver); rc = platform_driver_register(&hdpu_cpustate_driver);
return rc; return rc;
} }
static void __exit cpustate_exit(void) static void __exit cpustate_exit(void)
{ {
driver_unregister(&hdpu_cpustate_driver); platform_driver_unregister(&hdpu_cpustate_driver);
} }
module_init(cpustate_init); module_init(cpustate_init);

View File

@ -23,19 +23,20 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
static int hdpu_nexus_probe(struct device *ddev); static int hdpu_nexus_probe(struct platform_device *pdev);
static int hdpu_nexus_remove(struct device *ddev); static int hdpu_nexus_remove(struct platform_device *pdev);
static struct proc_dir_entry *hdpu_slot_id; static struct proc_dir_entry *hdpu_slot_id;
static struct proc_dir_entry *hdpu_chassis_id; static struct proc_dir_entry *hdpu_chassis_id;
static int slot_id = -1; static int slot_id = -1;
static int chassis_id = -1; static int chassis_id = -1;
static struct device_driver hdpu_nexus_driver = { static struct platform_driver hdpu_nexus_driver = {
.name = HDPU_NEXUS_NAME,
.bus = &platform_bus_type,
.probe = hdpu_nexus_probe, .probe = hdpu_nexus_probe,
.remove = hdpu_nexus_remove, .remove = hdpu_nexus_remove,
.driver = {
.name = HDPU_NEXUS_NAME,
},
}; };
int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset,
@ -56,9 +57,8 @@ int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset,
return sprintf(buffer, "%d\n", chassis_id); return sprintf(buffer, "%d\n", chassis_id);
} }
static int hdpu_nexus_probe(struct device *ddev) static int hdpu_nexus_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(ddev);
struct resource *res; struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@ -81,7 +81,7 @@ static int hdpu_nexus_probe(struct device *ddev)
return 0; return 0;
} }
static int hdpu_nexus_remove(struct device *ddev) static int hdpu_nexus_remove(struct platform_device *pdev)
{ {
slot_id = -1; slot_id = -1;
chassis_id = -1; chassis_id = -1;
@ -95,13 +95,13 @@ static int hdpu_nexus_remove(struct device *ddev)
static int __init nexus_init(void) static int __init nexus_init(void)
{ {
int rc; int rc;
rc = driver_register(&hdpu_nexus_driver); rc = platform_driver_register(&hdpu_nexus_driver);
return rc; return rc;
} }
static void __exit nexus_exit(void) static void __exit nexus_exit(void)
{ {
driver_unregister(&hdpu_nexus_driver); platform_driver_unregister(&hdpu_nexus_driver);
} }
module_init(nexus_init); module_init(nexus_init);

View File

@ -428,9 +428,8 @@ static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int pxamci_probe(struct device *dev) static int pxamci_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct mmc_host *mmc; struct mmc_host *mmc;
struct pxamci_host *host = NULL; struct pxamci_host *host = NULL;
struct resource *r; struct resource *r;
@ -445,7 +444,7 @@ static int pxamci_probe(struct device *dev)
if (!r) if (!r)
return -EBUSY; return -EBUSY;
mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev); mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev);
if (!mmc) { if (!mmc) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
@ -474,7 +473,7 @@ static int pxamci_probe(struct device *dev)
host->pdata->ocr_mask : host->pdata->ocr_mask :
MMC_VDD_32_33|MMC_VDD_33_34; MMC_VDD_32_33|MMC_VDD_33_34;
host->sg_cpu = dma_alloc_coherent(dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL);
if (!host->sg_cpu) { if (!host->sg_cpu) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
@ -511,10 +510,10 @@ static int pxamci_probe(struct device *dev)
if (ret) if (ret)
goto out; goto out;
dev_set_drvdata(dev, mmc); platform_set_drvdata(pdev, mmc);
if (host->pdata && host->pdata->init) if (host->pdata && host->pdata->init)
host->pdata->init(dev, pxamci_detect_irq, mmc); host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc);
mmc_add_host(mmc); mmc_add_host(mmc);
@ -527,7 +526,7 @@ static int pxamci_probe(struct device *dev)
if (host->base) if (host->base)
iounmap(host->base); iounmap(host->base);
if (host->sg_cpu) if (host->sg_cpu)
dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
} }
if (mmc) if (mmc)
mmc_free_host(mmc); mmc_free_host(mmc);
@ -535,17 +534,17 @@ static int pxamci_probe(struct device *dev)
return ret; return ret;
} }
static int pxamci_remove(struct device *dev) static int pxamci_remove(struct platform_device *pdev)
{ {
struct mmc_host *mmc = dev_get_drvdata(dev); struct mmc_host *mmc = platform_get_drvdata(pdev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
if (mmc) { if (mmc) {
struct pxamci_host *host = mmc_priv(mmc); struct pxamci_host *host = mmc_priv(mmc);
if (host->pdata && host->pdata->exit) if (host->pdata && host->pdata->exit)
host->pdata->exit(dev, mmc); host->pdata->exit(&pdev->dev, mmc);
mmc_remove_host(mmc); mmc_remove_host(mmc);
@ -560,7 +559,7 @@ static int pxamci_remove(struct device *dev)
free_irq(host->irq, host); free_irq(host->irq, host);
pxa_free_dma(host->dma); pxa_free_dma(host->dma);
iounmap(host->base); iounmap(host->base);
dma_free_coherent(dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
release_resource(host->res); release_resource(host->res);
@ -570,9 +569,9 @@ static int pxamci_remove(struct device *dev)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int pxamci_suspend(struct device *dev, pm_message_t state) static int pxamci_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct mmc_host *mmc = dev_get_drvdata(dev); struct mmc_host *mmc = platform_get_drvdata(dev);
int ret = 0; int ret = 0;
if (mmc) if (mmc)
@ -581,9 +580,9 @@ static int pxamci_suspend(struct device *dev, pm_message_t state)
return ret; return ret;
} }
static int pxamci_resume(struct device *dev) static int pxamci_resume(struct platform_device *dev)
{ {
struct mmc_host *mmc = dev_get_drvdata(dev); struct mmc_host *mmc = platform_get_drvdata(dev);
int ret = 0; int ret = 0;
if (mmc) if (mmc)
@ -596,23 +595,24 @@ static int pxamci_resume(struct device *dev)
#define pxamci_resume NULL #define pxamci_resume NULL
#endif #endif
static struct device_driver pxamci_driver = { static struct platform_driver pxamci_driver = {
.name = DRIVER_NAME,
.bus = &platform_bus_type,
.probe = pxamci_probe, .probe = pxamci_probe,
.remove = pxamci_remove, .remove = pxamci_remove,
.suspend = pxamci_suspend, .suspend = pxamci_suspend,
.resume = pxamci_resume, .resume = pxamci_resume,
.driver = {
.name = DRIVER_NAME,
},
}; };
static int __init pxamci_init(void) static int __init pxamci_init(void)
{ {
return driver_register(&pxamci_driver); return platform_driver_register(&pxamci_driver);
} }
static void __exit pxamci_exit(void) static void __exit pxamci_exit(void)
{ {
driver_unregister(&pxamci_driver); platform_driver_unregister(&pxamci_driver);
} }
module_init(pxamci_init); module_init(pxamci_init);

View File

@ -1932,14 +1932,14 @@ static void __devexit wbsd_shutdown(struct device* dev, int pnp)
* Non-PnP * Non-PnP
*/ */
static int __devinit wbsd_probe(struct device* dev) static int __devinit wbsd_probe(struct platform_device* dev)
{ {
return wbsd_init(dev, io, irq, dma, 0); return wbsd_init(&dev->dev, io, irq, dma, 0);
} }
static int __devexit wbsd_remove(struct device* dev) static int __devexit wbsd_remove(struct platform_device* dev)
{ {
wbsd_shutdown(dev, 0); wbsd_shutdown(&dev->dev, 0);
return 0; return 0;
} }
@ -1983,9 +1983,9 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int wbsd_suspend(struct device *dev, pm_message_t state) static int wbsd_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct mmc_host *mmc = dev_get_drvdata(dev); struct mmc_host *mmc = platform_get_drvdata(dev);
struct wbsd_host *host; struct wbsd_host *host;
int ret; int ret;
@ -2005,9 +2005,9 @@ static int wbsd_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int wbsd_resume(struct device *dev) static int wbsd_resume(struct platform_device *dev)
{ {
struct mmc_host *mmc = dev_get_drvdata(dev); struct mmc_host *mmc = platform_get_drvdata(dev);
struct wbsd_host *host; struct wbsd_host *host;
if (!mmc) if (!mmc)
@ -2038,14 +2038,15 @@ static int wbsd_resume(struct device *dev)
static struct platform_device *wbsd_device; static struct platform_device *wbsd_device;
static struct device_driver wbsd_driver = { static struct platform_driver wbsd_driver = {
.name = DRIVER_NAME,
.bus = &platform_bus_type,
.probe = wbsd_probe, .probe = wbsd_probe,
.remove = wbsd_remove, .remove = wbsd_remove,
.suspend = wbsd_suspend, .suspend = wbsd_suspend,
.resume = wbsd_resume, .resume = wbsd_resume,
.driver = {
.name = DRIVER_NAME,
},
}; };
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
@ -2085,7 +2086,7 @@ static int __init wbsd_drv_init(void)
if (nopnp) if (nopnp)
{ {
result = driver_register(&wbsd_driver); result = platform_driver_register(&wbsd_driver);
if (result < 0) if (result < 0)
return result; return result;
@ -2111,7 +2112,7 @@ static void __exit wbsd_drv_exit(void)
{ {
platform_device_unregister(wbsd_device); platform_device_unregister(wbsd_device);
driver_unregister(&wbsd_driver); platform_driver_unregister(&wbsd_driver);
} }
DBG("unloaded\n"); DBG("unloaded\n");

View File

@ -63,11 +63,6 @@ struct bast_flash_info {
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 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) static void bast_flash_setrw(int to)
{ {
unsigned int val; unsigned int val;
@ -87,11 +82,11 @@ static void bast_flash_setrw(int to)
local_irq_restore(flags); local_irq_restore(flags);
} }
static int bast_flash_remove(struct device *dev) static int bast_flash_remove(struct platform_device *pdev)
{ {
struct bast_flash_info *info = to_bast_info(dev); struct bast_flash_info *info = platform_get_drvdata(pdev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
if (info == NULL) if (info == NULL)
return 0; return 0;
@ -116,9 +111,8 @@ static int bast_flash_remove(struct device *dev)
return 0; return 0;
} }
static int bast_flash_probe(struct device *dev) static int bast_flash_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct bast_flash_info *info; struct bast_flash_info *info;
struct resource *res; struct resource *res;
int err = 0; int err = 0;
@ -131,13 +125,13 @@ static int bast_flash_probe(struct device *dev)
} }
memzero(info, sizeof(*info)); memzero(info, sizeof(*info));
dev_set_drvdata(dev, info); platform_set_drvdata(pdev, info);
res = pdev->resource; /* assume that the flash has one resource */ res = pdev->resource; /* assume that the flash has one resource */
info->map.phys = res->start; info->map.phys = res->start;
info->map.size = res->end - res->start + 1; info->map.size = res->end - res->start + 1;
info->map.name = dev->bus_id; info->map.name = pdev->dev.bus_id;
info->map.bankwidth = 2; info->map.bankwidth = 2;
if (info->map.size > AREA_MAXSIZE) if (info->map.size > AREA_MAXSIZE)
@ -199,27 +193,28 @@ static int bast_flash_probe(struct device *dev)
/* fall through to exit error */ /* fall through to exit error */
exit_error: exit_error:
bast_flash_remove(dev); bast_flash_remove(pdev);
return err; return err;
} }
static struct device_driver bast_flash_driver = { static struct platform_driver bast_flash_driver = {
.name = "bast-nor",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = bast_flash_probe, .probe = bast_flash_probe,
.remove = bast_flash_remove, .remove = bast_flash_remove,
.driver = {
.name = "bast-nor",
.owner = THIS_MODULE,
},
}; };
static int __init bast_flash_init(void) static int __init bast_flash_init(void)
{ {
printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n");
return driver_register(&bast_flash_driver); return platform_driver_register(&bast_flash_driver);
} }
static void __exit bast_flash_exit(void) static void __exit bast_flash_exit(void)
{ {
driver_unregister(&bast_flash_driver); platform_driver_unregister(&bast_flash_driver);
} }
module_init(bast_flash_init); module_init(bast_flash_init);

View File

@ -67,9 +67,8 @@ static void armflash_set_vpp(struct map_info *map, int on)
static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL };
static int armflash_probe(struct device *_dev) static int armflash_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data; struct flash_platform_data *plat = dev->dev.platform_data;
struct resource *res = dev->resource; struct resource *res = dev->resource;
unsigned int size = res->end - res->start + 1; unsigned int size = res->end - res->start + 1;
@ -138,7 +137,7 @@ static int armflash_probe(struct device *_dev)
} }
if (err == 0) if (err == 0)
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
/* /*
* If we got an error, free all resources. * If we got an error, free all resources.
@ -163,12 +162,11 @@ static int armflash_probe(struct device *_dev)
return err; return err;
} }
static int armflash_remove(struct device *_dev) static int armflash_remove(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev); struct armflash_info *info = platform_get_drvdata(dev);
struct armflash_info *info = dev_get_drvdata(&dev->dev);
dev_set_drvdata(&dev->dev, NULL); platform_set_drvdata(dev, NULL);
if (info) { if (info) {
if (info->mtd) { if (info->mtd) {
@ -190,21 +188,22 @@ static int armflash_remove(struct device *_dev)
return 0; return 0;
} }
static struct device_driver armflash_driver = { static struct platform_driver armflash_driver = {
.name = "armflash",
.bus = &platform_bus_type,
.probe = armflash_probe, .probe = armflash_probe,
.remove = armflash_remove, .remove = armflash_remove,
.driver = {
.name = "armflash",
},
}; };
static int __init armflash_init(void) static int __init armflash_init(void)
{ {
return driver_register(&armflash_driver); return platform_driver_register(&armflash_driver);
} }
static void __exit armflash_exit(void) static void __exit armflash_exit(void)
{ {
driver_unregister(&armflash_driver); platform_driver_unregister(&armflash_driver);
} }
module_init(armflash_init); module_init(armflash_init);

View File

@ -111,13 +111,12 @@ static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to,
} }
static int ixp2000_flash_remove(struct device *_dev) static int ixp2000_flash_remove(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data; struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); struct ixp2000_flash_info *info = platform_get_drvdata(dev);
dev_set_drvdata(&dev->dev, NULL); platform_set_drvdata(dev, NULL);
if(!info) if(!info)
return 0; return 0;
@ -143,10 +142,9 @@ static int ixp2000_flash_remove(struct device *_dev)
} }
static int ixp2000_flash_probe(struct device *_dev) static int ixp2000_flash_probe(struct platform_device *dev)
{ {
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 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 ixp2000_flash_data *ixp_data = dev->dev.platform_data;
struct flash_platform_data *plat; struct flash_platform_data *plat;
struct ixp2000_flash_info *info; struct ixp2000_flash_info *info;
@ -177,7 +175,7 @@ static int ixp2000_flash_probe(struct device *_dev)
} }
memzero(info, sizeof(struct ixp2000_flash_info)); memzero(info, sizeof(struct ixp2000_flash_info));
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
/* /*
* Tell the MTD layer we're not 1:1 mapped so that it does * Tell the MTD layer we're not 1:1 mapped so that it does
@ -248,25 +246,26 @@ static int ixp2000_flash_probe(struct device *_dev)
return 0; return 0;
Error: Error:
ixp2000_flash_remove(_dev); ixp2000_flash_remove(dev);
return err; return err;
} }
static struct device_driver ixp2000_flash_driver = { static struct platform_driver ixp2000_flash_driver = {
.name = "IXP2000-Flash",
.bus = &platform_bus_type,
.probe = &ixp2000_flash_probe, .probe = &ixp2000_flash_probe,
.remove = &ixp2000_flash_remove .remove = &ixp2000_flash_remove
.driver = {
.name = "IXP2000-Flash",
},
}; };
static int __init ixp2000_flash_init(void) static int __init ixp2000_flash_init(void)
{ {
return driver_register(&ixp2000_flash_driver); return platform_driver_register(&ixp2000_flash_driver);
} }
static void __exit ixp2000_flash_exit(void) static void __exit ixp2000_flash_exit(void)
{ {
driver_unregister(&ixp2000_flash_driver); platform_driver_unregister(&ixp2000_flash_driver);
} }
module_init(ixp2000_flash_init); module_init(ixp2000_flash_init);

View File

@ -99,13 +99,12 @@ struct ixp4xx_flash_info {
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
static int ixp4xx_flash_remove(struct device *_dev) static int ixp4xx_flash_remove(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data; struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); struct ixp4xx_flash_info *info = platform_get_drvdata(dev);
dev_set_drvdata(&dev->dev, NULL); platform_set_drvdata(dev, NULL);
if(!info) if(!info)
return 0; return 0;
@ -130,9 +129,8 @@ static int ixp4xx_flash_remove(struct device *_dev)
return 0; return 0;
} }
static int ixp4xx_flash_probe(struct device *_dev) static int ixp4xx_flash_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data; struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp4xx_flash_info *info; struct ixp4xx_flash_info *info;
int err = -1; int err = -1;
@ -153,7 +151,7 @@ static int ixp4xx_flash_probe(struct device *_dev)
} }
memzero(info, sizeof(struct ixp4xx_flash_info)); memzero(info, sizeof(struct ixp4xx_flash_info));
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
/* /*
* Tell the MTD layer we're not 1:1 mapped so that it does * Tell the MTD layer we're not 1:1 mapped so that it does
@ -214,25 +212,26 @@ static int ixp4xx_flash_probe(struct device *_dev)
return 0; return 0;
Error: Error:
ixp4xx_flash_remove(_dev); ixp4xx_flash_remove(dev);
return err; return err;
} }
static struct device_driver ixp4xx_flash_driver = { static struct platform_driver ixp4xx_flash_driver = {
.name = "IXP4XX-Flash",
.bus = &platform_bus_type,
.probe = ixp4xx_flash_probe, .probe = ixp4xx_flash_probe,
.remove = ixp4xx_flash_remove, .remove = ixp4xx_flash_remove,
.driver = {
.name = "IXP4XX-Flash",
},
}; };
static int __init ixp4xx_flash_init(void) static int __init ixp4xx_flash_init(void)
{ {
return driver_register(&ixp4xx_flash_driver); return platform_driver_register(&ixp4xx_flash_driver);
} }
static void __exit ixp4xx_flash_exit(void) static void __exit ixp4xx_flash_exit(void)
{ {
driver_unregister(&ixp4xx_flash_driver); platform_driver_unregister(&ixp4xx_flash_driver);
} }

View File

@ -70,11 +70,10 @@ static void omap_set_vpp(struct map_info *map, int enable)
} }
} }
static int __devinit omapflash_probe(struct device *dev) static int __devinit omapflash_probe(struct platform_device *pdev)
{ {
int err; int err;
struct omapflash_info *info; struct omapflash_info *info;
struct platform_device *pdev = to_platform_device(dev);
struct flash_platform_data *pdata = pdev->dev.platform_data; struct flash_platform_data *pdata = pdev->dev.platform_data;
struct resource *res = pdev->resource; struct resource *res = pdev->resource;
unsigned long size = res->end - res->start + 1; unsigned long size = res->end - res->start + 1;
@ -119,7 +118,7 @@ static int __devinit omapflash_probe(struct device *dev)
#endif #endif
add_mtd_device(info->mtd); add_mtd_device(info->mtd);
dev_set_drvdata(&pdev->dev, info); platform_set_drvdata(pdev, info);
return 0; return 0;
@ -133,12 +132,11 @@ out_free_info:
return err; return err;
} }
static int __devexit omapflash_remove(struct device *dev) static int __devexit omapflash_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct omapflash_info *info = platform_get_drvdata(pdev);
struct omapflash_info *info = dev_get_drvdata(&pdev->dev);
dev_set_drvdata(&pdev->dev, NULL); platform_set_drvdata(pdev, NULL);
if (info) { if (info) {
if (info->parts) { if (info->parts) {
@ -155,21 +153,22 @@ static int __devexit omapflash_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver omapflash_driver = { static struct platform_driver omapflash_driver = {
.name = "omapflash",
.bus = &platform_bus_type,
.probe = omapflash_probe, .probe = omapflash_probe,
.remove = __devexit_p(omapflash_remove), .remove = __devexit_p(omapflash_remove),
.driver = {
.name = "omapflash",
},
}; };
static int __init omapflash_init(void) static int __init omapflash_init(void)
{ {
return driver_register(&omapflash_driver); return platform_driver_register(&omapflash_driver);
} }
static void __exit omapflash_exit(void) static void __exit omapflash_exit(void)
{ {
driver_unregister(&omapflash_driver); platform_driver_unregister(&omapflash_driver);
} }
module_init(omapflash_init); module_init(omapflash_init);

View File

@ -56,9 +56,9 @@ struct platram_info {
* device private data to struct platram_info conversion * device private data to struct platram_info conversion
*/ */
static inline struct platram_info *to_platram_info(struct device *dev) static inline struct platram_info *to_platram_info(struct platform_device *dev)
{ {
return (struct platram_info *)dev_get_drvdata(dev); return (struct platram_info *)platform_get_drvdata(dev);
} }
/* platram_setrw /* 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 * called to remove the device from the driver's control
*/ */
static int platram_remove(struct device *dev) static int platram_remove(struct platform_device *pdev)
{ {
struct platram_info *info = to_platram_info(dev); struct platram_info *info = to_platram_info(pdev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
dev_dbg(dev, "removing device\n"); dev_dbg(&pdev->dev, "removing device\n");
if (info == NULL) if (info == NULL)
return 0; return 0;
@ -130,61 +130,60 @@ static int platram_remove(struct device *dev)
* driver is found. * driver is found.
*/ */
static int platram_probe(struct device *dev) static int platram_probe(struct platform_device *pdev)
{ {
struct platform_device *pd = to_platform_device(dev);
struct platdata_mtd_ram *pdata; struct platdata_mtd_ram *pdata;
struct platram_info *info; struct platram_info *info;
struct resource *res; struct resource *res;
int err = 0; int err = 0;
dev_dbg(dev, "probe entered\n"); dev_dbg(&pdev->dev, "probe entered\n");
if (dev->platform_data == NULL) { if (pdev->dev.platform_data == NULL) {
dev_err(dev, "no platform data supplied\n"); dev_err(&pdev->dev, "no platform data supplied\n");
err = -ENOENT; err = -ENOENT;
goto exit_error; goto exit_error;
} }
pdata = dev->platform_data; pdata = pdev->dev.platform_data;
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) { if (info == NULL) {
dev_err(dev, "no memory for flash info\n"); dev_err(&pdev->dev, "no memory for flash info\n");
err = -ENOMEM; err = -ENOMEM;
goto exit_error; goto exit_error;
} }
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
dev_set_drvdata(dev, info); platform_set_drvdata(pdev, info);
info->dev = dev; info->dev = &pdev->dev;
info->pdata = pdata; info->pdata = pdata;
/* get the resource for the memory mapping */ /* get the resource for the memory mapping */
res = platform_get_resource(pd, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) { if (res == NULL) {
dev_err(dev, "no memory resource specified\n"); dev_err(&pdev->dev, "no memory resource specified\n");
err = -ENOENT; err = -ENOENT;
goto exit_free; goto exit_free;
} }
dev_dbg(dev, "got platform resource %p (0x%lx)\n", res, res->start); dev_dbg(&pdev->dev, "got platform resource %p (0x%lx)\n", res, res->start);
/* setup map parameters */ /* setup map parameters */
info->map.phys = res->start; info->map.phys = res->start;
info->map.size = (res->end - res->start) + 1; info->map.size = (res->end - res->start) + 1;
info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pd->name; info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pdev->name;
info->map.bankwidth = pdata->bankwidth; info->map.bankwidth = pdata->bankwidth;
/* register our usage of the memory area */ /* register our usage of the memory area */
info->area = request_mem_region(res->start, info->map.size, pd->name); info->area = request_mem_region(res->start, info->map.size, pdev->name);
if (info->area == NULL) { if (info->area == NULL) {
dev_err(dev, "failed to request memory region\n"); dev_err(&pdev->dev, "failed to request memory region\n");
err = -EIO; err = -EIO;
goto exit_free; goto exit_free;
} }
@ -192,23 +191,23 @@ static int platram_probe(struct device *dev)
/* remap the memory area */ /* remap the memory area */
info->map.virt = ioremap(res->start, info->map.size); info->map.virt = ioremap(res->start, info->map.size);
dev_dbg(dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size);
if (info->map.virt == NULL) { if (info->map.virt == NULL) {
dev_err(dev, "failed to ioremap() region\n"); dev_err(&pdev->dev, "failed to ioremap() region\n");
err = -EIO; err = -EIO;
goto exit_free; goto exit_free;
} }
simple_map_init(&info->map); simple_map_init(&info->map);
dev_dbg(dev, "initialised map, probing for mtd\n"); dev_dbg(&pdev->dev, "initialised map, probing for mtd\n");
/* probe for the right mtd map driver */ /* probe for the right mtd map driver */
info->mtd = do_map_probe("map_ram" , &info->map); info->mtd = do_map_probe("map_ram" , &info->map);
if (info->mtd == NULL) { if (info->mtd == NULL) {
dev_err(dev, "failed to probe for map_ram\n"); dev_err(&pdev->dev, "failed to probe for map_ram\n");
err = -ENOMEM; err = -ENOMEM;
goto exit_free; goto exit_free;
} }
@ -237,27 +236,28 @@ static int platram_probe(struct device *dev)
#endif /* CONFIG_MTD_PARTITIONS */ #endif /* CONFIG_MTD_PARTITIONS */
if (add_mtd_device(info->mtd)) { if (add_mtd_device(info->mtd)) {
dev_err(dev, "add_mtd_device() failed\n"); dev_err(&pdev->dev, "add_mtd_device() failed\n");
err = -ENOMEM; err = -ENOMEM;
} }
dev_info(dev, "registered mtd device\n"); dev_info(&pdev->dev, "registered mtd device\n");
return err; return err;
exit_free: exit_free:
platram_remove(dev); platram_remove(pdev);
exit_error: exit_error:
return err; return err;
} }
/* device driver info */ /* device driver info */
static struct device_driver platram_driver = { static struct platform_driver platram_driver = {
.name = "mtd-ram",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = platram_probe, .probe = platram_probe,
.remove = platram_remove, .remove = platram_remove,
.driver = {
.name = "mtd-ram",
.owner = THIS_MODULE,
},
}; };
/* module init/exit */ /* module init/exit */
@ -265,12 +265,12 @@ static struct device_driver platram_driver = {
static int __init platram_init(void) static int __init platram_init(void)
{ {
printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n"); printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n");
return driver_register(&platram_driver); return platform_driver_register(&platram_driver);
} }
static void __exit platram_exit(void) static void __exit platram_exit(void)
{ {
driver_unregister(&platram_driver); platform_driver_unregister(&platram_driver);
} }
module_init(platram_init); module_init(platram_init);

View File

@ -356,9 +356,8 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
static int __init sa1100_mtd_probe(struct device *dev) static int __init sa1100_mtd_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct flash_platform_data *plat = pdev->dev.platform_data; struct flash_platform_data *plat = pdev->dev.platform_data;
struct mtd_partition *parts; struct mtd_partition *parts;
const char *part_type = NULL; const char *part_type = NULL;
@ -402,28 +401,28 @@ static int __init sa1100_mtd_probe(struct device *dev)
info->nr_parts = nr_parts; info->nr_parts = nr_parts;
dev_set_drvdata(dev, info); platform_set_drvdata(pdev, info);
err = 0; err = 0;
out: out:
return err; return err;
} }
static int __exit sa1100_mtd_remove(struct device *dev) static int __exit sa1100_mtd_remove(struct platform_device *pdev)
{ {
struct sa_info *info = dev_get_drvdata(dev); struct sa_info *info = platform_get_drvdata(pdev);
struct flash_platform_data *plat = dev->platform_data; struct flash_platform_data *plat = pdev->dev.platform_data;
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
sa1100_destroy(info, plat); sa1100_destroy(info, plat);
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) static int sa1100_mtd_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct sa_info *info = dev_get_drvdata(dev); struct sa_info *info = platform_get_drvdata(dev);
int ret = 0; int ret = 0;
if (info) if (info)
@ -432,17 +431,17 @@ static int sa1100_mtd_suspend(struct device *dev, pm_message_t state)
return ret; return ret;
} }
static int sa1100_mtd_resume(struct device *dev) static int sa1100_mtd_resume(struct platform_device *dev)
{ {
struct sa_info *info = dev_get_drvdata(dev); struct sa_info *info = platform_get_drvdata(dev);
if (info) if (info)
info->mtd->resume(info->mtd); info->mtd->resume(info->mtd);
return 0; return 0;
} }
static void sa1100_mtd_shutdown(struct device *dev) static void sa1100_mtd_shutdown(struct platform_device *dev)
{ {
struct sa_info *info = dev_get_drvdata(dev); struct sa_info *info = platform_get_drvdata(dev);
if (info && info->mtd->suspend(info->mtd) == 0) if (info && info->mtd->suspend(info->mtd) == 0)
info->mtd->resume(info->mtd); info->mtd->resume(info->mtd);
} }
@ -452,24 +451,25 @@ static void sa1100_mtd_shutdown(struct device *dev)
#define sa1100_mtd_shutdown NULL #define sa1100_mtd_shutdown NULL
#endif #endif
static struct device_driver sa1100_mtd_driver = { static struct platform_driver sa1100_mtd_driver = {
.name = "flash",
.bus = &platform_bus_type,
.probe = sa1100_mtd_probe, .probe = sa1100_mtd_probe,
.remove = __exit_p(sa1100_mtd_remove), .remove = __exit_p(sa1100_mtd_remove),
.suspend = sa1100_mtd_suspend, .suspend = sa1100_mtd_suspend,
.resume = sa1100_mtd_resume, .resume = sa1100_mtd_resume,
.shutdown = sa1100_mtd_shutdown, .shutdown = sa1100_mtd_shutdown,
.driver = {
.name = "flash",
},
}; };
static int __init sa1100_mtd_init(void) static int __init sa1100_mtd_init(void)
{ {
return driver_register(&sa1100_mtd_driver); return platform_driver_register(&sa1100_mtd_driver);
} }
static void __exit sa1100_mtd_exit(void) static void __exit sa1100_mtd_exit(void)
{ {
driver_unregister(&sa1100_mtd_driver); platform_driver_unregister(&sa1100_mtd_driver);
} }
module_init(sa1100_mtd_init); module_init(sa1100_mtd_init);

View File

@ -125,14 +125,14 @@ static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd)
return s3c2410_nand_mtd_toours(mtd)->info; return s3c2410_nand_mtd_toours(mtd)->info;
} }
static struct s3c2410_nand_info *to_nand_info(struct device *dev) static struct s3c2410_nand_info *to_nand_info(struct platform_device *dev)
{ {
return dev_get_drvdata(dev); return platform_get_drvdata(dev);
} }
static struct s3c2410_platform_nand *to_nand_plat(struct device *dev) static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev)
{ {
return dev->platform_data; return dev->dev.platform_data;
} }
/* timing calculations */ /* timing calculations */
@ -165,9 +165,9 @@ static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max)
/* controller setup */ /* controller setup */
static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, static int s3c2410_nand_inithw(struct s3c2410_nand_info *info,
struct device *dev) struct platform_device *pdev)
{ {
struct s3c2410_platform_nand *plat = to_nand_plat(dev); struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
unsigned long clkrate = clk_get_rate(info->clk); unsigned long clkrate = clk_get_rate(info->clk);
int tacls, twrph0, twrph1; int tacls, twrph0, twrph1;
unsigned long cfg; unsigned long cfg;
@ -430,11 +430,11 @@ static void s3c2410_nand_write_buf(struct mtd_info *mtd,
/* device management functions */ /* device management functions */
static int s3c2410_nand_remove(struct device *dev) static int s3c2410_nand_remove(struct platform_device *pdev)
{ {
struct s3c2410_nand_info *info = to_nand_info(dev); struct s3c2410_nand_info *info = to_nand_info(pdev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
if (info == NULL) if (info == NULL)
return 0; return 0;
@ -562,10 +562,9 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
* nand layer to look for devices * nand layer to look for devices
*/ */
static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440) static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440)
{ {
struct platform_device *pdev = to_platform_device(dev); struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
struct s3c2410_platform_nand *plat = to_nand_plat(dev);
struct s3c2410_nand_info *info; struct s3c2410_nand_info *info;
struct s3c2410_nand_mtd *nmtd; struct s3c2410_nand_mtd *nmtd;
struct s3c2410_nand_set *sets; struct s3c2410_nand_set *sets;
@ -575,26 +574,26 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
int nr_sets; int nr_sets;
int setno; int setno;
pr_debug("s3c2410_nand_probe(%p)\n", dev); pr_debug("s3c2410_nand_probe(%p)\n", pdev);
info = kmalloc(sizeof(*info), GFP_KERNEL); info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) { if (info == NULL) {
dev_err(dev, "no memory for flash info\n"); dev_err(&pdev->dev, "no memory for flash info\n");
err = -ENOMEM; err = -ENOMEM;
goto exit_error; goto exit_error;
} }
memzero(info, sizeof(*info)); memzero(info, sizeof(*info));
dev_set_drvdata(dev, info); platform_set_drvdata(pdev, info);
spin_lock_init(&info->controller.lock); spin_lock_init(&info->controller.lock);
init_waitqueue_head(&info->controller.wq); init_waitqueue_head(&info->controller.wq);
/* get the clock source and enable it */ /* get the clock source and enable it */
info->clk = clk_get(dev, "nand"); info->clk = clk_get(&pdev->dev, "nand");
if (IS_ERR(info->clk)) { if (IS_ERR(info->clk)) {
dev_err(dev, "failed to get clock"); dev_err(&pdev->dev, "failed to get clock");
err = -ENOENT; err = -ENOENT;
goto exit_error; goto exit_error;
} }
@ -611,27 +610,27 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
info->area = request_mem_region(res->start, size, pdev->name); info->area = request_mem_region(res->start, size, pdev->name);
if (info->area == NULL) { if (info->area == NULL) {
dev_err(dev, "cannot reserve register region\n"); dev_err(&pdev->dev, "cannot reserve register region\n");
err = -ENOENT; err = -ENOENT;
goto exit_error; goto exit_error;
} }
info->device = dev; info->device = &pdev->dev;
info->platform = plat; info->platform = plat;
info->regs = ioremap(res->start, size); info->regs = ioremap(res->start, size);
info->is_s3c2440 = is_s3c2440; info->is_s3c2440 = is_s3c2440;
if (info->regs == NULL) { if (info->regs == NULL) {
dev_err(dev, "cannot reserve register region\n"); dev_err(&pdev->dev, "cannot reserve register region\n");
err = -EIO; err = -EIO;
goto exit_error; goto exit_error;
} }
dev_dbg(dev, "mapped registers at %p\n", info->regs); dev_dbg(&pdev->dev, "mapped registers at %p\n", info->regs);
/* initialise the hardware */ /* initialise the hardware */
err = s3c2410_nand_inithw(info, dev); err = s3c2410_nand_inithw(info, pdev);
if (err != 0) if (err != 0)
goto exit_error; goto exit_error;
@ -645,7 +644,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
size = nr_sets * sizeof(*info->mtds); size = nr_sets * sizeof(*info->mtds);
info->mtds = kmalloc(size, GFP_KERNEL); info->mtds = kmalloc(size, GFP_KERNEL);
if (info->mtds == NULL) { if (info->mtds == NULL) {
dev_err(dev, "failed to allocate mtd storage\n"); dev_err(&pdev->dev, "failed to allocate mtd storage\n");
err = -ENOMEM; err = -ENOMEM;
goto exit_error; goto exit_error;
} }
@ -677,7 +676,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
return 0; return 0;
exit_error: exit_error:
s3c2410_nand_remove(dev); s3c2410_nand_remove(pdev);
if (err == 0) if (err == 0)
err = -EINVAL; err = -EINVAL;
@ -686,44 +685,46 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
/* driver device registration */ /* driver device registration */
static int s3c2410_nand_probe(struct device *dev) static int s3c2410_nand_probe(struct platform_device *dev)
{ {
return s3c24xx_nand_probe(dev, 0); return s3c24xx_nand_probe(dev, 0);
} }
static int s3c2440_nand_probe(struct device *dev) static int s3c2440_nand_probe(struct platform_device *dev)
{ {
return s3c24xx_nand_probe(dev, 1); return s3c24xx_nand_probe(dev, 1);
} }
static struct device_driver s3c2410_nand_driver = { static struct platform_driver s3c2410_nand_driver = {
.name = "s3c2410-nand",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = s3c2410_nand_probe, .probe = s3c2410_nand_probe,
.remove = s3c2410_nand_remove, .remove = s3c2410_nand_remove,
.driver = {
.name = "s3c2410-nand",
.owner = THIS_MODULE,
},
}; };
static struct device_driver s3c2440_nand_driver = { static struct platform_driver s3c2440_nand_driver = {
.name = "s3c2440-nand",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = s3c2440_nand_probe, .probe = s3c2440_nand_probe,
.remove = s3c2410_nand_remove, .remove = s3c2410_nand_remove,
.driver = {
.name = "s3c2440-nand",
.owner = THIS_MODULE,
},
}; };
static int __init s3c2410_nand_init(void) static int __init s3c2410_nand_init(void)
{ {
printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n"); printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n");
driver_register(&s3c2440_nand_driver); platform_driver_register(&s3c2440_nand_driver);
return driver_register(&s3c2410_nand_driver); return platform_driver_register(&s3c2410_nand_driver);
} }
static void __exit s3c2410_nand_exit(void) static void __exit s3c2410_nand_exit(void)
{ {
driver_unregister(&s3c2440_nand_driver); platform_driver_unregister(&s3c2440_nand_driver);
driver_unregister(&s3c2410_nand_driver); platform_driver_unregister(&s3c2410_nand_driver);
} }
module_init(s3c2410_nand_init); module_init(s3c2410_nand_init);

View File

@ -398,13 +398,19 @@ static struct mca_driver depca_mca_driver = {
}; };
#endif #endif
static int depca_isa_probe (struct device *); static int depca_isa_probe (struct platform_device *);
static struct device_driver depca_isa_driver = { static int __devexit depca_isa_remove(struct platform_device *pdev)
.name = depca_string, {
.bus = &platform_bus_type, return depca_device_remove(&pdev->dev);
}
static struct platform_driver depca_isa_driver = {
.probe = depca_isa_probe, .probe = depca_isa_probe,
.remove = __devexit_p(depca_device_remove), .remove = __devexit_p(depca_isa_remove),
.driver = {
.name = depca_string,
},
}; };
/* /*
@ -1525,7 +1531,7 @@ static enum depca_type __init depca_shmem_probe (ulong *mem_start)
return adapter; return adapter;
} }
static int __init depca_isa_probe (struct device *device) static int __init depca_isa_probe (struct platform_device *device)
{ {
struct net_device *dev; struct net_device *dev;
struct depca_private *lp; struct depca_private *lp;
@ -1533,7 +1539,7 @@ static int __init depca_isa_probe (struct device *device)
enum depca_type adapter = unknown; enum depca_type adapter = unknown;
int status = 0; int status = 0;
ioaddr = (u_long) device->platform_data; ioaddr = (u_long) device->dev.platform_data;
if ((status = depca_common_init (ioaddr, &dev))) if ((status = depca_common_init (ioaddr, &dev)))
goto out; goto out;
@ -1553,7 +1559,7 @@ static int __init depca_isa_probe (struct device *device)
lp->adapter = adapter; lp->adapter = adapter;
lp->mem_start = mem_start; lp->mem_start = mem_start;
if ((status = depca_hw_init(dev, device))) if ((status = depca_hw_init(dev, &device->dev)))
goto out_free; goto out_free;
return 0; return 0;
@ -2082,7 +2088,7 @@ static int __init depca_module_init (void)
#ifdef CONFIG_EISA #ifdef CONFIG_EISA
err |= eisa_driver_register (&depca_eisa_driver); err |= eisa_driver_register (&depca_eisa_driver);
#endif #endif
err |= driver_register (&depca_isa_driver); err |= platform_driver_register (&depca_isa_driver);
depca_platform_probe (); depca_platform_probe ();
return err; return err;
@ -2097,7 +2103,7 @@ static void __exit depca_module_exit (void)
#ifdef CONFIG_EISA #ifdef CONFIG_EISA
eisa_driver_unregister (&depca_eisa_driver); eisa_driver_unregister (&depca_eisa_driver);
#endif #endif
driver_unregister (&depca_isa_driver); platform_driver_unregister (&depca_isa_driver);
for (i = 0; depca_io_ports[i].iobase; i++) { for (i = 0; depca_io_ports[i].iobase; i++) {
if (depca_io_ports[i].device) { if (depca_io_ports[i].device) {

View File

@ -149,7 +149,7 @@ typedef struct board_info {
} board_info_t; } board_info_t;
/* function declaration ------------------------------------- */ /* function declaration ------------------------------------- */
static int dm9000_probe(struct device *); static int dm9000_probe(struct platform_device *);
static int dm9000_open(struct net_device *); static int dm9000_open(struct net_device *);
static int dm9000_start_xmit(struct sk_buff *, struct net_device *); static int dm9000_start_xmit(struct sk_buff *, struct net_device *);
static int dm9000_stop(struct net_device *); static int dm9000_stop(struct net_device *);
@ -379,9 +379,8 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
* Search DM9000 board, allocate space and register it * Search DM9000 board, allocate space and register it
*/ */
static int static int
dm9000_probe(struct device *dev) dm9000_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct dm9000_plat_data *pdata = pdev->dev.platform_data; struct dm9000_plat_data *pdata = pdev->dev.platform_data;
struct board_info *db; /* Point a board information structure */ struct board_info *db; /* Point a board information structure */
struct net_device *ndev; struct net_device *ndev;
@ -399,7 +398,7 @@ dm9000_probe(struct device *dev)
} }
SET_MODULE_OWNER(ndev); SET_MODULE_OWNER(ndev);
SET_NETDEV_DEV(ndev, dev); SET_NETDEV_DEV(ndev, &pdev->dev);
PRINTK2("dm9000_probe()"); PRINTK2("dm9000_probe()");
@ -570,7 +569,7 @@ dm9000_probe(struct device *dev)
printk("%s: Invalid ethernet MAC address. Please " printk("%s: Invalid ethernet MAC address. Please "
"set using ifconfig\n", ndev->name); "set using ifconfig\n", ndev->name);
dev_set_drvdata(dev, ndev); platform_set_drvdata(pdev, ndev);
ret = register_netdev(ndev); ret = register_netdev(ndev);
if (ret == 0) { if (ret == 0) {
@ -1141,9 +1140,9 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
} }
static int static int
dm9000_drv_suspend(struct device *dev, pm_message_t state) dm9000_drv_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = platform_get_drvdata(dev);
if (ndev) { if (ndev) {
if (netif_running(ndev)) { if (netif_running(ndev)) {
@ -1155,9 +1154,9 @@ dm9000_drv_suspend(struct device *dev, pm_message_t state)
} }
static int static int
dm9000_drv_resume(struct device *dev) dm9000_drv_resume(struct platform_device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = platform_get_drvdata(dev);
board_info_t *db = (board_info_t *) ndev->priv; board_info_t *db = (board_info_t *) ndev->priv;
if (ndev) { if (ndev) {
@ -1173,12 +1172,11 @@ dm9000_drv_resume(struct device *dev)
} }
static int static int
dm9000_drv_remove(struct device *dev) dm9000_drv_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct net_device *ndev = platform_get_drvdata(pdev);
struct net_device *ndev = dev_get_drvdata(dev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
unregister_netdev(ndev); unregister_netdev(ndev);
dm9000_release_board(pdev, (board_info_t *) ndev->priv); dm9000_release_board(pdev, (board_info_t *) ndev->priv);
@ -1189,13 +1187,14 @@ dm9000_drv_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver dm9000_driver = { static struct platform_driver dm9000_driver = {
.name = "dm9000",
.bus = &platform_bus_type,
.probe = dm9000_probe, .probe = dm9000_probe,
.remove = dm9000_drv_remove, .remove = dm9000_drv_remove,
.suspend = dm9000_drv_suspend, .suspend = dm9000_drv_suspend,
.resume = dm9000_drv_resume, .resume = dm9000_drv_resume,
.driver = {
.name = "dm9000",
},
}; };
static int __init static int __init
@ -1203,13 +1202,13 @@ dm9000_init(void)
{ {
printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME); printk(KERN_INFO "%s Ethernet Driver\n", CARDNAME);
return driver_register(&dm9000_driver); /* search board and register */ return platform_driver_register(&dm9000_driver); /* search board and register */
} }
static void __exit static void __exit
dm9000_cleanup(void) dm9000_cleanup(void)
{ {
driver_unregister(&dm9000_driver); platform_driver_unregister(&dm9000_driver);
} }
module_init(dm9000_init); module_init(dm9000_init);

View File

@ -127,8 +127,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 adjust_link(struct net_device *dev);
static void init_registers(struct net_device *dev); static void init_registers(struct net_device *dev);
static int init_phy(struct net_device *dev); static int init_phy(struct net_device *dev);
static int gfar_probe(struct device *device); static int gfar_probe(struct platform_device *pdev);
static int gfar_remove(struct device *device); static int gfar_remove(struct platform_device *pdev);
static void free_skb_resources(struct gfar_private *priv); static void free_skb_resources(struct gfar_private *priv);
static void gfar_set_multi(struct net_device *dev); static void gfar_set_multi(struct net_device *dev);
static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
@ -157,12 +157,11 @@ int gfar_uses_fcb(struct gfar_private *priv)
/* Set up the ethernet device structure, private data, /* Set up the ethernet device structure, private data,
* and anything else we need before we start */ * and anything else we need before we start */
static int gfar_probe(struct device *device) static int gfar_probe(struct platform_device *pdev)
{ {
u32 tempval; u32 tempval;
struct net_device *dev = NULL; struct net_device *dev = NULL;
struct gfar_private *priv = NULL; struct gfar_private *priv = NULL;
struct platform_device *pdev = to_platform_device(device);
struct gianfar_platform_data *einfo; struct gianfar_platform_data *einfo;
struct resource *r; struct resource *r;
int idx; int idx;
@ -209,7 +208,7 @@ static int gfar_probe(struct device *device)
spin_lock_init(&priv->lock); spin_lock_init(&priv->lock);
dev_set_drvdata(device, dev); platform_set_drvdata(pdev, dev);
/* Stop the DMA engine now, in case it was running before */ /* Stop the DMA engine now, in case it was running before */
/* (The firmware could have used it, and left it running). */ /* (The firmware could have used it, and left it running). */
@ -246,7 +245,7 @@ static int gfar_probe(struct device *device)
dev->base_addr = (unsigned long) (priv->regs); dev->base_addr = (unsigned long) (priv->regs);
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, device); SET_NETDEV_DEV(dev, &pdev->dev);
/* Fill in the dev structure */ /* Fill in the dev structure */
dev->open = gfar_enet_open; dev->open = gfar_enet_open;
@ -378,12 +377,12 @@ regs_fail:
return err; return err;
} }
static int gfar_remove(struct device *device) static int gfar_remove(struct platform_device *pdev)
{ {
struct net_device *dev = dev_get_drvdata(device); struct net_device *dev = platform_get_drvdata(pdev);
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
dev_set_drvdata(device, NULL); platform_set_drvdata(pdev, NULL);
iounmap((void *) priv->regs); iounmap((void *) priv->regs);
free_netdev(dev); free_netdev(dev);
@ -1862,11 +1861,12 @@ static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs)
} }
/* Structure for a device driver */ /* Structure for a device driver */
static struct device_driver gfar_driver = { static struct platform_driver gfar_driver = {
.name = "fsl-gianfar",
.bus = &platform_bus_type,
.probe = gfar_probe, .probe = gfar_probe,
.remove = gfar_remove, .remove = gfar_remove,
.driver = {
.name = "fsl-gianfar",
},
}; };
static int __init gfar_init(void) static int __init gfar_init(void)
@ -1876,7 +1876,7 @@ static int __init gfar_init(void)
if (err) if (err)
return err; return err;
err = driver_register(&gfar_driver); err = platform_driver_register(&gfar_driver);
if (err) if (err)
gfar_mdio_exit(); gfar_mdio_exit();
@ -1886,7 +1886,7 @@ static int __init gfar_init(void)
static void __exit gfar_exit(void) static void __exit gfar_exit(void)
{ {
driver_unregister(&gfar_driver); platform_driver_unregister(&gfar_driver);
gfar_mdio_exit(); gfar_mdio_exit();
} }

View File

@ -291,9 +291,9 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si)
/* /*
* Suspend the IrDA interface. * Suspend the IrDA interface.
*/ */
static int sa1100_irda_suspend(struct device *_dev, pm_message_t state) static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state)
{ {
struct net_device *dev = dev_get_drvdata(_dev); struct net_device *dev = platform_get_drvdata(pdev);
struct sa1100_irda *si; struct sa1100_irda *si;
if (!dev) if (!dev)
@ -316,9 +316,9 @@ static int sa1100_irda_suspend(struct device *_dev, pm_message_t state)
/* /*
* Resume the IrDA interface. * Resume the IrDA interface.
*/ */
static int sa1100_irda_resume(struct device *_dev) static int sa1100_irda_resume(struct platform_device *pdev)
{ {
struct net_device *dev = dev_get_drvdata(_dev); struct net_device *dev = platform_get_drvdata(pdev);
struct sa1100_irda *si; struct sa1100_irda *si;
if (!dev) if (!dev)
@ -886,9 +886,8 @@ static int sa1100_irda_init_iobuf(iobuff_t *io, int size)
return io->head ? 0 : -ENOMEM; return io->head ? 0 : -ENOMEM;
} }
static int sa1100_irda_probe(struct device *_dev) static int sa1100_irda_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(_dev);
struct net_device *dev; struct net_device *dev;
struct sa1100_irda *si; struct sa1100_irda *si;
unsigned int baudrate_mask; unsigned int baudrate_mask;
@ -967,7 +966,7 @@ static int sa1100_irda_probe(struct device *_dev)
err = register_netdev(dev); err = register_netdev(dev);
if (err == 0) if (err == 0)
dev_set_drvdata(&pdev->dev, dev); platform_set_drvdata(pdev, dev);
if (err) { if (err) {
err_mem_5: err_mem_5:
@ -985,9 +984,9 @@ static int sa1100_irda_probe(struct device *_dev)
return err; return err;
} }
static int sa1100_irda_remove(struct device *_dev) static int sa1100_irda_remove(struct platform_device *pdev)
{ {
struct net_device *dev = dev_get_drvdata(_dev); struct net_device *dev = platform_get_drvdata(pdev);
if (dev) { if (dev) {
struct sa1100_irda *si = dev->priv; struct sa1100_irda *si = dev->priv;
@ -1004,13 +1003,14 @@ static int sa1100_irda_remove(struct device *_dev)
return 0; return 0;
} }
static struct device_driver sa1100ir_driver = { static struct platform_driver sa1100ir_driver = {
.name = "sa11x0-ir",
.bus = &platform_bus_type,
.probe = sa1100_irda_probe, .probe = sa1100_irda_probe,
.remove = sa1100_irda_remove, .remove = sa1100_irda_remove,
.suspend = sa1100_irda_suspend, .suspend = sa1100_irda_suspend,
.resume = sa1100_irda_resume, .resume = sa1100_irda_resume,
.driver = {
.name = "sa11x0-ir",
},
}; };
static int __init sa1100_irda_init(void) static int __init sa1100_irda_init(void)
@ -1023,12 +1023,12 @@ static int __init sa1100_irda_init(void)
if (power_level > 3) if (power_level > 3)
power_level = 3; power_level = 3;
return driver_register(&sa1100ir_driver); return platform_driver_register(&sa1100ir_driver);
} }
static void __exit sa1100_irda_exit(void) static void __exit sa1100_irda_exit(void)
{ {
driver_unregister(&sa1100ir_driver); platform_driver_unregister(&sa1100ir_driver);
} }
module_init(sa1100_irda_init); module_init(sa1100_irda_init);

View File

@ -214,14 +214,15 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base);
/* Power Management */ /* Power Management */
static int smsc_ircc_suspend(struct device *dev, pm_message_t state); static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state);
static int smsc_ircc_resume(struct device *dev); static int smsc_ircc_resume(struct platform_device *dev);
static struct device_driver smsc_ircc_driver = { static struct platform_driver smsc_ircc_driver = {
.name = SMSC_IRCC2_DRIVER_NAME,
.bus = &platform_bus_type,
.suspend = smsc_ircc_suspend, .suspend = smsc_ircc_suspend,
.resume = smsc_ircc_resume, .resume = smsc_ircc_resume,
.driver = {
.name = SMSC_IRCC2_DRIVER_NAME,
},
}; };
/* Transceivers for SMSC-ircc */ /* Transceivers for SMSC-ircc */
@ -346,7 +347,7 @@ static int __init smsc_ircc_init(void)
IRDA_DEBUG(1, "%s\n", __FUNCTION__); IRDA_DEBUG(1, "%s\n", __FUNCTION__);
ret = driver_register(&smsc_ircc_driver); ret = platform_driver_register(&smsc_ircc_driver);
if (ret) { if (ret) {
IRDA_ERROR("%s, Can't register driver!\n", driver_name); IRDA_ERROR("%s, Can't register driver!\n", driver_name);
return ret; return ret;
@ -378,7 +379,7 @@ static int __init smsc_ircc_init(void)
} }
if (ret) if (ret)
driver_unregister(&smsc_ircc_driver); platform_driver_unregister(&smsc_ircc_driver);
return ret; return ret;
} }
@ -491,7 +492,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
err = PTR_ERR(self->pldev); err = PTR_ERR(self->pldev);
goto err_out5; goto err_out5;
} }
dev_set_drvdata(&self->pldev->dev, self); platform_set_drvdata(self->pldev, self);
IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
dev_count++; dev_count++;
@ -1685,9 +1686,9 @@ static int smsc_ircc_net_close(struct net_device *dev)
return 0; return 0;
} }
static int smsc_ircc_suspend(struct device *dev, pm_message_t state) static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct smsc_ircc_cb *self = dev_get_drvdata(dev); struct smsc_ircc_cb *self = platform_get_drvdata(dev);
if (!self->io.suspended) { if (!self->io.suspended) {
IRDA_DEBUG(1, "%s, Suspending\n", driver_name); IRDA_DEBUG(1, "%s, Suspending\n", driver_name);
@ -1706,9 +1707,9 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int smsc_ircc_resume(struct device *dev) static int smsc_ircc_resume(struct platform_device *dev)
{ {
struct smsc_ircc_cb *self = dev_get_drvdata(dev); struct smsc_ircc_cb *self = platform_get_drvdata(dev);
if (self->io.suspended) { if (self->io.suspended) {
IRDA_DEBUG(1, "%s, Waking up\n", driver_name); IRDA_DEBUG(1, "%s, Waking up\n", driver_name);
@ -1788,7 +1789,7 @@ static void __exit smsc_ircc_cleanup(void)
smsc_ircc_close(dev_self[i]); smsc_ircc_close(dev_self[i]);
} }
driver_unregister(&smsc_ircc_driver); platform_driver_unregister(&smsc_ircc_driver);
} }
/* /*

View File

@ -194,7 +194,7 @@ out:
* Probe for a SONIC ethernet controller on a Mips Jazz board. * Probe for a SONIC ethernet controller on a Mips Jazz board.
* Actually probing is superfluous but we're paranoid. * Actually probing is superfluous but we're paranoid.
*/ */
static int __init jazz_sonic_probe(struct device *device) static int __init jazz_sonic_probe(struct platform_device *pdev)
{ {
struct net_device *dev; struct net_device *dev;
struct sonic_local *lp; struct sonic_local *lp;
@ -212,8 +212,8 @@ static int __init jazz_sonic_probe(struct device *device)
return -ENOMEM; return -ENOMEM;
lp = netdev_priv(dev); lp = netdev_priv(dev);
lp->device = device; lp->device = &pdev->dev;
SET_NETDEV_DEV(dev, device); SET_NETDEV_DEV(dev, &pdev->dev);
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
netdev_boot_setup_check(dev); netdev_boot_setup_check(dev);
@ -264,9 +264,9 @@ MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
#include "sonic.c" #include "sonic.c"
static int __devexit jazz_sonic_device_remove (struct device *device) static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
{ {
struct net_device *dev = device->driver_data; struct net_device *dev = platform_get_drvdata(pdev);
struct sonic_local* lp = netdev_priv(dev); struct sonic_local* lp = netdev_priv(dev);
unregister_netdev (dev); unregister_netdev (dev);
@ -278,18 +278,19 @@ static int __devexit jazz_sonic_device_remove (struct device *device)
return 0; return 0;
} }
static struct device_driver jazz_sonic_driver = { static struct platform_driver jazz_sonic_driver = {
.name = jazz_sonic_string,
.bus = &platform_bus_type,
.probe = jazz_sonic_probe, .probe = jazz_sonic_probe,
.remove = __devexit_p(jazz_sonic_device_remove), .remove = __devexit_p(jazz_sonic_device_remove),
.driver = {
.name = jazz_sonic_string,
},
}; };
static int __init jazz_sonic_init_module(void) static int __init jazz_sonic_init_module(void)
{ {
int err; int err;
if ((err = driver_register(&jazz_sonic_driver))) { if ((err = platform_driver_register(&jazz_sonic_driver))) {
printk(KERN_ERR "Driver registration failed\n"); printk(KERN_ERR "Driver registration failed\n");
return err; return err;
} }
@ -313,7 +314,7 @@ out_unregister:
static void __exit jazz_sonic_cleanup_module(void) static void __exit jazz_sonic_cleanup_module(void)
{ {
driver_unregister(&jazz_sonic_driver); platform_driver_unregister(&jazz_sonic_driver);
if (jazz_sonic_device) { if (jazz_sonic_device) {
platform_device_unregister(jazz_sonic_device); platform_device_unregister(jazz_sonic_device);

View File

@ -525,7 +525,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
return macsonic_init(dev); return macsonic_init(dev);
} }
static int __init mac_sonic_probe(struct device *device) static int __init mac_sonic_probe(struct platform_device *device)
{ {
struct net_device *dev; struct net_device *dev;
struct sonic_local *lp; struct sonic_local *lp;
@ -537,8 +537,8 @@ static int __init mac_sonic_probe(struct device *device)
return -ENOMEM; return -ENOMEM;
lp = netdev_priv(dev); lp = netdev_priv(dev);
lp->device = device; lp->device = &device->dev;
SET_NETDEV_DEV(dev, device); SET_NETDEV_DEV(dev, &device->dev);
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
/* This will catch fatal stuff like -ENOMEM as well as success */ /* 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" #include "sonic.c"
static int __devexit mac_sonic_device_remove (struct device *device) static int __devexit mac_sonic_device_remove (struct platform_device *device)
{ {
struct net_device *dev = device->driver_data; struct net_device *dev = platform_get_drvdata(device);
struct sonic_local* lp = netdev_priv(dev); struct sonic_local* lp = netdev_priv(dev);
unregister_netdev (dev); unregister_netdev (dev);
@ -592,18 +592,19 @@ static int __devexit mac_sonic_device_remove (struct device *device)
return 0; return 0;
} }
static struct device_driver mac_sonic_driver = { static struct platform_driver mac_sonic_driver = {
.name = mac_sonic_string,
.bus = &platform_bus_type,
.probe = mac_sonic_probe, .probe = mac_sonic_probe,
.remove = __devexit_p(mac_sonic_device_remove), .remove = __devexit_p(mac_sonic_device_remove),
.driver = {
.name = mac_sonic_string,
},
}; };
static int __init mac_sonic_init_module(void) static int __init mac_sonic_init_module(void)
{ {
int err; int err;
if ((err = driver_register(&mac_sonic_driver))) { if ((err = platform_driver_register(&mac_sonic_driver))) {
printk(KERN_ERR "Driver registration failed\n"); printk(KERN_ERR "Driver registration failed\n");
return err; return err;
} }
@ -628,7 +629,7 @@ out_unregister:
static void __exit mac_sonic_cleanup_module(void) static void __exit mac_sonic_cleanup_module(void)
{ {
driver_unregister(&mac_sonic_driver); platform_driver_unregister(&mac_sonic_driver);
if (mac_sonic_device) { if (mac_sonic_device) {
platform_device_unregister(mac_sonic_device); platform_device_unregister(mac_sonic_device);

View File

@ -1387,9 +1387,8 @@ static void mv643xx_netpoll(struct net_device *netdev)
* Input : struct device * * Input : struct device *
* Output : -ENOMEM if failed , 0 if success * Output : -ENOMEM if failed , 0 if success
*/ */
static int mv643xx_eth_probe(struct device *ddev) static int mv643xx_eth_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(ddev);
struct mv643xx_eth_platform_data *pd; struct mv643xx_eth_platform_data *pd;
int port_num = pdev->id; int port_num = pdev->id;
struct mv643xx_private *mp; struct mv643xx_private *mp;
@ -1402,7 +1401,7 @@ static int mv643xx_eth_probe(struct device *ddev)
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(ddev, dev); platform_set_drvdata(pdev, dev);
mp = netdev_priv(dev); mp = netdev_priv(dev);
@ -1546,21 +1545,20 @@ out:
return err; return err;
} }
static int mv643xx_eth_remove(struct device *ddev) static int mv643xx_eth_remove(struct platform_device *pdev)
{ {
struct net_device *dev = dev_get_drvdata(ddev); struct net_device *dev = platform_get_drvdata(pdev);
unregister_netdev(dev); unregister_netdev(dev);
flush_scheduled_work(); flush_scheduled_work();
free_netdev(dev); free_netdev(dev);
dev_set_drvdata(ddev, NULL); platform_set_drvdata(pdev, NULL);
return 0; return 0;
} }
static int mv643xx_eth_shared_probe(struct device *ddev) static int mv643xx_eth_shared_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(ddev);
struct resource *res; struct resource *res;
printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n");
@ -1578,7 +1576,7 @@ static int mv643xx_eth_shared_probe(struct device *ddev)
} }
static int mv643xx_eth_shared_remove(struct device *ddev) static int mv643xx_eth_shared_remove(struct platform_device *pdev)
{ {
iounmap(mv643xx_eth_shared_base); iounmap(mv643xx_eth_shared_base);
mv643xx_eth_shared_base = NULL; mv643xx_eth_shared_base = NULL;
@ -1586,18 +1584,20 @@ static int mv643xx_eth_shared_remove(struct device *ddev)
return 0; return 0;
} }
static struct device_driver mv643xx_eth_driver = { static struct platform_driver mv643xx_eth_driver = {
.name = MV643XX_ETH_NAME,
.bus = &platform_bus_type,
.probe = mv643xx_eth_probe, .probe = mv643xx_eth_probe,
.remove = mv643xx_eth_remove, .remove = mv643xx_eth_remove,
.driver = {
.name = MV643XX_ETH_NAME,
},
}; };
static struct device_driver mv643xx_eth_shared_driver = { static struct platform_driver mv643xx_eth_shared_driver = {
.name = MV643XX_ETH_SHARED_NAME,
.bus = &platform_bus_type,
.probe = mv643xx_eth_shared_probe, .probe = mv643xx_eth_shared_probe,
.remove = mv643xx_eth_shared_remove, .remove = mv643xx_eth_shared_remove,
.driver = {
.name = MV643XX_ETH_SHARED_NAME,
},
}; };
/* /*
@ -1613,11 +1613,11 @@ static int __init mv643xx_init_module(void)
{ {
int rc; int rc;
rc = driver_register(&mv643xx_eth_shared_driver); rc = platform_driver_register(&mv643xx_eth_shared_driver);
if (!rc) { if (!rc) {
rc = driver_register(&mv643xx_eth_driver); rc = platform_driver_register(&mv643xx_eth_driver);
if (rc) if (rc)
driver_unregister(&mv643xx_eth_shared_driver); platform_driver_unregister(&mv643xx_eth_shared_driver);
} }
return rc; return rc;
} }
@ -1633,8 +1633,8 @@ static int __init mv643xx_init_module(void)
*/ */
static void __exit mv643xx_cleanup_module(void) static void __exit mv643xx_cleanup_module(void)
{ {
driver_unregister(&mv643xx_eth_driver); platform_driver_unregister(&mv643xx_eth_driver);
driver_unregister(&mv643xx_eth_shared_driver); platform_driver_unregister(&mv643xx_eth_shared_driver);
} }
module_init(mv643xx_init_module); module_init(mv643xx_init_module);

View File

@ -2183,9 +2183,8 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device *
* 0 --> there is a device * 0 --> there is a device
* anything else, error * anything else, error
*/ */
static int smc_drv_probe(struct device *dev) static int smc_drv_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct net_device *ndev; struct net_device *ndev;
struct resource *res; struct resource *res;
unsigned int __iomem *addr; unsigned int __iomem *addr;
@ -2212,7 +2211,7 @@ static int smc_drv_probe(struct device *dev)
goto out_release_io; goto out_release_io;
} }
SET_MODULE_OWNER(ndev); SET_MODULE_OWNER(ndev);
SET_NETDEV_DEV(ndev, dev); SET_NETDEV_DEV(ndev, &pdev->dev);
ndev->dma = (unsigned char)-1; ndev->dma = (unsigned char)-1;
ndev->irq = platform_get_irq(pdev, 0); ndev->irq = platform_get_irq(pdev, 0);
@ -2233,7 +2232,7 @@ static int smc_drv_probe(struct device *dev)
goto out_release_attrib; goto out_release_attrib;
} }
dev_set_drvdata(dev, ndev); platform_set_drvdata(pdev, ndev);
ret = smc_probe(ndev, addr); ret = smc_probe(ndev, addr);
if (ret != 0) if (ret != 0)
goto out_iounmap; goto out_iounmap;
@ -2249,7 +2248,7 @@ static int smc_drv_probe(struct device *dev)
return 0; return 0;
out_iounmap: out_iounmap:
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
iounmap(addr); iounmap(addr);
out_release_attrib: out_release_attrib:
smc_release_attrib(pdev); smc_release_attrib(pdev);
@ -2263,14 +2262,13 @@ static int smc_drv_probe(struct device *dev)
return ret; return ret;
} }
static int smc_drv_remove(struct device *dev) static int smc_drv_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct net_device *ndev = platform_get_drvdata(pdev);
struct net_device *ndev = dev_get_drvdata(dev);
struct smc_local *lp = netdev_priv(ndev); struct smc_local *lp = netdev_priv(ndev);
struct resource *res; struct resource *res;
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
unregister_netdev(ndev); unregister_netdev(ndev);
@ -2295,9 +2293,9 @@ static int smc_drv_remove(struct device *dev)
return 0; return 0;
} }
static int smc_drv_suspend(struct device *dev, pm_message_t state) static int smc_drv_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = platform_get_drvdata(dev);
if (ndev) { if (ndev) {
if (netif_running(ndev)) { if (netif_running(ndev)) {
@ -2309,14 +2307,13 @@ static int smc_drv_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int smc_drv_resume(struct device *dev) static int smc_drv_resume(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct net_device *ndev = platform_get_drvdata(dev);
struct net_device *ndev = dev_get_drvdata(dev);
if (ndev) { if (ndev) {
struct smc_local *lp = netdev_priv(ndev); struct smc_local *lp = netdev_priv(ndev);
smc_enable_device(pdev); smc_enable_device(dev);
if (netif_running(ndev)) { if (netif_running(ndev)) {
smc_reset(ndev); smc_reset(ndev);
smc_enable(ndev); smc_enable(ndev);
@ -2328,13 +2325,14 @@ static int smc_drv_resume(struct device *dev)
return 0; return 0;
} }
static struct device_driver smc_driver = { static struct platform_driver smc_driver = {
.name = CARDNAME,
.bus = &platform_bus_type,
.probe = smc_drv_probe, .probe = smc_drv_probe,
.remove = smc_drv_remove, .remove = smc_drv_remove,
.suspend = smc_drv_suspend, .suspend = smc_drv_suspend,
.resume = smc_drv_resume, .resume = smc_drv_resume,
.driver = {
.name = CARDNAME,
},
}; };
static int __init smc_init(void) static int __init smc_init(void)
@ -2348,12 +2346,12 @@ static int __init smc_init(void)
#endif #endif
#endif #endif
return driver_register(&smc_driver); return platform_driver_register(&smc_driver);
} }
static void __exit smc_cleanup(void) static void __exit smc_cleanup(void)
{ {
driver_unregister(&smc_driver); platform_driver_unregister(&smc_driver);
} }
module_init(smc_init); module_init(smc_init);

View File

@ -344,9 +344,10 @@ module_param_array(dma, int, NULL, 0);
static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS]; static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS];
static struct device_driver proteon_driver = { static struct platform_driver proteon_driver = {
.name = "proteon", .driver = {
.bus = &platform_bus_type, .name = "proteon",
},
}; };
static int __init proteon_init(void) static int __init proteon_init(void)
@ -355,7 +356,7 @@ static int __init proteon_init(void)
struct platform_device *pdev; struct platform_device *pdev;
int i, num = 0, err = 0; int i, num = 0, err = 0;
err = driver_register(&proteon_driver); err = platform_driver_register(&proteon_driver);
if (err) if (err)
return err; return err;
@ -372,7 +373,7 @@ static int __init proteon_init(void)
err = setup_card(dev, &pdev->dev); err = setup_card(dev, &pdev->dev);
if (!err) { if (!err) {
proteon_dev[i] = pdev; proteon_dev[i] = pdev;
dev_set_drvdata(&pdev->dev, dev); platform_set_drvdata(pdev, dev);
++num; ++num;
} else { } else {
platform_device_unregister(pdev); platform_device_unregister(pdev);
@ -399,17 +400,17 @@ static void __exit proteon_cleanup(void)
if (!pdev) if (!pdev)
continue; continue;
dev = dev_get_drvdata(&pdev->dev); dev = platform_get_drvdata(pdev);
unregister_netdev(dev); unregister_netdev(dev);
release_region(dev->base_addr, PROTEON_IO_EXTENT); release_region(dev->base_addr, PROTEON_IO_EXTENT);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
free_dma(dev->dma); free_dma(dev->dma);
tmsdev_term(dev); tmsdev_term(dev);
free_netdev(dev); free_netdev(dev);
dev_set_drvdata(&pdev->dev, NULL); platform_set_drvdata(pdev, NULL);
platform_device_unregister(pdev); platform_device_unregister(pdev);
} }
driver_unregister(&proteon_driver); platform_driver_unregister(&proteon_driver);
} }
module_init(proteon_init); module_init(proteon_init);

View File

@ -354,9 +354,10 @@ module_param_array(dma, int, NULL, 0);
static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS]; static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS];
static struct device_driver sk_isa_driver = { static struct platform_driver sk_isa_driver = {
.name = "skisa", .driver = {
.bus = &platform_bus_type, .name = "skisa",
},
}; };
static int __init sk_isa_init(void) static int __init sk_isa_init(void)
@ -365,7 +366,7 @@ static int __init sk_isa_init(void)
struct platform_device *pdev; struct platform_device *pdev;
int i, num = 0, err = 0; int i, num = 0, err = 0;
err = driver_register(&sk_isa_driver); err = platform_driver_register(&sk_isa_driver);
if (err) if (err)
return err; return err;
@ -382,7 +383,7 @@ static int __init sk_isa_init(void)
err = setup_card(dev, &pdev->dev); err = setup_card(dev, &pdev->dev);
if (!err) { if (!err) {
sk_isa_dev[i] = pdev; sk_isa_dev[i] = pdev;
dev_set_drvdata(&sk_isa_dev[i]->dev, dev); platform_set_drvdata(sk_isa_dev[i], dev);
++num; ++num;
} else { } else {
platform_device_unregister(pdev); platform_device_unregister(pdev);
@ -409,17 +410,17 @@ static void __exit sk_isa_cleanup(void)
if (!pdev) if (!pdev)
continue; continue;
dev = dev_get_drvdata(&pdev->dev); dev = platform_get_drvdata(pdev);
unregister_netdev(dev); unregister_netdev(dev);
release_region(dev->base_addr, SK_ISA_IO_EXTENT); release_region(dev->base_addr, SK_ISA_IO_EXTENT);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
free_dma(dev->dma); free_dma(dev->dma);
tmsdev_term(dev); tmsdev_term(dev);
free_netdev(dev); free_netdev(dev);
dev_set_drvdata(&pdev->dev, NULL); platform_set_drvdata(pdev, NULL);
platform_device_unregister(pdev); platform_device_unregister(pdev);
} }
driver_unregister(&sk_isa_driver); platform_driver_unregister(&sk_isa_driver);
} }
module_init(sk_isa_init); module_init(sk_isa_init);

View File

@ -2381,9 +2381,9 @@ void serial8250_resume_port(int line)
* list is terminated with a zero flags entry, which means we expect * list is terminated with a zero flags entry, which means we expect
* all entries to have at least UPF_BOOT_AUTOCONF set. * all entries to have at least UPF_BOOT_AUTOCONF set.
*/ */
static int __devinit serial8250_probe(struct device *dev) static int __devinit serial8250_probe(struct platform_device *dev)
{ {
struct plat_serial8250_port *p = dev->platform_data; struct plat_serial8250_port *p = dev->dev.platform_data;
struct uart_port port; struct uart_port port;
int ret, i; int ret, i;
@ -2399,12 +2399,12 @@ static int __devinit serial8250_probe(struct device *dev)
port.flags = p->flags; port.flags = p->flags;
port.mapbase = p->mapbase; port.mapbase = p->mapbase;
port.hub6 = p->hub6; port.hub6 = p->hub6;
port.dev = dev; port.dev = &dev->dev;
if (share_irqs) if (share_irqs)
port.flags |= UPF_SHARE_IRQ; port.flags |= UPF_SHARE_IRQ;
ret = serial8250_register_port(&port); ret = serial8250_register_port(&port);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "unable to register port at index %d " dev_err(&dev->dev, "unable to register port at index %d "
"(IO%lx MEM%lx IRQ%d): %d\n", i, "(IO%lx MEM%lx IRQ%d): %d\n", i,
p->iobase, p->mapbase, p->irq, ret); p->iobase, p->mapbase, p->irq, ret);
} }
@ -2415,54 +2415,55 @@ static int __devinit serial8250_probe(struct device *dev)
/* /*
* Remove serial ports registered against a platform device. * Remove serial ports registered against a platform device.
*/ */
static int __devexit serial8250_remove(struct device *dev) static int __devexit serial8250_remove(struct platform_device *dev)
{ {
int i; int i;
for (i = 0; i < UART_NR; i++) { for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i]; struct uart_8250_port *up = &serial8250_ports[i];
if (up->port.dev == dev) if (up->port.dev == &dev->dev)
serial8250_unregister_port(i); serial8250_unregister_port(i);
} }
return 0; return 0;
} }
static int serial8250_suspend(struct device *dev, pm_message_t state) static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
{ {
int i; int i;
for (i = 0; i < UART_NR; i++) { for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i]; struct uart_8250_port *up = &serial8250_ports[i];
if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
uart_suspend_port(&serial8250_reg, &up->port); uart_suspend_port(&serial8250_reg, &up->port);
} }
return 0; return 0;
} }
static int serial8250_resume(struct device *dev) static int serial8250_resume(struct platform_device *dev)
{ {
int i; int i;
for (i = 0; i < UART_NR; i++) { for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i]; struct uart_8250_port *up = &serial8250_ports[i];
if (up->port.type != PORT_UNKNOWN && up->port.dev == dev) if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
uart_resume_port(&serial8250_reg, &up->port); uart_resume_port(&serial8250_reg, &up->port);
} }
return 0; return 0;
} }
static struct device_driver serial8250_isa_driver = { static struct platform_driver serial8250_isa_driver = {
.name = "serial8250",
.bus = &platform_bus_type,
.probe = serial8250_probe, .probe = serial8250_probe,
.remove = __devexit_p(serial8250_remove), .remove = __devexit_p(serial8250_remove),
.suspend = serial8250_suspend, .suspend = serial8250_suspend,
.resume = serial8250_resume, .resume = serial8250_resume,
.driver = {
.name = "serial8250",
},
}; };
/* /*
@ -2608,7 +2609,7 @@ static int __init serial8250_init(void)
serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev); serial8250_register_ports(&serial8250_reg, &serial8250_isa_devs->dev);
ret = driver_register(&serial8250_isa_driver); ret = platform_driver_register(&serial8250_isa_driver);
if (ret == 0) if (ret == 0)
goto out; goto out;
@ -2630,7 +2631,7 @@ static void __exit serial8250_exit(void)
*/ */
serial8250_isa_devs = NULL; serial8250_isa_devs = NULL;
driver_unregister(&serial8250_isa_driver); platform_driver_unregister(&serial8250_isa_driver);
platform_device_unregister(isa_dev); platform_device_unregister(isa_dev);
uart_unregister_driver(&serial8250_reg); uart_unregister_driver(&serial8250_reg);

View File

@ -921,9 +921,9 @@ static struct uart_driver imx_reg = {
.cons = IMX_CONSOLE, .cons = IMX_CONSOLE,
}; };
static int serial_imx_suspend(struct device *_dev, pm_message_t state) static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct imx_port *sport = dev_get_drvdata(_dev); struct imx_port *sport = platform_get_drvdata(dev);
if (sport) if (sport)
uart_suspend_port(&imx_reg, &sport->port); uart_suspend_port(&imx_reg, &sport->port);
@ -931,9 +931,9 @@ static int serial_imx_suspend(struct device *_dev, pm_message_t state)
return 0; return 0;
} }
static int serial_imx_resume(struct device *_dev) static int serial_imx_resume(struct platform_device *dev)
{ {
struct imx_port *sport = dev_get_drvdata(_dev); struct imx_port *sport = platform_get_drvdata(dev);
if (sport) if (sport)
uart_resume_port(&imx_reg, &sport->port); uart_resume_port(&imx_reg, &sport->port);
@ -941,21 +941,19 @@ static int serial_imx_resume(struct device *_dev)
return 0; return 0;
} }
static int serial_imx_probe(struct device *_dev) static int serial_imx_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev); imx_ports[dev->id].port.dev = &dev->dev;
imx_ports[dev->id].port.dev = _dev;
uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
dev_set_drvdata(_dev, &imx_ports[dev->id]); platform_set_drvdata(dev, &imx_ports[dev->id]);
return 0; return 0;
} }
static int serial_imx_remove(struct device *_dev) static int serial_imx_remove(struct platform_device *dev)
{ {
struct imx_port *sport = dev_get_drvdata(_dev); struct imx_port *sport = platform_get_drvdata(dev);
dev_set_drvdata(_dev, NULL); platform_set_drvdata(dev, NULL);
if (sport) if (sport)
uart_remove_one_port(&imx_reg, &sport->port); uart_remove_one_port(&imx_reg, &sport->port);
@ -963,14 +961,15 @@ static int serial_imx_remove(struct device *_dev)
return 0; return 0;
} }
static struct device_driver serial_imx_driver = { static struct platform_driver serial_imx_driver = {
.name = "imx-uart",
.bus = &platform_bus_type,
.probe = serial_imx_probe, .probe = serial_imx_probe,
.remove = serial_imx_remove, .remove = serial_imx_remove,
.suspend = serial_imx_suspend, .suspend = serial_imx_suspend,
.resume = serial_imx_resume, .resume = serial_imx_resume,
.driver = {
.name = "imx-uart",
},
}; };
static int __init imx_serial_init(void) static int __init imx_serial_init(void)
@ -985,7 +984,7 @@ static int __init imx_serial_init(void)
if (ret) if (ret)
return ret; return ret;
ret = driver_register(&serial_imx_driver); ret = platform_driver_register(&serial_imx_driver);
if (ret != 0) if (ret != 0)
uart_unregister_driver(&imx_reg); uart_unregister_driver(&imx_reg);

View File

@ -717,10 +717,9 @@ static struct uart_driver mpc52xx_uart_driver = {
/* ======================================================================== */ /* ======================================================================== */
static int __devinit static int __devinit
mpc52xx_uart_probe(struct device *dev) mpc52xx_uart_probe(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct resource *res = dev->resource;
struct resource *res = pdev->resource;
struct uart_port *port = NULL; struct uart_port *port = NULL;
int i, idx, ret; int i, idx, ret;
@ -761,17 +760,17 @@ mpc52xx_uart_probe(struct device *dev)
/* Add the port to the uart sub-system */ /* Add the port to the uart sub-system */
ret = uart_add_one_port(&mpc52xx_uart_driver, port); ret = uart_add_one_port(&mpc52xx_uart_driver, port);
if (!ret) if (!ret)
dev_set_drvdata(dev, (void*)port); platform_set_drvdata(dev, (void*)port);
return ret; return ret;
} }
static int static int
mpc52xx_uart_remove(struct device *dev) mpc52xx_uart_remove(struct platform_device *dev)
{ {
struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
if (port) if (port)
uart_remove_one_port(&mpc52xx_uart_driver, port); uart_remove_one_port(&mpc52xx_uart_driver, port);
@ -781,9 +780,9 @@ mpc52xx_uart_remove(struct device *dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int static int
mpc52xx_uart_suspend(struct device *dev, pm_message_t state) mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
if (sport) if (sport)
uart_suspend_port(&mpc52xx_uart_driver, port); uart_suspend_port(&mpc52xx_uart_driver, port);
@ -792,9 +791,9 @@ mpc52xx_uart_suspend(struct device *dev, pm_message_t state)
} }
static int static int
mpc52xx_uart_resume(struct device *dev) mpc52xx_uart_resume(struct platform_device *dev)
{ {
struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev);
if (port) if (port)
uart_resume_port(&mpc52xx_uart_driver, port); uart_resume_port(&mpc52xx_uart_driver, port);
@ -803,15 +802,16 @@ mpc52xx_uart_resume(struct device *dev)
} }
#endif #endif
static struct device_driver mpc52xx_uart_platform_driver = { static struct platform_driver mpc52xx_uart_platform_driver = {
.name = "mpc52xx-psc",
.bus = &platform_bus_type,
.probe = mpc52xx_uart_probe, .probe = mpc52xx_uart_probe,
.remove = mpc52xx_uart_remove, .remove = mpc52xx_uart_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = mpc52xx_uart_suspend, .suspend = mpc52xx_uart_suspend,
.resume = mpc52xx_uart_resume, .resume = mpc52xx_uart_resume,
#endif #endif
.driver = {
.name = "mpc52xx-psc",
},
}; };
@ -828,7 +828,7 @@ mpc52xx_uart_init(void)
ret = uart_register_driver(&mpc52xx_uart_driver); ret = uart_register_driver(&mpc52xx_uart_driver);
if (ret == 0) { if (ret == 0) {
ret = driver_register(&mpc52xx_uart_platform_driver); ret = platform_driver_register(&mpc52xx_uart_platform_driver);
if (ret) if (ret)
uart_unregister_driver(&mpc52xx_uart_driver); uart_unregister_driver(&mpc52xx_uart_driver);
} }
@ -839,7 +839,7 @@ mpc52xx_uart_init(void)
static void __exit static void __exit
mpc52xx_uart_exit(void) mpc52xx_uart_exit(void)
{ {
driver_unregister(&mpc52xx_uart_platform_driver); platform_driver_unregister(&mpc52xx_uart_platform_driver);
uart_unregister_driver(&mpc52xx_uart_driver); uart_unregister_driver(&mpc52xx_uart_driver);
} }

View File

@ -1551,15 +1551,14 @@ mpsc_shared_unmap_regs(void)
} }
static int static int
mpsc_shared_drv_probe(struct device *dev) mpsc_shared_drv_probe(struct platform_device *dev)
{ {
struct platform_device *pd = to_platform_device(dev);
struct mpsc_shared_pdata *pdata; struct mpsc_shared_pdata *pdata;
int rc = -ENODEV; int rc = -ENODEV;
if (pd->id == 0) { if (dev->id == 0) {
if (!(rc = mpsc_shared_map_regs(pd))) { if (!(rc = mpsc_shared_map_regs(dev))) {
pdata = (struct mpsc_shared_pdata *)dev->platform_data; pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
@ -1577,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev)
} }
static int static int
mpsc_shared_drv_remove(struct device *dev) mpsc_shared_drv_remove(struct platform_device *dev)
{ {
struct platform_device *pd = to_platform_device(dev);
int rc = -ENODEV; int rc = -ENODEV;
if (pd->id == 0) { if (dev->id == 0) {
mpsc_shared_unmap_regs(); mpsc_shared_unmap_regs();
mpsc_shared_regs.MPSC_MRR_m = 0; mpsc_shared_regs.MPSC_MRR_m = 0;
mpsc_shared_regs.MPSC_RCRR_m = 0; mpsc_shared_regs.MPSC_RCRR_m = 0;
@ -1595,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev)
return rc; return rc;
} }
static struct device_driver mpsc_shared_driver = { static struct platform_driver mpsc_shared_driver = {
.name = MPSC_SHARED_NAME,
.bus = &platform_bus_type,
.probe = mpsc_shared_drv_probe, .probe = mpsc_shared_drv_probe,
.remove = mpsc_shared_drv_remove, .remove = mpsc_shared_drv_remove,
.driver = {
.name = MPSC_SHARED_NAME,
},
}; };
/* /*
@ -1732,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
} }
static int static int
mpsc_drv_probe(struct device *dev) mpsc_drv_probe(struct platform_device *dev)
{ {
struct platform_device *pd = to_platform_device(dev);
struct mpsc_port_info *pi; struct mpsc_port_info *pi;
int rc = -ENODEV; int rc = -ENODEV;
pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id);
if (pd->id < MPSC_NUM_CTLRS) { if (dev->id < MPSC_NUM_CTLRS) {
pi = &mpsc_ports[pd->id]; pi = &mpsc_ports[dev->id];
if (!(rc = mpsc_drv_map_regs(pi, pd))) { if (!(rc = mpsc_drv_map_regs(pi, dev))) {
mpsc_drv_get_platform_data(pi, pd, pd->id); mpsc_drv_get_platform_data(pi, dev, dev->id);
if (!(rc = mpsc_make_ready(pi))) if (!(rc = mpsc_make_ready(pi)))
if (!(rc = uart_add_one_port(&mpsc_reg, if (!(rc = uart_add_one_port(&mpsc_reg,
@ -1764,27 +1762,26 @@ mpsc_drv_probe(struct device *dev)
} }
static int static int
mpsc_drv_remove(struct device *dev) mpsc_drv_remove(struct platform_device *dev)
{ {
struct platform_device *pd = to_platform_device(dev); pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id); if (dev->id < MPSC_NUM_CTLRS) {
uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
if (pd->id < MPSC_NUM_CTLRS) { mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port);
mpsc_drv_unmap_regs(&mpsc_ports[pd->id]);
return 0; return 0;
} }
else else
return -ENODEV; return -ENODEV;
} }
static struct device_driver mpsc_driver = { static struct platform_driver mpsc_driver = {
.name = MPSC_CTLR_NAME,
.bus = &platform_bus_type,
.probe = mpsc_drv_probe, .probe = mpsc_drv_probe,
.remove = mpsc_drv_remove, .remove = mpsc_drv_remove,
.driver = {
.name = MPSC_CTLR_NAME,
},
}; };
static int __init static int __init
@ -1798,9 +1795,9 @@ mpsc_drv_init(void)
memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
if (!(rc = uart_register_driver(&mpsc_reg))) { if (!(rc = uart_register_driver(&mpsc_reg))) {
if (!(rc = driver_register(&mpsc_shared_driver))) { if (!(rc = platform_driver_register(&mpsc_shared_driver))) {
if ((rc = driver_register(&mpsc_driver))) { if ((rc = platform_driver_register(&mpsc_driver))) {
driver_unregister(&mpsc_shared_driver); platform_driver_unregister(&mpsc_shared_driver);
uart_unregister_driver(&mpsc_reg); uart_unregister_driver(&mpsc_reg);
} }
} }
@ -1815,8 +1812,8 @@ mpsc_drv_init(void)
static void __exit static void __exit
mpsc_drv_exit(void) mpsc_drv_exit(void)
{ {
driver_unregister(&mpsc_driver); platform_driver_unregister(&mpsc_driver);
driver_unregister(&mpsc_shared_driver); platform_driver_unregister(&mpsc_shared_driver);
uart_unregister_driver(&mpsc_reg); uart_unregister_driver(&mpsc_reg);
memset(mpsc_ports, 0, sizeof(mpsc_ports)); memset(mpsc_ports, 0, sizeof(mpsc_ports));
memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));

View File

@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = {
.cons = PXA_CONSOLE, .cons = PXA_CONSOLE,
}; };
static int serial_pxa_suspend(struct device *_dev, pm_message_t state) static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct uart_pxa_port *sport = dev_get_drvdata(_dev); struct uart_pxa_port *sport = platform_get_drvdata(dev);
if (sport) if (sport)
uart_suspend_port(&serial_pxa_reg, &sport->port); uart_suspend_port(&serial_pxa_reg, &sport->port);
@ -815,9 +815,9 @@ static int serial_pxa_suspend(struct device *_dev, pm_message_t state)
return 0; return 0;
} }
static int serial_pxa_resume(struct device *_dev) static int serial_pxa_resume(struct platform_device *dev)
{ {
struct uart_pxa_port *sport = dev_get_drvdata(_dev); struct uart_pxa_port *sport = platform_get_drvdata(dev);
if (sport) if (sport)
uart_resume_port(&serial_pxa_reg, &sport->port); uart_resume_port(&serial_pxa_reg, &sport->port);
@ -825,21 +825,19 @@ static int serial_pxa_resume(struct device *_dev)
return 0; return 0;
} }
static int serial_pxa_probe(struct device *_dev) static int serial_pxa_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev); serial_pxa_ports[dev->id].port.dev = &dev->dev;
serial_pxa_ports[dev->id].port.dev = _dev;
uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port);
dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); platform_set_drvdata(dev, &serial_pxa_ports[dev->id]);
return 0; return 0;
} }
static int serial_pxa_remove(struct device *_dev) static int serial_pxa_remove(struct platform_device *dev)
{ {
struct uart_pxa_port *sport = dev_get_drvdata(_dev); struct uart_pxa_port *sport = platform_get_drvdata(dev);
dev_set_drvdata(_dev, NULL); platform_set_drvdata(dev, NULL);
if (sport) if (sport)
uart_remove_one_port(&serial_pxa_reg, &sport->port); uart_remove_one_port(&serial_pxa_reg, &sport->port);
@ -847,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev)
return 0; return 0;
} }
static struct device_driver serial_pxa_driver = { static struct platform_driver serial_pxa_driver = {
.name = "pxa2xx-uart",
.bus = &platform_bus_type,
.probe = serial_pxa_probe, .probe = serial_pxa_probe,
.remove = serial_pxa_remove, .remove = serial_pxa_remove,
.suspend = serial_pxa_suspend, .suspend = serial_pxa_suspend,
.resume = serial_pxa_resume, .resume = serial_pxa_resume,
.driver = {
.name = "pxa2xx-uart",
},
}; };
int __init serial_pxa_init(void) int __init serial_pxa_init(void)
@ -865,7 +864,7 @@ int __init serial_pxa_init(void)
if (ret != 0) if (ret != 0)
return ret; return ret;
ret = driver_register(&serial_pxa_driver); ret = platform_driver_register(&serial_pxa_driver);
if (ret != 0) if (ret != 0)
uart_unregister_driver(&serial_pxa_reg); uart_unregister_driver(&serial_pxa_reg);
@ -874,7 +873,7 @@ int __init serial_pxa_init(void)
void __exit serial_pxa_exit(void) void __exit serial_pxa_exit(void)
{ {
driver_unregister(&serial_pxa_driver); platform_driver_unregister(&serial_pxa_driver);
uart_unregister_driver(&serial_pxa_reg); uart_unregister_driver(&serial_pxa_reg);
} }

View File

@ -1092,14 +1092,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
static int probe_index = 0; static int probe_index = 0;
static int s3c24xx_serial_probe(struct device *_dev, static int s3c24xx_serial_probe(struct platform_device *dev,
struct s3c24xx_uart_info *info) struct s3c24xx_uart_info *info)
{ {
struct s3c24xx_uart_port *ourport; struct s3c24xx_uart_port *ourport;
struct platform_device *dev = to_platform_device(_dev);
int ret; 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]; ourport = &s3c24xx_serial_ports[probe_index];
probe_index++; probe_index++;
@ -1112,7 +1111,7 @@ static int s3c24xx_serial_probe(struct device *_dev,
dbg("%s: adding port\n", __FUNCTION__); dbg("%s: adding port\n", __FUNCTION__);
uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
dev_set_drvdata(_dev, &ourport->port); platform_set_drvdata(dev, &ourport->port);
return 0; return 0;
@ -1120,9 +1119,9 @@ static int s3c24xx_serial_probe(struct device *_dev,
return ret; return ret;
} }
static int s3c24xx_serial_remove(struct device *_dev) static int s3c24xx_serial_remove(struct platform_device *dev)
{ {
struct uart_port *port = s3c24xx_dev_to_port(_dev); struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
if (port) if (port)
uart_remove_one_port(&s3c24xx_uart_drv, port); uart_remove_one_port(&s3c24xx_uart_drv, port);
@ -1134,9 +1133,9 @@ static int s3c24xx_serial_remove(struct device *_dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state) static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct uart_port *port = s3c24xx_dev_to_port(dev); struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
if (port) if (port)
uart_suspend_port(&s3c24xx_uart_drv, port); uart_suspend_port(&s3c24xx_uart_drv, port);
@ -1144,9 +1143,9 @@ static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int s3c24xx_serial_resume(struct device *dev) static int s3c24xx_serial_resume(struct platform_device *dev)
{ {
struct uart_port *port = s3c24xx_dev_to_port(dev); struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
struct s3c24xx_uart_port *ourport = to_ourport(port); struct s3c24xx_uart_port *ourport = to_ourport(port);
if (port) { if (port) {
@ -1165,11 +1164,11 @@ static int s3c24xx_serial_resume(struct device *dev)
#define s3c24xx_serial_resume NULL #define s3c24xx_serial_resume NULL
#endif #endif
static int s3c24xx_serial_init(struct device_driver *drv, static int s3c24xx_serial_init(struct platform_driver *drv,
struct s3c24xx_uart_info *info) struct s3c24xx_uart_info *info)
{ {
dbg("s3c24xx_serial_init(%p,%p)\n", drv, info); dbg("s3c24xx_serial_init(%p,%p)\n", drv, info);
return driver_register(drv); return platform_driver_register(drv);
} }
@ -1228,19 +1227,20 @@ static struct s3c24xx_uart_info s3c2400_uart_inf = {
.reset_port = s3c2400_serial_resetport, .reset_port = s3c2400_serial_resetport,
}; };
static int s3c2400_serial_probe(struct device *dev) static int s3c2400_serial_probe(struct platform_device *dev)
{ {
return s3c24xx_serial_probe(dev, &s3c2400_uart_inf); return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);
} }
static struct device_driver s3c2400_serial_drv = { static struct platform_driver s3c2400_serial_drv = {
.name = "s3c2400-uart",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = s3c2400_serial_probe, .probe = s3c2400_serial_probe,
.remove = s3c24xx_serial_remove, .remove = s3c24xx_serial_remove,
.suspend = s3c24xx_serial_suspend, .suspend = s3c24xx_serial_suspend,
.resume = s3c24xx_serial_resume, .resume = s3c24xx_serial_resume,
.driver = {
.name = "s3c2400-uart",
.owner = THIS_MODULE,
},
}; };
static inline int s3c2400_serial_init(void) 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) static inline void s3c2400_serial_exit(void)
{ {
driver_unregister(&s3c2400_serial_drv); platform_driver_unregister(&s3c2400_serial_drv);
} }
#define s3c2400_uart_inf_at &s3c2400_uart_inf #define s3c2400_uart_inf_at &s3c2400_uart_inf
@ -1332,19 +1332,20 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = {
/* device management */ /* device management */
static int s3c2410_serial_probe(struct device *dev) static int s3c2410_serial_probe(struct platform_device *dev)
{ {
return s3c24xx_serial_probe(dev, &s3c2410_uart_inf); return s3c24xx_serial_probe(dev, &s3c2410_uart_inf);
} }
static struct device_driver s3c2410_serial_drv = { static struct platform_driver s3c2410_serial_drv = {
.name = "s3c2410-uart",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = s3c2410_serial_probe, .probe = s3c2410_serial_probe,
.remove = s3c24xx_serial_remove, .remove = s3c24xx_serial_remove,
.suspend = s3c24xx_serial_suspend, .suspend = s3c24xx_serial_suspend,
.resume = s3c24xx_serial_resume, .resume = s3c24xx_serial_resume,
.driver = {
.name = "s3c2410-uart",
.owner = THIS_MODULE,
},
}; };
static inline int s3c2410_serial_init(void) static inline int s3c2410_serial_init(void)
@ -1354,7 +1355,7 @@ static inline int s3c2410_serial_init(void)
static inline void s3c2410_serial_exit(void) static inline void s3c2410_serial_exit(void)
{ {
driver_unregister(&s3c2410_serial_drv); platform_driver_unregister(&s3c2410_serial_drv);
} }
#define s3c2410_uart_inf_at &s3c2410_uart_inf #define s3c2410_uart_inf_at &s3c2410_uart_inf
@ -1493,20 +1494,21 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = {
/* device management */ /* device management */
static int s3c2440_serial_probe(struct device *dev) static int s3c2440_serial_probe(struct platform_device *dev)
{ {
dbg("s3c2440_serial_probe: dev=%p\n", dev); dbg("s3c2440_serial_probe: dev=%p\n", dev);
return s3c24xx_serial_probe(dev, &s3c2440_uart_inf); return s3c24xx_serial_probe(dev, &s3c2440_uart_inf);
} }
static struct device_driver s3c2440_serial_drv = { static struct platform_driver s3c2440_serial_drv = {
.name = "s3c2440-uart",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = s3c2440_serial_probe, .probe = s3c2440_serial_probe,
.remove = s3c24xx_serial_remove, .remove = s3c24xx_serial_remove,
.suspend = s3c24xx_serial_suspend, .suspend = s3c24xx_serial_suspend,
.resume = s3c24xx_serial_resume, .resume = s3c24xx_serial_resume,
.driver = {
.name = "s3c2440-uart",
.owner = THIS_MODULE,
},
}; };
@ -1517,7 +1519,7 @@ static inline int s3c2440_serial_init(void)
static inline void s3c2440_serial_exit(void) static inline void s3c2440_serial_exit(void)
{ {
driver_unregister(&s3c2440_serial_drv); platform_driver_unregister(&s3c2440_serial_drv);
} }
#define s3c2440_uart_inf_at &s3c2440_uart_inf #define s3c2440_uart_inf_at &s3c2440_uart_inf

View File

@ -834,9 +834,9 @@ static struct uart_driver sa1100_reg = {
.cons = SA1100_CONSOLE, .cons = SA1100_CONSOLE,
}; };
static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct sa1100_port *sport = dev_get_drvdata(_dev); struct sa1100_port *sport = platform_get_drvdata(dev);
if (sport) if (sport)
uart_suspend_port(&sa1100_reg, &sport->port); uart_suspend_port(&sa1100_reg, &sport->port);
@ -844,9 +844,9 @@ static int sa1100_serial_suspend(struct device *_dev, pm_message_t state)
return 0; return 0;
} }
static int sa1100_serial_resume(struct device *_dev) static int sa1100_serial_resume(struct platform_device *dev)
{ {
struct sa1100_port *sport = dev_get_drvdata(_dev); struct sa1100_port *sport = platform_get_drvdata(dev);
if (sport) if (sport)
uart_resume_port(&sa1100_reg, &sport->port); uart_resume_port(&sa1100_reg, &sport->port);
@ -854,9 +854,8 @@ static int sa1100_serial_resume(struct device *_dev)
return 0; return 0;
} }
static int sa1100_serial_probe(struct device *_dev) static int sa1100_serial_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(_dev);
struct resource *res = dev->resource; struct resource *res = dev->resource;
int i; int i;
@ -869,9 +868,9 @@ static int sa1100_serial_probe(struct device *_dev)
if (sa1100_ports[i].port.mapbase != res->start) if (sa1100_ports[i].port.mapbase != res->start)
continue; continue;
sa1100_ports[i].port.dev = _dev; sa1100_ports[i].port.dev = &dev->dev;
uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port);
dev_set_drvdata(_dev, &sa1100_ports[i]); platform_set_drvdata(dev, &sa1100_ports[i]);
break; break;
} }
} }
@ -879,11 +878,11 @@ static int sa1100_serial_probe(struct device *_dev)
return 0; return 0;
} }
static int sa1100_serial_remove(struct device *_dev) static int sa1100_serial_remove(struct platform_device *pdev)
{ {
struct sa1100_port *sport = dev_get_drvdata(_dev); struct sa1100_port *sport = platform_get_drvdata(pdev);
dev_set_drvdata(_dev, NULL); platform_set_drvdata(pdev, NULL);
if (sport) if (sport)
uart_remove_one_port(&sa1100_reg, &sport->port); uart_remove_one_port(&sa1100_reg, &sport->port);
@ -891,13 +890,14 @@ static int sa1100_serial_remove(struct device *_dev)
return 0; return 0;
} }
static struct device_driver sa11x0_serial_driver = { static struct platform_driver sa11x0_serial_driver = {
.name = "sa11x0-uart",
.bus = &platform_bus_type,
.probe = sa1100_serial_probe, .probe = sa1100_serial_probe,
.remove = sa1100_serial_remove, .remove = sa1100_serial_remove,
.suspend = sa1100_serial_suspend, .suspend = sa1100_serial_suspend,
.resume = sa1100_serial_resume, .resume = sa1100_serial_resume,
.driver = {
.name = "sa11x0-uart",
},
}; };
static int __init sa1100_serial_init(void) static int __init sa1100_serial_init(void)
@ -910,7 +910,7 @@ static int __init sa1100_serial_init(void)
ret = uart_register_driver(&sa1100_reg); ret = uart_register_driver(&sa1100_reg);
if (ret == 0) { if (ret == 0) {
ret = driver_register(&sa11x0_serial_driver); ret = platform_driver_register(&sa11x0_serial_driver);
if (ret) if (ret)
uart_unregister_driver(&sa1100_reg); uart_unregister_driver(&sa1100_reg);
} }
@ -919,7 +919,7 @@ static int __init sa1100_serial_init(void)
static void __exit sa1100_serial_exit(void) static void __exit sa1100_serial_exit(void)
{ {
driver_unregister(&sa11x0_serial_driver); platform_driver_unregister(&sa11x0_serial_driver);
uart_unregister_driver(&sa1100_reg); uart_unregister_driver(&sa1100_reg);
} }

View File

@ -924,7 +924,7 @@ static struct uart_driver siu_uart_driver = {
.cons = SERIAL_VR41XX_CONSOLE, .cons = SERIAL_VR41XX_CONSOLE,
}; };
static int siu_probe(struct device *dev) static int siu_probe(struct platform_device *dev)
{ {
struct uart_port *port; struct uart_port *port;
int num, i, retval; int num, i, retval;
@ -941,7 +941,7 @@ static int siu_probe(struct device *dev)
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
port = &siu_uart_ports[i]; port = &siu_uart_ports[i];
port->ops = &siu_uart_ops; port->ops = &siu_uart_ops;
port->dev = dev; port->dev = &dev->dev;
retval = uart_add_one_port(&siu_uart_driver, port); retval = uart_add_one_port(&siu_uart_driver, port);
if (retval < 0) { if (retval < 0) {
@ -958,14 +958,14 @@ static int siu_probe(struct device *dev)
return 0; return 0;
} }
static int siu_remove(struct device *dev) static int siu_remove(struct platform_device *dev)
{ {
struct uart_port *port; struct uart_port *port;
int i; int i;
for (i = 0; i < siu_uart_driver.nr; i++) { for (i = 0; i < siu_uart_driver.nr; i++) {
port = &siu_uart_ports[i]; port = &siu_uart_ports[i];
if (port->dev == dev) { if (port->dev == &dev->dev) {
uart_remove_one_port(&siu_uart_driver, port); uart_remove_one_port(&siu_uart_driver, port);
port->dev = NULL; port->dev = NULL;
} }
@ -976,7 +976,7 @@ static int siu_remove(struct device *dev)
return 0; return 0;
} }
static int siu_suspend(struct device *dev, pm_message_t state) static int siu_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct uart_port *port; struct uart_port *port;
int i; int i;
@ -984,7 +984,7 @@ static int siu_suspend(struct device *dev, pm_message_t state)
for (i = 0; i < siu_uart_driver.nr; i++) { for (i = 0; i < siu_uart_driver.nr; i++) {
port = &siu_uart_ports[i]; port = &siu_uart_ports[i];
if ((port->type == PORT_VR41XX_SIU || if ((port->type == PORT_VR41XX_SIU ||
port->type == PORT_VR41XX_DSIU) && port->dev == dev) port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
uart_suspend_port(&siu_uart_driver, port); uart_suspend_port(&siu_uart_driver, port);
} }
@ -992,7 +992,7 @@ static int siu_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int siu_resume(struct device *dev) static int siu_resume(struct platform_device *dev)
{ {
struct uart_port *port; struct uart_port *port;
int i; int i;
@ -1000,7 +1000,7 @@ static int siu_resume(struct device *dev)
for (i = 0; i < siu_uart_driver.nr; i++) { for (i = 0; i < siu_uart_driver.nr; i++) {
port = &siu_uart_ports[i]; port = &siu_uart_ports[i];
if ((port->type == PORT_VR41XX_SIU || if ((port->type == PORT_VR41XX_SIU ||
port->type == PORT_VR41XX_DSIU) && port->dev == dev) port->type == PORT_VR41XX_DSIU) && port->dev == &dev->dev)
uart_resume_port(&siu_uart_driver, port); uart_resume_port(&siu_uart_driver, port);
} }
@ -1009,13 +1009,14 @@ static int siu_resume(struct device *dev)
static struct platform_device *siu_platform_device; static struct platform_device *siu_platform_device;
static struct device_driver siu_device_driver = { static struct platform_driver siu_device_driver = {
.name = "SIU",
.bus = &platform_bus_type,
.probe = siu_probe, .probe = siu_probe,
.remove = siu_remove, .remove = siu_remove,
.suspend = siu_suspend, .suspend = siu_suspend,
.resume = siu_resume, .resume = siu_resume,
.driver = {
.name = "SIU",
},
}; };
static int __devinit vr41xx_siu_init(void) static int __devinit vr41xx_siu_init(void)
@ -1026,7 +1027,7 @@ static int __devinit vr41xx_siu_init(void)
if (IS_ERR(siu_platform_device)) if (IS_ERR(siu_platform_device))
return PTR_ERR(siu_platform_device); return PTR_ERR(siu_platform_device);
retval = driver_register(&siu_device_driver); retval = platform_driver_register(&siu_device_driver);
if (retval < 0) if (retval < 0)
platform_device_unregister(siu_platform_device); platform_device_unregister(siu_platform_device);
@ -1035,7 +1036,7 @@ static int __devinit vr41xx_siu_init(void)
static void __devexit vr41xx_siu_exit(void) static void __devexit vr41xx_siu_exit(void)
{ {
driver_unregister(&siu_device_driver); platform_driver_unregister(&siu_device_driver);
platform_device_unregister(siu_platform_device); platform_device_unregister(siu_platform_device);
} }

View File

@ -897,7 +897,7 @@ dummy_gadget_release (struct device *dev)
#endif #endif
} }
static int dummy_udc_probe (struct device *dev) static int dummy_udc_probe (struct platform_device *dev)
{ {
struct dummy *dum = the_controller; struct dummy *dum = the_controller;
int rc; int rc;
@ -910,7 +910,7 @@ static int dummy_udc_probe (struct device *dev)
dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0);
strcpy (dum->gadget.dev.bus_id, "gadget"); strcpy (dum->gadget.dev.bus_id, "gadget");
dum->gadget.dev.parent = dev; dum->gadget.dev.parent = &dev->dev;
dum->gadget.dev.release = dummy_gadget_release; dum->gadget.dev.release = dummy_gadget_release;
rc = device_register (&dum->gadget.dev); rc = device_register (&dum->gadget.dev);
if (rc < 0) if (rc < 0)
@ -920,26 +920,26 @@ static int dummy_udc_probe (struct device *dev)
usb_bus_get (&dummy_to_hcd (dum)->self); usb_bus_get (&dummy_to_hcd (dum)->self);
#endif #endif
dev_set_drvdata (dev, dum); platform_set_drvdata (dev, dum);
device_create_file (&dum->gadget.dev, &dev_attr_function); device_create_file (&dum->gadget.dev, &dev_attr_function);
return rc; return rc;
} }
static int dummy_udc_remove (struct device *dev) static int dummy_udc_remove (struct platform_device *dev)
{ {
struct dummy *dum = dev_get_drvdata (dev); struct dummy *dum = platform_get_drvdata (dev);
dev_set_drvdata (dev, NULL); platform_set_drvdata (dev, NULL);
device_remove_file (&dum->gadget.dev, &dev_attr_function); device_remove_file (&dum->gadget.dev, &dev_attr_function);
device_unregister (&dum->gadget.dev); device_unregister (&dum->gadget.dev);
return 0; return 0;
} }
static int dummy_udc_suspend (struct device *dev, pm_message_t state) static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state)
{ {
struct dummy *dum = dev_get_drvdata(dev); struct dummy *dum = platform_get_drvdata(dev);
dev_dbg (dev, "%s\n", __FUNCTION__); dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
spin_lock_irq (&dum->lock); spin_lock_irq (&dum->lock);
dum->udc_suspended = 1; dum->udc_suspended = 1;
set_link_state (dum); set_link_state (dum);
@ -950,29 +950,30 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int dummy_udc_resume (struct device *dev) static int dummy_udc_resume (struct platform_device *dev)
{ {
struct dummy *dum = dev_get_drvdata(dev); struct dummy *dum = platform_get_drvdata(dev);
dev_dbg (dev, "%s\n", __FUNCTION__); dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
spin_lock_irq (&dum->lock); spin_lock_irq (&dum->lock);
dum->udc_suspended = 0; dum->udc_suspended = 0;
set_link_state (dum); set_link_state (dum);
spin_unlock_irq (&dum->lock); spin_unlock_irq (&dum->lock);
dev->power.power_state = PMSG_ON; dev->dev.power.power_state = PMSG_ON;
usb_hcd_poll_rh_status (dummy_to_hcd (dum)); usb_hcd_poll_rh_status (dummy_to_hcd (dum));
return 0; return 0;
} }
static struct device_driver dummy_udc_driver = { static struct platform_driver dummy_udc_driver = {
.name = (char *) gadget_name,
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = dummy_udc_probe, .probe = dummy_udc_probe,
.remove = dummy_udc_remove, .remove = dummy_udc_remove,
.suspend = dummy_udc_suspend, .suspend = dummy_udc_suspend,
.resume = dummy_udc_resume, .resume = dummy_udc_resume,
.driver = {
.name = (char *) gadget_name,
.owner = THIS_MODULE,
},
}; };
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -1899,14 +1900,14 @@ static const struct hc_driver dummy_hcd = {
.bus_resume = dummy_bus_resume, .bus_resume = dummy_bus_resume,
}; };
static int dummy_hcd_probe (struct device *dev) static int dummy_hcd_probe (struct platform_device *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
int retval; int retval;
dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc);
hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id); hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id);
if (!hcd) if (!hcd)
return -ENOMEM; return -ENOMEM;
the_controller = hcd_to_dummy (hcd); the_controller = hcd_to_dummy (hcd);
@ -1919,48 +1920,49 @@ static int dummy_hcd_probe (struct device *dev)
return retval; return retval;
} }
static int dummy_hcd_remove (struct device *dev) static int dummy_hcd_remove (struct platform_device *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
hcd = dev_get_drvdata (dev); hcd = platform_get_drvdata (dev);
usb_remove_hcd (hcd); usb_remove_hcd (hcd);
usb_put_hcd (hcd); usb_put_hcd (hcd);
the_controller = NULL; the_controller = NULL;
return 0; return 0;
} }
static int dummy_hcd_suspend (struct device *dev, pm_message_t state) static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
dev_dbg (dev, "%s\n", __FUNCTION__); dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
hcd = dev_get_drvdata (dev); hcd = platform_get_drvdata (dev);
hcd->state = HC_STATE_SUSPENDED; hcd->state = HC_STATE_SUSPENDED;
return 0; return 0;
} }
static int dummy_hcd_resume (struct device *dev) static int dummy_hcd_resume (struct platform_device *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
dev_dbg (dev, "%s\n", __FUNCTION__); dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
hcd = dev_get_drvdata (dev); hcd = platform_get_drvdata (dev);
hcd->state = HC_STATE_RUNNING; hcd->state = HC_STATE_RUNNING;
usb_hcd_poll_rh_status (hcd); usb_hcd_poll_rh_status (hcd);
return 0; return 0;
} }
static struct device_driver dummy_hcd_driver = { static struct platform_driver dummy_hcd_driver = {
.name = (char *) driver_name,
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = dummy_hcd_probe, .probe = dummy_hcd_probe,
.remove = dummy_hcd_remove, .remove = dummy_hcd_remove,
.suspend = dummy_hcd_suspend, .suspend = dummy_hcd_suspend,
.resume = dummy_hcd_resume, .resume = dummy_hcd_resume,
.driver = {
.name = (char *) driver_name,
.owner = THIS_MODULE,
},
}; };
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -1996,11 +1998,11 @@ static int __init init (void)
if (usb_disabled ()) if (usb_disabled ())
return -ENODEV; return -ENODEV;
retval = driver_register (&dummy_hcd_driver); retval = platform_driver_register (&dummy_hcd_driver);
if (retval < 0) if (retval < 0)
return retval; return retval;
retval = driver_register (&dummy_udc_driver); retval = platform_driver_register (&dummy_udc_driver);
if (retval < 0) if (retval < 0)
goto err_register_udc_driver; goto err_register_udc_driver;
@ -2016,9 +2018,9 @@ static int __init init (void)
err_register_udc: err_register_udc:
platform_device_unregister (&the_hcd_pdev); platform_device_unregister (&the_hcd_pdev);
err_register_hcd: err_register_hcd:
driver_unregister (&dummy_udc_driver); platform_driver_unregister (&dummy_udc_driver);
err_register_udc_driver: err_register_udc_driver:
driver_unregister (&dummy_hcd_driver); platform_driver_unregister (&dummy_hcd_driver);
return retval; return retval;
} }
module_init (init); module_init (init);
@ -2027,7 +2029,7 @@ static void __exit cleanup (void)
{ {
platform_device_unregister (&the_udc_pdev); platform_device_unregister (&the_udc_pdev);
platform_device_unregister (&the_hcd_pdev); platform_device_unregister (&the_hcd_pdev);
driver_unregister (&dummy_udc_driver); platform_driver_unregister (&dummy_udc_driver);
driver_unregister (&dummy_hcd_driver); platform_driver_unregister (&dummy_hcd_driver);
} }
module_exit (cleanup); module_exit (cleanup);

View File

@ -2085,21 +2085,21 @@ static struct lh7a40x_udc memory = {
/* /*
* probe - binds to the platform device * probe - binds to the platform device
*/ */
static int lh7a40x_udc_probe(struct device *_dev) static int lh7a40x_udc_probe(struct platform_device *pdev)
{ {
struct lh7a40x_udc *dev = &memory; struct lh7a40x_udc *dev = &memory;
int retval; int retval;
DEBUG("%s: %p\n", __FUNCTION__, _dev); DEBUG("%s: %p\n", __FUNCTION__, pdev);
spin_lock_init(&dev->lock); spin_lock_init(&dev->lock);
dev->dev = _dev; dev->dev = &pdev->dev;
device_initialize(&dev->gadget.dev); device_initialize(&dev->gadget.dev);
dev->gadget.dev.parent = _dev; dev->gadget.dev.parent = &pdev->dev;
the_controller = dev; the_controller = dev;
dev_set_drvdata(_dev, dev); platform_set_drvdata(pdev, dev);
udc_disable(dev); udc_disable(dev);
udc_reinit(dev); udc_reinit(dev);
@ -2119,11 +2119,11 @@ static int lh7a40x_udc_probe(struct device *_dev)
return retval; return retval;
} }
static int lh7a40x_udc_remove(struct device *_dev) static int lh7a40x_udc_remove(struct platform_device *pdev)
{ {
struct lh7a40x_udc *dev = _dev->driver_data; struct lh7a40x_udc *dev = platform_get_drvdata(pdev);
DEBUG("%s: %p\n", __FUNCTION__, dev); DEBUG("%s: %p\n", __FUNCTION__, pdev);
udc_disable(dev); udc_disable(dev);
remove_proc_files(); remove_proc_files();
@ -2131,7 +2131,7 @@ static int lh7a40x_udc_remove(struct device *_dev)
free_irq(IRQ_USBINTR, dev); free_irq(IRQ_USBINTR, dev);
dev_set_drvdata(_dev, 0); platform_set_drvdata(pdev, 0);
the_controller = 0; the_controller = 0;
@ -2140,26 +2140,27 @@ static int lh7a40x_udc_remove(struct device *_dev)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static struct device_driver udc_driver = { static struct platform_driver udc_driver = {
.name = (char *)driver_name,
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = lh7a40x_udc_probe, .probe = lh7a40x_udc_probe,
.remove = lh7a40x_udc_remove .remove = lh7a40x_udc_remove
/* FIXME power management support */ /* FIXME power management support */
/* .suspend = ... disable UDC */ /* .suspend = ... disable UDC */
/* .resume = ... re-enable UDC */ /* .resume = ... re-enable UDC */
.driver = {
.name = (char *)driver_name,
.owner = THIS_MODULE,
},
}; };
static int __init udc_init(void) static int __init udc_init(void)
{ {
DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION);
return driver_register(&udc_driver); return platform_driver_register(&udc_driver);
} }
static void __exit udc_exit(void) static void __exit udc_exit(void)
{ {
driver_unregister(&udc_driver); platform_driver_unregister(&udc_driver);
} }
module_init(udc_init); module_init(udc_init);

View File

@ -2707,18 +2707,17 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
return 0; return 0;
} }
static int __init omap_udc_probe(struct device *dev) static int __init omap_udc_probe(struct platform_device *pdev)
{ {
struct platform_device *odev = to_platform_device(dev);
int status = -ENODEV; int status = -ENODEV;
int hmc; int hmc;
struct otg_transceiver *xceiv = NULL; struct otg_transceiver *xceiv = NULL;
const char *type = NULL; const char *type = NULL;
struct omap_usb_config *config = dev->platform_data; struct omap_usb_config *config = pdev->dev.platform_data;
/* NOTE: "knows" the order of the resources! */ /* NOTE: "knows" the order of the resources! */
if (!request_mem_region(odev->resource[0].start, if (!request_mem_region(pdev->resource[0].start,
odev->resource[0].end - odev->resource[0].start + 1, pdev->resource[0].end - pdev->resource[0].start + 1,
driver_name)) { driver_name)) {
DBG("request_mem_region failed\n"); DBG("request_mem_region failed\n");
return -EBUSY; return -EBUSY;
@ -2803,7 +2802,7 @@ bad_on_1710:
INFO("hmc mode %d, %s transceiver\n", hmc, type); INFO("hmc mode %d, %s transceiver\n", hmc, type);
/* a "gadget" abstracts/virtualizes the controller */ /* a "gadget" abstracts/virtualizes the controller */
status = omap_udc_setup(odev, xceiv); status = omap_udc_setup(pdev, xceiv);
if (status) { if (status) {
goto cleanup0; goto cleanup0;
} }
@ -2821,28 +2820,28 @@ bad_on_1710:
udc->clr_halt = UDC_RESET_EP; udc->clr_halt = UDC_RESET_EP;
/* USB general purpose IRQ: ep0, state changes, dma, etc */ /* USB general purpose IRQ: ep0, state changes, dma, etc */
status = request_irq(odev->resource[1].start, omap_udc_irq, status = request_irq(pdev->resource[1].start, omap_udc_irq,
SA_SAMPLE_RANDOM, driver_name, udc); SA_SAMPLE_RANDOM, driver_name, udc);
if (status != 0) { if (status != 0) {
ERR( "can't get irq %ld, err %d\n", ERR( "can't get irq %ld, err %d\n",
odev->resource[1].start, status); pdev->resource[1].start, status);
goto cleanup1; goto cleanup1;
} }
/* USB "non-iso" IRQ (PIO for all but ep0) */ /* USB "non-iso" IRQ (PIO for all but ep0) */
status = request_irq(odev->resource[2].start, omap_udc_pio_irq, status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
SA_SAMPLE_RANDOM, "omap_udc pio", udc); SA_SAMPLE_RANDOM, "omap_udc pio", udc);
if (status != 0) { if (status != 0) {
ERR( "can't get irq %ld, err %d\n", ERR( "can't get irq %ld, err %d\n",
odev->resource[2].start, status); pdev->resource[2].start, status);
goto cleanup2; goto cleanup2;
} }
#ifdef USE_ISO #ifdef USE_ISO
status = request_irq(odev->resource[3].start, omap_udc_iso_irq, status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
SA_INTERRUPT, "omap_udc iso", udc); SA_INTERRUPT, "omap_udc iso", udc);
if (status != 0) { if (status != 0) {
ERR("can't get irq %ld, err %d\n", ERR("can't get irq %ld, err %d\n",
odev->resource[3].start, status); pdev->resource[3].start, status);
goto cleanup3; goto cleanup3;
} }
#endif #endif
@ -2853,11 +2852,11 @@ bad_on_1710:
#ifdef USE_ISO #ifdef USE_ISO
cleanup3: cleanup3:
free_irq(odev->resource[2].start, udc); free_irq(pdev->resource[2].start, udc);
#endif #endif
cleanup2: cleanup2:
free_irq(odev->resource[1].start, udc); free_irq(pdev->resource[1].start, udc);
cleanup1: cleanup1:
kfree (udc); kfree (udc);
@ -2866,14 +2865,13 @@ cleanup1:
cleanup0: cleanup0:
if (xceiv) if (xceiv)
put_device(xceiv->dev); put_device(xceiv->dev);
release_mem_region(odev->resource[0].start, release_mem_region(pdev->resource[0].start,
odev->resource[0].end - odev->resource[0].start + 1); pdev->resource[0].end - pdev->resource[0].start + 1);
return status; return status;
} }
static int __exit omap_udc_remove(struct device *dev) static int __exit omap_udc_remove(struct platform_device *pdev)
{ {
struct platform_device *odev = to_platform_device(dev);
DECLARE_COMPLETION(done); DECLARE_COMPLETION(done);
if (!udc) if (!udc)
@ -2891,13 +2889,13 @@ static int __exit omap_udc_remove(struct device *dev)
remove_proc_file(); remove_proc_file();
#ifdef USE_ISO #ifdef USE_ISO
free_irq(odev->resource[3].start, udc); free_irq(pdev->resource[3].start, udc);
#endif #endif
free_irq(odev->resource[2].start, udc); free_irq(pdev->resource[2].start, udc);
free_irq(odev->resource[1].start, udc); free_irq(pdev->resource[1].start, udc);
release_mem_region(odev->resource[0].start, release_mem_region(pdev->resource[0].start,
odev->resource[0].end - odev->resource[0].start + 1); pdev->resource[0].end - pdev->resource[0].start + 1);
device_unregister(&udc->gadget.dev); device_unregister(&udc->gadget.dev);
wait_for_completion(&done); wait_for_completion(&done);
@ -2915,7 +2913,7 @@ static int __exit omap_udc_remove(struct device *dev)
* may involve talking to an external transceiver (e.g. isp1301). * may involve talking to an external transceiver (e.g. isp1301).
*/ */
static int omap_udc_suspend(struct device *dev, pm_message_t message) static int omap_udc_suspend(struct platform_device *dev, pm_message_t message)
{ {
u32 devstat; u32 devstat;
@ -2935,7 +2933,7 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message)
return 0; return 0;
} }
static int omap_udc_resume(struct device *dev) static int omap_udc_resume(struct platform_device *dev)
{ {
DBG("resume + wakeup/SRP\n"); DBG("resume + wakeup/SRP\n");
omap_pullup(&udc->gadget, 1); omap_pullup(&udc->gadget, 1);
@ -2947,14 +2945,15 @@ static int omap_udc_resume(struct device *dev)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static struct device_driver udc_driver = { static struct platform_driver udc_driver = {
.name = (char *) driver_name,
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = omap_udc_probe, .probe = omap_udc_probe,
.remove = __exit_p(omap_udc_remove), .remove = __exit_p(omap_udc_remove),
.suspend = omap_udc_suspend, .suspend = omap_udc_suspend,
.resume = omap_udc_resume, .resume = omap_udc_resume,
.driver = {
.owner = THIS_MODULE,
.name = (char *) driver_name,
},
}; };
static int __init udc_init(void) static int __init udc_init(void)
@ -2965,13 +2964,13 @@ static int __init udc_init(void)
#endif #endif
"%s\n", driver_desc, "%s\n", driver_desc,
use_dma ? " (dma)" : ""); use_dma ? " (dma)" : "");
return driver_register(&udc_driver); return platform_driver_register(&udc_driver);
} }
module_init(udc_init); module_init(udc_init);
static void __exit udc_exit(void) static void __exit udc_exit(void)
{ {
driver_unregister(&udc_driver); platform_driver_unregister(&udc_driver);
} }
module_exit(udc_exit); module_exit(udc_exit);

View File

@ -2433,7 +2433,7 @@ static struct pxa2xx_udc memory = {
/* /*
* probe - binds to the platform device * probe - binds to the platform device
*/ */
static int __init pxa2xx_udc_probe(struct device *_dev) static int __init pxa2xx_udc_probe(struct platform_device *pdev)
{ {
struct pxa2xx_udc *dev = &memory; struct pxa2xx_udc *dev = &memory;
int retval, out_dma = 1; int retval, out_dma = 1;
@ -2496,19 +2496,19 @@ static int __init pxa2xx_udc_probe(struct device *_dev)
#endif #endif
/* other non-static parts of init */ /* other non-static parts of init */
dev->dev = _dev; dev->dev = &pdev->dev;
dev->mach = _dev->platform_data; dev->mach = pdev->dev.platform_data;
init_timer(&dev->timer); init_timer(&dev->timer);
dev->timer.function = udc_watchdog; dev->timer.function = udc_watchdog;
dev->timer.data = (unsigned long) dev; dev->timer.data = (unsigned long) dev;
device_initialize(&dev->gadget.dev); device_initialize(&dev->gadget.dev);
dev->gadget.dev.parent = _dev; dev->gadget.dev.parent = &pdev->dev;
dev->gadget.dev.dma_mask = _dev->dma_mask; dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
the_controller = dev; the_controller = dev;
dev_set_drvdata(_dev, dev); platform_set_drvdata(pdev, dev);
udc_disable(dev); udc_disable(dev);
udc_reinit(dev); udc_reinit(dev);
@ -2560,14 +2560,14 @@ lubbock_fail0:
return 0; return 0;
} }
static void pxa2xx_udc_shutdown(struct device *_dev) static void pxa2xx_udc_shutdown(struct platform_device *_dev)
{ {
pullup_off(); pullup_off();
} }
static int __exit pxa2xx_udc_remove(struct device *_dev) static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
{ {
struct pxa2xx_udc *dev = dev_get_drvdata(_dev); struct pxa2xx_udc *dev = platform_get_drvdata(pdev);
udc_disable(dev); udc_disable(dev);
remove_proc_files(); remove_proc_files();
@ -2581,7 +2581,7 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
free_irq(LUBBOCK_USB_DISC_IRQ, dev); free_irq(LUBBOCK_USB_DISC_IRQ, dev);
free_irq(LUBBOCK_USB_IRQ, dev); free_irq(LUBBOCK_USB_IRQ, dev);
} }
dev_set_drvdata(_dev, NULL); platform_set_drvdata(pdev, NULL);
the_controller = NULL; the_controller = NULL;
return 0; return 0;
} }
@ -2602,9 +2602,9 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
* VBUS IRQs should probably be ignored so that the PXA device just acts * VBUS IRQs should probably be ignored so that the PXA device just acts
* "dead" to USB hosts until system resume. * "dead" to USB hosts until system resume.
*/ */
static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct pxa2xx_udc *udc = dev_get_drvdata(dev); struct pxa2xx_udc *udc = platform_get_drvdata(dev);
if (!udc->mach->udc_command) if (!udc->mach->udc_command)
WARN("USB host won't detect disconnect!\n"); WARN("USB host won't detect disconnect!\n");
@ -2613,9 +2613,9 @@ static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int pxa2xx_udc_resume(struct device *dev) static int pxa2xx_udc_resume(struct platform_device *dev)
{ {
struct pxa2xx_udc *udc = dev_get_drvdata(dev); struct pxa2xx_udc *udc = platform_get_drvdata(dev);
pullup(udc, 1); pullup(udc, 1);
@ -2629,27 +2629,28 @@ static int pxa2xx_udc_resume(struct device *dev)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static struct device_driver udc_driver = { static struct platform_driver udc_driver = {
.name = "pxa2xx-udc",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = pxa2xx_udc_probe, .probe = pxa2xx_udc_probe,
.shutdown = pxa2xx_udc_shutdown, .shutdown = pxa2xx_udc_shutdown,
.remove = __exit_p(pxa2xx_udc_remove), .remove = __exit_p(pxa2xx_udc_remove),
.suspend = pxa2xx_udc_suspend, .suspend = pxa2xx_udc_suspend,
.resume = pxa2xx_udc_resume, .resume = pxa2xx_udc_resume,
.driver = {
.owner = THIS_MODULE,
.name = "pxa2xx-udc",
},
}; };
static int __init udc_init(void) static int __init udc_init(void)
{ {
printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);
return driver_register(&udc_driver); return platform_driver_register(&udc_driver);
} }
module_init(udc_init); module_init(udc_init);
static void __exit udc_exit(void) static void __exit udc_exit(void)
{ {
driver_unregister(&udc_driver); platform_driver_unregister(&udc_driver);
} }
module_exit(udc_exit); module_exit(udc_exit);

View File

@ -1633,17 +1633,15 @@ static struct hc_driver isp116x_hc_driver = {
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
static int __init_or_module isp116x_remove(struct device *dev) static int __init_or_module isp116x_remove(struct platform_device *pdev)
{ {
struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct isp116x *isp116x; struct isp116x *isp116x;
struct platform_device *pdev;
struct resource *res; struct resource *res;
if (!hcd) if (!hcd)
return 0; return 0;
isp116x = hcd_to_isp116x(hcd); isp116x = hcd_to_isp116x(hcd);
pdev = container_of(dev, struct platform_device, dev);
remove_debug_file(isp116x); remove_debug_file(isp116x);
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
@ -1660,18 +1658,16 @@ static int __init_or_module isp116x_remove(struct device *dev)
#define resource_len(r) (((r)->end - (r)->start) + 1) #define resource_len(r) (((r)->end - (r)->start) + 1)
static int __init isp116x_probe(struct device *dev) static int __init isp116x_probe(struct platform_device *pdev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
struct isp116x *isp116x; struct isp116x *isp116x;
struct platform_device *pdev;
struct resource *addr, *data; struct resource *addr, *data;
void __iomem *addr_reg; void __iomem *addr_reg;
void __iomem *data_reg; void __iomem *data_reg;
int irq; int irq;
int ret = 0; int ret = 0;
pdev = container_of(dev, struct platform_device, dev);
if (pdev->num_resources < 3) { if (pdev->num_resources < 3) {
ret = -ENODEV; ret = -ENODEV;
goto err1; goto err1;
@ -1685,7 +1681,7 @@ static int __init isp116x_probe(struct device *dev)
goto err1; goto err1;
} }
if (dev->dma_mask) { if (pdev->dev.dma_mask) {
DBG("DMA not supported\n"); DBG("DMA not supported\n");
ret = -EINVAL; ret = -EINVAL;
goto err1; goto err1;
@ -1711,7 +1707,7 @@ static int __init isp116x_probe(struct device *dev)
} }
/* allocate and initialize hcd */ /* allocate and initialize hcd */
hcd = usb_create_hcd(&isp116x_hc_driver, dev, dev->bus_id); hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, pdev->dev.bus_id);
if (!hcd) { if (!hcd) {
ret = -ENOMEM; ret = -ENOMEM;
goto err5; goto err5;
@ -1723,7 +1719,7 @@ static int __init isp116x_probe(struct device *dev)
isp116x->addr_reg = addr_reg; isp116x->addr_reg = addr_reg;
spin_lock_init(&isp116x->lock); spin_lock_init(&isp116x->lock);
INIT_LIST_HEAD(&isp116x->async); INIT_LIST_HEAD(&isp116x->async);
isp116x->board = dev->platform_data; isp116x->board = pdev->dev.platform_data;
if (!isp116x->board) { if (!isp116x->board) {
ERR("Platform data structure not initialized\n"); ERR("Platform data structure not initialized\n");
@ -1764,13 +1760,13 @@ static int __init isp116x_probe(struct device *dev)
/* /*
Suspend of platform device Suspend of platform device
*/ */
static int isp116x_suspend(struct device *dev, pm_message_t state) static int isp116x_suspend(struct platform_device *dev, pm_message_t state)
{ {
int ret = 0; int ret = 0;
VDBG("%s: state %x\n", __func__, state); VDBG("%s: state %x\n", __func__, state);
dev->power.power_state = state; dev->dev.power.power_state = state;
return ret; return ret;
} }
@ -1778,13 +1774,13 @@ static int isp116x_suspend(struct device *dev, pm_message_t state)
/* /*
Resume platform device Resume platform device
*/ */
static int isp116x_resume(struct device *dev) static int isp116x_resume(struct platform_device *dev)
{ {
int ret = 0; int ret = 0;
VDBG("%s: state %x\n", __func__, dev->power.power_state); VDBG("%s: state %x\n", __func__, dev->dev.power.power_state);
dev->power.power_state = PMSG_ON; dev->dev.power.power_state = PMSG_ON;
return ret; return ret;
} }
@ -1796,13 +1792,14 @@ static int isp116x_resume(struct device *dev)
#endif #endif
static struct device_driver isp116x_driver = { static struct platform_driver isp116x_driver = {
.name = (char *)hcd_name,
.bus = &platform_bus_type,
.probe = isp116x_probe, .probe = isp116x_probe,
.remove = isp116x_remove, .remove = isp116x_remove,
.suspend = isp116x_suspend, .suspend = isp116x_suspend,
.resume = isp116x_resume, .resume = isp116x_resume,
.driver = {
.name = (char *)hcd_name,
},
}; };
/*-----------------------------------------------------------------*/ /*-----------------------------------------------------------------*/
@ -1813,14 +1810,14 @@ static int __init isp116x_init(void)
return -ENODEV; return -ENODEV;
INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
return driver_register(&isp116x_driver); return platform_driver_register(&isp116x_driver);
} }
module_init(isp116x_init); module_init(isp116x_init);
static void __exit isp116x_cleanup(void) static void __exit isp116x_cleanup(void)
{ {
driver_unregister(&isp116x_driver); platform_driver_unregister(&isp116x_driver);
} }
module_exit(isp116x_cleanup); module_exit(isp116x_cleanup);

View File

@ -225,9 +225,8 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int ohci_hcd_au1xxx_drv_probe(struct device *dev) static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
int ret; int ret;
pr_debug ("In ohci_hcd_au1xxx_drv_probe"); pr_debug ("In ohci_hcd_au1xxx_drv_probe");
@ -239,39 +238,37 @@ static int ohci_hcd_au1xxx_drv_probe(struct device *dev)
return ret; return ret;
} }
static int ohci_hcd_au1xxx_drv_remove(struct device *dev) static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
usb_hcd_au1xxx_remove(hcd, pdev); usb_hcd_au1xxx_remove(hcd, pdev);
return 0; return 0;
} }
/*TBD*/ /*TBD*/
/*static int ohci_hcd_au1xxx_drv_suspend(struct device *dev) /*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
return 0; return 0;
} }
static int ohci_hcd_au1xxx_drv_resume(struct device *dev) static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
return 0; return 0;
} }
*/ */
static struct device_driver ohci_hcd_au1xxx_driver = { static struct platform_driver ohci_hcd_au1xxx_driver = {
.name = "au1xxx-ohci",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = ohci_hcd_au1xxx_drv_probe, .probe = ohci_hcd_au1xxx_drv_probe,
.remove = ohci_hcd_au1xxx_drv_remove, .remove = ohci_hcd_au1xxx_drv_remove,
/*.suspend = ohci_hcd_au1xxx_drv_suspend, */ /*.suspend = ohci_hcd_au1xxx_drv_suspend, */
/*.resume = ohci_hcd_au1xxx_drv_resume, */ /*.resume = ohci_hcd_au1xxx_drv_resume, */
.driver = {
.name = "au1xxx-ohci",
.owner = THIS_MODULE,
},
}; };
static int __init ohci_hcd_au1xxx_init (void) static int __init ohci_hcd_au1xxx_init (void)
@ -280,12 +277,12 @@ static int __init ohci_hcd_au1xxx_init (void)
pr_debug ("block sizes: ed %d td %d\n", pr_debug ("block sizes: ed %d td %d\n",
sizeof (struct ed), sizeof (struct td)); sizeof (struct ed), sizeof (struct td));
return driver_register(&ohci_hcd_au1xxx_driver); return platform_driver_register(&ohci_hcd_au1xxx_driver);
} }
static void __exit ohci_hcd_au1xxx_cleanup (void) static void __exit ohci_hcd_au1xxx_cleanup (void)
{ {
driver_unregister(&ohci_hcd_au1xxx_driver); platform_driver_unregister(&ohci_hcd_au1xxx_driver);
} }
module_init (ohci_hcd_au1xxx_init); module_init (ohci_hcd_au1xxx_init);

View File

@ -204,9 +204,8 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int ohci_hcd_lh7a404_drv_probe(struct device *dev) static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
int ret; int ret;
pr_debug ("In ohci_hcd_lh7a404_drv_probe"); pr_debug ("In ohci_hcd_lh7a404_drv_probe");
@ -218,40 +217,38 @@ static int ohci_hcd_lh7a404_drv_probe(struct device *dev)
return ret; return ret;
} }
static int ohci_hcd_lh7a404_drv_remove(struct device *dev) static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
usb_hcd_lh7a404_remove(hcd, pdev); usb_hcd_lh7a404_remove(hcd, pdev);
return 0; return 0;
} }
/*TBD*/ /*TBD*/
/*static int ohci_hcd_lh7a404_drv_suspend(struct device *dev) /*static int ohci_hcd_lh7a404_drv_suspend(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
return 0; return 0;
} }
static int ohci_hcd_lh7a404_drv_resume(struct device *dev) static int ohci_hcd_lh7a404_drv_resume(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
return 0; return 0;
} }
*/ */
static struct device_driver ohci_hcd_lh7a404_driver = { static struct platform_driver ohci_hcd_lh7a404_driver = {
.name = "lh7a404-ohci",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = ohci_hcd_lh7a404_drv_probe, .probe = ohci_hcd_lh7a404_drv_probe,
.remove = ohci_hcd_lh7a404_drv_remove, .remove = ohci_hcd_lh7a404_drv_remove,
/*.suspend = ohci_hcd_lh7a404_drv_suspend, */ /*.suspend = ohci_hcd_lh7a404_drv_suspend, */
/*.resume = ohci_hcd_lh7a404_drv_resume, */ /*.resume = ohci_hcd_lh7a404_drv_resume, */
.driver = {
.name = "lh7a404-ohci",
.owner = THIS_MODULE,
},
}; };
static int __init ohci_hcd_lh7a404_init (void) static int __init ohci_hcd_lh7a404_init (void)
@ -260,12 +257,12 @@ static int __init ohci_hcd_lh7a404_init (void)
pr_debug ("block sizes: ed %d td %d\n", pr_debug ("block sizes: ed %d td %d\n",
sizeof (struct ed), sizeof (struct td)); sizeof (struct ed), sizeof (struct td));
return driver_register(&ohci_hcd_lh7a404_driver); return platform_driver_register(&ohci_hcd_lh7a404_driver);
} }
static void __exit ohci_hcd_lh7a404_cleanup (void) static void __exit ohci_hcd_lh7a404_cleanup (void)
{ {
driver_unregister(&ohci_hcd_lh7a404_driver); platform_driver_unregister(&ohci_hcd_lh7a404_driver);
} }
module_init (ohci_hcd_lh7a404_init); module_init (ohci_hcd_lh7a404_init);

View File

@ -433,24 +433,22 @@ static const struct hc_driver ohci_omap_hc_driver = {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int ohci_hcd_omap_drv_probe(struct device *dev) static int ohci_hcd_omap_drv_probe(struct platform_device *dev)
{ {
return usb_hcd_omap_probe(&ohci_omap_hc_driver, return usb_hcd_omap_probe(&ohci_omap_hc_driver, dev);
to_platform_device(dev));
} }
static int ohci_hcd_omap_drv_remove(struct device *dev) static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct ohci_hcd *ohci = hcd_to_ohci (hcd); struct ohci_hcd *ohci = hcd_to_ohci (hcd);
usb_hcd_omap_remove(hcd, pdev); usb_hcd_omap_remove(hcd, dev);
if (ohci->transceiver) { if (ohci->transceiver) {
(void) otg_set_host(ohci->transceiver, 0); (void) otg_set_host(ohci->transceiver, 0);
put_device(ohci->transceiver->dev); put_device(ohci->transceiver->dev);
} }
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
return 0; return 0;
} }
@ -459,9 +457,9 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ohci_omap_suspend(struct device *dev, pm_message_t message) static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message)
{ {
struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
if (time_before(jiffies, ohci->next_statechange)) if (time_before(jiffies, ohci->next_statechange))
msleep(5); msleep(5);
@ -473,9 +471,9 @@ static int ohci_omap_suspend(struct device *dev, pm_message_t message)
return 0; return 0;
} }
static int ohci_omap_resume(struct device *dev) static int ohci_omap_resume(struct platform_device *dev)
{ {
struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
if (time_before(jiffies, ohci->next_statechange)) if (time_before(jiffies, ohci->next_statechange))
msleep(5); msleep(5);
@ -494,16 +492,17 @@ static int ohci_omap_resume(struct device *dev)
/* /*
* Driver definition to register with the OMAP bus * Driver definition to register with the OMAP bus
*/ */
static struct device_driver ohci_hcd_omap_driver = { static struct platform_driver ohci_hcd_omap_driver = {
.name = "ohci",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = ohci_hcd_omap_drv_probe, .probe = ohci_hcd_omap_drv_probe,
.remove = ohci_hcd_omap_drv_remove, .remove = ohci_hcd_omap_drv_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = ohci_omap_suspend, .suspend = ohci_omap_suspend,
.resume = ohci_omap_resume, .resume = ohci_omap_resume,
#endif #endif
.driver = {
.owner = THIS_MODULE,
.name = "ohci",
},
}; };
static int __init ohci_hcd_omap_init (void) static int __init ohci_hcd_omap_init (void)
@ -515,12 +514,12 @@ static int __init ohci_hcd_omap_init (void)
pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name, pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
sizeof (struct ed), sizeof (struct td)); sizeof (struct ed), sizeof (struct td));
return driver_register(&ohci_hcd_omap_driver); return platform_driver_register(&ohci_hcd_omap_driver);
} }
static void __exit ohci_hcd_omap_cleanup (void) static void __exit ohci_hcd_omap_cleanup (void)
{ {
driver_unregister(&ohci_hcd_omap_driver); platform_driver_unregister(&ohci_hcd_omap_driver);
} }
module_init (ohci_hcd_omap_init); module_init (ohci_hcd_omap_init);

View File

@ -172,9 +172,8 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = {
.start_port_reset = ohci_start_port_reset, .start_port_reset = ohci_start_port_reset,
}; };
static int ohci_hcd_ppc_soc_drv_probe(struct device *dev) static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
int ret; int ret;
if (usb_disabled()) if (usb_disabled())
@ -184,25 +183,25 @@ static int ohci_hcd_ppc_soc_drv_probe(struct device *dev)
return ret; return ret;
} }
static int ohci_hcd_ppc_soc_drv_remove(struct device *dev) static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
usb_hcd_ppc_soc_remove(hcd, pdev); usb_hcd_ppc_soc_remove(hcd, pdev);
return 0; return 0;
} }
static struct device_driver ohci_hcd_ppc_soc_driver = { static struct platform_driver ohci_hcd_ppc_soc_driver = {
.name = "ppc-soc-ohci",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = ohci_hcd_ppc_soc_drv_probe, .probe = ohci_hcd_ppc_soc_drv_probe,
.remove = ohci_hcd_ppc_soc_drv_remove, .remove = ohci_hcd_ppc_soc_drv_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
/*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/
/*.resume = ohci_hcd_ppc_soc_drv_resume,*/ /*.resume = ohci_hcd_ppc_soc_drv_resume,*/
#endif #endif
.driver = {
.name = "ppc-soc-ohci",
.owner = THIS_MODULE,
},
}; };
static int __init ohci_hcd_ppc_soc_init(void) static int __init ohci_hcd_ppc_soc_init(void)
@ -211,12 +210,12 @@ static int __init ohci_hcd_ppc_soc_init(void)
pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed), pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed),
sizeof(struct td)); sizeof(struct td));
return driver_register(&ohci_hcd_ppc_soc_driver); return platform_driver_register(&ohci_hcd_ppc_soc_driver);
} }
static void __exit ohci_hcd_ppc_soc_cleanup(void) static void __exit ohci_hcd_ppc_soc_cleanup(void)
{ {
driver_unregister(&ohci_hcd_ppc_soc_driver); platform_driver_unregister(&ohci_hcd_ppc_soc_driver);
} }
module_init(ohci_hcd_ppc_soc_init); module_init(ohci_hcd_ppc_soc_init);

View File

@ -290,9 +290,8 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int ohci_hcd_pxa27x_drv_probe(struct device *dev) static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
int ret; int ret;
pr_debug ("In ohci_hcd_pxa27x_drv_probe"); pr_debug ("In ohci_hcd_pxa27x_drv_probe");
@ -304,41 +303,39 @@ static int ohci_hcd_pxa27x_drv_probe(struct device *dev)
return ret; return ret;
} }
static int ohci_hcd_pxa27x_drv_remove(struct device *dev) static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
usb_hcd_pxa27x_remove(hcd, pdev); usb_hcd_pxa27x_remove(hcd, pdev);
return 0; return 0;
} }
static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state) static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *dev, pm_message_t state)
{ {
// struct platform_device *pdev = to_platform_device(dev); // struct usb_hcd *hcd = platform_get_drvdata(dev);
// struct usb_hcd *hcd = dev_get_drvdata(dev);
printk("%s: not implemented yet\n", __FUNCTION__); printk("%s: not implemented yet\n", __FUNCTION__);
return 0; return 0;
} }
static int ohci_hcd_pxa27x_drv_resume(struct device *dev) static int ohci_hcd_pxa27x_drv_resume(struct platform_device *dev)
{ {
// struct platform_device *pdev = to_platform_device(dev); // struct usb_hcd *hcd = platform_get_drvdata(dev);
// struct usb_hcd *hcd = dev_get_drvdata(dev);
printk("%s: not implemented yet\n", __FUNCTION__); printk("%s: not implemented yet\n", __FUNCTION__);
return 0; return 0;
} }
static struct device_driver ohci_hcd_pxa27x_driver = { static struct platform_driver ohci_hcd_pxa27x_driver = {
.name = "pxa27x-ohci",
.bus = &platform_bus_type,
.probe = ohci_hcd_pxa27x_drv_probe, .probe = ohci_hcd_pxa27x_drv_probe,
.remove = ohci_hcd_pxa27x_drv_remove, .remove = ohci_hcd_pxa27x_drv_remove,
.suspend = ohci_hcd_pxa27x_drv_suspend, .suspend = ohci_hcd_pxa27x_drv_suspend,
.resume = ohci_hcd_pxa27x_drv_resume, .resume = ohci_hcd_pxa27x_drv_resume,
.driver = {
.name = "pxa27x-ohci",
},
}; };
static int __init ohci_hcd_pxa27x_init (void) static int __init ohci_hcd_pxa27x_init (void)
@ -347,12 +344,12 @@ static int __init ohci_hcd_pxa27x_init (void)
pr_debug ("block sizes: ed %d td %d\n", pr_debug ("block sizes: ed %d td %d\n",
sizeof (struct ed), sizeof (struct td)); sizeof (struct ed), sizeof (struct td));
return driver_register(&ohci_hcd_pxa27x_driver); return platform_driver_register(&ohci_hcd_pxa27x_driver);
} }
static void __exit ohci_hcd_pxa27x_cleanup (void) static void __exit ohci_hcd_pxa27x_cleanup (void)
{ {
driver_unregister(&ohci_hcd_pxa27x_driver); platform_driver_unregister(&ohci_hcd_pxa27x_driver);
} }
module_init (ohci_hcd_pxa27x_init); module_init (ohci_hcd_pxa27x_init);

View File

@ -459,39 +459,38 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
/* device driver */ /* device driver */
static int ohci_hcd_s3c2410_drv_probe(struct device *dev) static int ohci_hcd_s3c2410_drv_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev);
} }
static int ohci_hcd_s3c2410_drv_remove(struct device *dev) static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(pdev);
struct usb_hcd *hcd = dev_get_drvdata(dev);
usb_hcd_s3c2410_remove(hcd, pdev); usb_hcd_s3c2410_remove(hcd, pdev);
return 0; return 0;
} }
static struct device_driver ohci_hcd_s3c2410_driver = { static struct platform_driver ohci_hcd_s3c2410_driver = {
.name = "s3c2410-ohci",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = ohci_hcd_s3c2410_drv_probe, .probe = ohci_hcd_s3c2410_drv_probe,
.remove = ohci_hcd_s3c2410_drv_remove, .remove = ohci_hcd_s3c2410_drv_remove,
/*.suspend = ohci_hcd_s3c2410_drv_suspend, */ /*.suspend = ohci_hcd_s3c2410_drv_suspend, */
/*.resume = ohci_hcd_s3c2410_drv_resume, */ /*.resume = ohci_hcd_s3c2410_drv_resume, */
.driver = {
.owner = THIS_MODULE,
.name = "s3c2410-ohci",
},
}; };
static int __init ohci_hcd_s3c2410_init (void) static int __init ohci_hcd_s3c2410_init (void)
{ {
return driver_register(&ohci_hcd_s3c2410_driver); return platform_driver_register(&ohci_hcd_s3c2410_driver);
} }
static void __exit ohci_hcd_s3c2410_cleanup (void) static void __exit ohci_hcd_s3c2410_cleanup (void)
{ {
driver_unregister(&ohci_hcd_s3c2410_driver); platform_driver_unregister(&ohci_hcd_s3c2410_driver);
} }
module_init (ohci_hcd_s3c2410_init); module_init (ohci_hcd_s3c2410_init);

View File

@ -1631,24 +1631,21 @@ static struct hc_driver sl811h_hc_driver = {
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static int __devexit static int __devexit
sl811h_remove(struct device *dev) sl811h_remove(struct platform_device *dev)
{ {
struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct sl811 *sl811 = hcd_to_sl811(hcd); struct sl811 *sl811 = hcd_to_sl811(hcd);
struct platform_device *pdev;
struct resource *res; struct resource *res;
pdev = container_of(dev, struct platform_device, dev);
remove_debug_file(sl811); remove_debug_file(sl811);
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
/* some platforms may use IORESOURCE_IO */ /* some platforms may use IORESOURCE_IO */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1); res = platform_get_resource(dev, IORESOURCE_MEM, 1);
if (res) if (res)
iounmap(sl811->data_reg); iounmap(sl811->data_reg);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (res) if (res)
iounmap(sl811->addr_reg); iounmap(sl811->addr_reg);
@ -1657,11 +1654,10 @@ sl811h_remove(struct device *dev)
} }
static int __devinit static int __devinit
sl811h_probe(struct device *dev) sl811h_probe(struct platform_device *dev)
{ {
struct usb_hcd *hcd; struct usb_hcd *hcd;
struct sl811 *sl811; struct sl811 *sl811;
struct platform_device *pdev;
struct resource *addr, *data; struct resource *addr, *data;
int irq; int irq;
void __iomem *addr_reg; void __iomem *addr_reg;
@ -1674,24 +1670,23 @@ sl811h_probe(struct device *dev)
* specific platform_data. we don't probe for IRQs, and do only * specific platform_data. we don't probe for IRQs, and do only
* minimal sanity checking. * minimal sanity checking.
*/ */
pdev = container_of(dev, struct platform_device, dev); irq = platform_get_irq(dev, 0);
irq = platform_get_irq(pdev, 0); if (dev->num_resources < 3 || irq < 0)
if (pdev->num_resources < 3 || irq < 0)
return -ENODEV; return -ENODEV;
/* refuse to confuse usbcore */ /* refuse to confuse usbcore */
if (dev->dma_mask) { if (dev->dev.dma_mask) {
DBG("no we won't dma\n"); DBG("no we won't dma\n");
return -EINVAL; return -EINVAL;
} }
/* the chip may be wired for either kind of addressing */ /* the chip may be wired for either kind of addressing */
addr = platform_get_resource(pdev, IORESOURCE_MEM, 0); addr = platform_get_resource(dev, IORESOURCE_MEM, 0);
data = platform_get_resource(pdev, IORESOURCE_MEM, 1); data = platform_get_resource(dev, IORESOURCE_MEM, 1);
retval = -EBUSY; retval = -EBUSY;
if (!addr || !data) { if (!addr || !data) {
addr = platform_get_resource(pdev, IORESOURCE_IO, 0); addr = platform_get_resource(dev, IORESOURCE_IO, 0);
data = platform_get_resource(pdev, IORESOURCE_IO, 1); data = platform_get_resource(dev, IORESOURCE_IO, 1);
if (!addr || !data) if (!addr || !data)
return -ENODEV; return -ENODEV;
ioaddr = 1; ioaddr = 1;
@ -1713,7 +1708,7 @@ sl811h_probe(struct device *dev)
} }
/* allocate and initialize hcd */ /* allocate and initialize hcd */
hcd = usb_create_hcd(&sl811h_hc_driver, dev, dev->bus_id); hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id);
if (!hcd) { if (!hcd) {
retval = -ENOMEM; retval = -ENOMEM;
goto err5; goto err5;
@ -1723,7 +1718,7 @@ sl811h_probe(struct device *dev)
spin_lock_init(&sl811->lock); spin_lock_init(&sl811->lock);
INIT_LIST_HEAD(&sl811->async); INIT_LIST_HEAD(&sl811->async);
sl811->board = dev->platform_data; sl811->board = dev->dev.platform_data;
init_timer(&sl811->timer); init_timer(&sl811->timer);
sl811->timer.function = sl811h_timer; sl811->timer.function = sl811h_timer;
sl811->timer.data = (unsigned long) sl811; sl811->timer.data = (unsigned long) sl811;
@ -1785,9 +1780,9 @@ sl811h_probe(struct device *dev)
*/ */
static int static int
sl811h_suspend(struct device *dev, pm_message_t state) sl811h_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct sl811 *sl811 = hcd_to_sl811(hcd); struct sl811 *sl811 = hcd_to_sl811(hcd);
int retval = 0; int retval = 0;
@ -1796,27 +1791,27 @@ sl811h_suspend(struct device *dev, pm_message_t state)
else if (state.event == PM_EVENT_SUSPEND) else if (state.event == PM_EVENT_SUSPEND)
port_power(sl811, 0); port_power(sl811, 0);
if (retval == 0) if (retval == 0)
dev->power.power_state = state; dev->dev.power.power_state = state;
return retval; return retval;
} }
static int static int
sl811h_resume(struct device *dev) sl811h_resume(struct platform_device *dev)
{ {
struct usb_hcd *hcd = dev_get_drvdata(dev); struct usb_hcd *hcd = platform_get_drvdata(dev);
struct sl811 *sl811 = hcd_to_sl811(hcd); struct sl811 *sl811 = hcd_to_sl811(hcd);
/* with no "check to see if VBUS is still powered" board hook, /* with no "check to see if VBUS is still powered" board hook,
* let's assume it'd only be powered to enable remote wakeup. * let's assume it'd only be powered to enable remote wakeup.
*/ */
if (dev->power.power_state.event == PM_EVENT_SUSPEND if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND
|| !hcd->can_wakeup) { || !hcd->can_wakeup) {
sl811->port1 = 0; sl811->port1 = 0;
port_power(sl811, 1); port_power(sl811, 1);
return 0; return 0;
} }
dev->power.power_state = PMSG_ON; dev->dev.power.power_state = PMSG_ON;
return sl811h_bus_resume(hcd); return sl811h_bus_resume(hcd);
} }
@ -1829,16 +1824,16 @@ sl811h_resume(struct device *dev)
/* this driver is exported so sl811_cs can depend on it */ /* this driver is exported so sl811_cs can depend on it */
struct device_driver sl811h_driver = { struct platform_driver sl811h_driver = {
.name = (char *) hcd_name,
.bus = &platform_bus_type,
.owner = THIS_MODULE,
.probe = sl811h_probe, .probe = sl811h_probe,
.remove = __devexit_p(sl811h_remove), .remove = __devexit_p(sl811h_remove),
.suspend = sl811h_suspend, .suspend = sl811h_suspend,
.resume = sl811h_resume, .resume = sl811h_resume,
.driver = {
.name = (char *) hcd_name,
.owner = THIS_MODULE,
},
}; };
EXPORT_SYMBOL(sl811h_driver); EXPORT_SYMBOL(sl811h_driver);
@ -1850,12 +1845,12 @@ static int __init sl811h_init(void)
return -ENODEV; return -ENODEV;
INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
return driver_register(&sl811h_driver); return platform_driver_register(&sl811h_driver);
} }
module_init(sl811h_init); module_init(sl811h_init);
static void __exit sl811h_cleanup(void) static void __exit sl811h_cleanup(void)
{ {
driver_unregister(&sl811h_driver); platform_driver_unregister(&sl811h_driver);
} }
module_exit(sl811h_cleanup); module_exit(sl811h_cleanup);

View File

@ -1279,7 +1279,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
printk("acornfb: freed %dK memory\n", mb_freed); printk("acornfb: freed %dK memory\n", mb_freed);
} }
static int __init acornfb_probe(struct device *dev) static int __init acornfb_probe(struct platform_device *dev)
{ {
unsigned long size; unsigned long size;
u_int h_sync, v_sync; u_int h_sync, v_sync;
@ -1292,7 +1292,7 @@ static int __init acornfb_probe(struct device *dev)
acornfb_init_fbinfo(); acornfb_init_fbinfo();
current_par.dev = dev; current_par.dev = &dev->dev;
if (current_par.montype == -1) if (current_par.montype == -1)
current_par.montype = acornfb_detect_monitortype(); current_par.montype = acornfb_detect_monitortype();
@ -1453,15 +1453,16 @@ static int __init acornfb_probe(struct device *dev)
return 0; return 0;
} }
static struct device_driver acornfb_driver = { static struct platform_driver acornfb_driver = {
.name = "acornfb",
.bus = &platform_bus_type,
.probe = acornfb_probe, .probe = acornfb_probe,
.driver = {
.name = "acornfb",
},
}; };
static int __init acornfb_init(void) static int __init acornfb_init(void)
{ {
return driver_register(&acornfb_driver); return platform_driver_register(&acornfb_driver);
} }
module_init(acornfb_init); module_init(acornfb_init);

View File

@ -514,9 +514,8 @@ static struct fb_ops arcfb_ops = {
.fb_ioctl = arcfb_ioctl, .fb_ioctl = arcfb_ioctl,
}; };
static int __init arcfb_probe(struct device *device) static int __init arcfb_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(device);
struct fb_info *info; struct fb_info *info;
int retval = -ENOMEM; int retval = -ENOMEM;
int videomemorysize; int videomemorysize;
@ -559,7 +558,7 @@ static int __init arcfb_probe(struct device *device)
retval = register_framebuffer(info); retval = register_framebuffer(info);
if (retval < 0) if (retval < 0)
goto err1; goto err1;
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
if (irq) { if (irq) {
par->irq = irq; par->irq = irq;
if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ, if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ,
@ -600,9 +599,9 @@ err:
return retval; return retval;
} }
static int arcfb_remove(struct device *device) static int arcfb_remove(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(device); struct fb_info *info = platform_get_drvdata(dev);
if (info) { if (info) {
unregister_framebuffer(info); unregister_framebuffer(info);
@ -612,11 +611,12 @@ static int arcfb_remove(struct device *device)
return 0; return 0;
} }
static struct device_driver arcfb_driver = { static struct platform_driver arcfb_driver = {
.name = "arcfb",
.bus = &platform_bus_type,
.probe = arcfb_probe, .probe = arcfb_probe,
.remove = arcfb_remove, .remove = arcfb_remove,
.driver = {
.name = "arcfb",
},
}; };
static struct platform_device *arcfb_device; static struct platform_device *arcfb_device;
@ -628,7 +628,7 @@ static int __init arcfb_init(void)
if (!arcfb_enable) if (!arcfb_enable)
return -ENXIO; return -ENXIO;
ret = driver_register(&arcfb_driver); ret = platform_driver_register(&arcfb_driver);
if (!ret) { if (!ret) {
arcfb_device = platform_device_alloc("arcfb", 0); arcfb_device = platform_device_alloc("arcfb", 0);
if (arcfb_device) { if (arcfb_device) {
@ -638,7 +638,7 @@ static int __init arcfb_init(void)
} }
if (ret) { if (ret) {
platform_device_put(arcfb_device); platform_device_put(arcfb_device);
driver_unregister(&arcfb_driver); platform_driver_unregister(&arcfb_driver);
} }
} }
return ret; return ret;
@ -648,7 +648,7 @@ static int __init arcfb_init(void)
static void __exit arcfb_exit(void) static void __exit arcfb_exit(void)
{ {
platform_device_unregister(arcfb_device); platform_device_unregister(arcfb_device);
driver_unregister(&arcfb_driver); platform_driver_unregister(&arcfb_driver);
} }
module_param(num_cols, ulong, 0); module_param(num_cols, ulong, 0);

View File

@ -73,13 +73,13 @@ static void corgibl_blank(int blank)
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int corgibl_suspend(struct device *dev, pm_message_t state) static int corgibl_suspend(struct platform_device *dev, pm_message_t state)
{ {
corgibl_blank(FB_BLANK_POWERDOWN); corgibl_blank(FB_BLANK_POWERDOWN);
return 0; return 0;
} }
static int corgibl_resume(struct device *dev) static int corgibl_resume(struct platform_device *dev)
{ {
corgibl_blank(FB_BLANK_UNBLANK); corgibl_blank(FB_BLANK_UNBLANK);
return 0; return 0;
@ -137,9 +137,9 @@ static struct backlight_properties corgibl_data = {
static struct backlight_device *corgi_backlight_device; static struct backlight_device *corgi_backlight_device;
static int __init corgibl_probe(struct device *dev) static int __init corgibl_probe(struct platform_device *pdev)
{ {
struct corgibl_machinfo *machinfo = dev->platform_data; struct corgibl_machinfo *machinfo = pdev->dev.platform_data;
corgibl_data.max_brightness = machinfo->max_intensity; corgibl_data.max_brightness = machinfo->max_intensity;
corgibl_mach_set_intensity = machinfo->set_bl_intensity; corgibl_mach_set_intensity = machinfo->set_bl_intensity;
@ -156,7 +156,7 @@ static int __init corgibl_probe(struct device *dev)
return 0; return 0;
} }
static int corgibl_remove(struct device *dev) static int corgibl_remove(struct platform_device *dev)
{ {
backlight_device_unregister(corgi_backlight_device); backlight_device_unregister(corgi_backlight_device);
@ -166,23 +166,24 @@ static int corgibl_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver corgibl_driver = { static struct platform_driver corgibl_driver = {
.name = "corgi-bl",
.bus = &platform_bus_type,
.probe = corgibl_probe, .probe = corgibl_probe,
.remove = corgibl_remove, .remove = corgibl_remove,
.suspend = corgibl_suspend, .suspend = corgibl_suspend,
.resume = corgibl_resume, .resume = corgibl_resume,
.driver = {
.name = "corgi-bl",
},
}; };
static int __init corgibl_init(void) static int __init corgibl_init(void)
{ {
return driver_register(&corgibl_driver); return platform_driver_register(&corgibl_driver);
} }
static void __exit corgibl_exit(void) static void __exit corgibl_exit(void)
{ {
driver_unregister(&corgibl_driver); platform_driver_unregister(&corgibl_driver);
} }
module_init(corgibl_init); module_init(corgibl_init);

View File

@ -227,9 +227,8 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
* Initialization * Initialization
*/ */
static int __devinit dnfb_probe(struct device *device) static int __devinit dnfb_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(device);
struct fb_info *info; struct fb_info *info;
int err = 0; int err = 0;
@ -257,7 +256,7 @@ static int __devinit dnfb_probe(struct device *device)
framebuffer_release(info); framebuffer_release(info);
return err; return err;
} }
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
/* now we have registered we can safely setup the hardware */ /* now we have registered we can safely setup the hardware */
out_8(AP_CONTROL_3A, RESET_CREG); out_8(AP_CONTROL_3A, RESET_CREG);
@ -271,10 +270,11 @@ static int __devinit dnfb_probe(struct device *device)
return err; return err;
} }
static struct device_driver dnfb_driver = { static struct platform_driver dnfb_driver = {
.name = "dnfb",
.bus = &platform_bus_type,
.probe = dnfb_probe, .probe = dnfb_probe,
.driver = {
.name = "dnfb",
},
}; };
static struct platform_device dnfb_device = { static struct platform_device dnfb_device = {
@ -288,12 +288,12 @@ int __init dnfb_init(void)
if (fb_get_options("dnfb", NULL)) if (fb_get_options("dnfb", NULL))
return -ENODEV; return -ENODEV;
ret = driver_register(&dnfb_driver); ret = platform_driver_register(&dnfb_driver);
if (!ret) { if (!ret) {
ret = platform_device_register(&dnfb_device); ret = platform_device_register(&dnfb_device);
if (ret) if (ret)
driver_unregister(&dnfb_driver); platform_driver_unregister(&dnfb_driver);
} }
return ret; return ret;
} }

View File

@ -609,9 +609,9 @@ static void epson1355fb_platform_release(struct device *device)
{ {
} }
static int epson1355fb_remove(struct device *device) static int epson1355fb_remove(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(device); struct fb_info *info = platform_get_drvdata(dev);
struct epson1355_par *par = info->par; struct epson1355_par *par = info->par;
backlight_enable(0); backlight_enable(0);
@ -632,9 +632,8 @@ static int epson1355fb_remove(struct device *device)
return 0; return 0;
} }
int __init epson1355fb_probe(struct device *device) int __init epson1355fb_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(device);
struct epson1355_par *default_par; struct epson1355_par *default_par;
struct fb_info *info; struct fb_info *info;
u8 revision; u8 revision;
@ -713,7 +712,7 @@ int __init epson1355fb_probe(struct device *device)
/* /*
* Our driver data. * Our driver data.
*/ */
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
printk(KERN_INFO "fb%d: %s frame buffer device\n", printk(KERN_INFO "fb%d: %s frame buffer device\n",
info->node, info->fix.id); info->node, info->fix.id);
@ -721,15 +720,16 @@ int __init epson1355fb_probe(struct device *device)
return 0; return 0;
bail: bail:
epson1355fb_remove(device); epson1355fb_remove(dev);
return rc; return rc;
} }
static struct device_driver epson1355fb_driver = { static struct platform_driver epson1355fb_driver = {
.name = "epson1355fb",
.bus = &platform_bus_type,
.probe = epson1355fb_probe, .probe = epson1355fb_probe,
.remove = epson1355fb_remove, .remove = epson1355fb_remove,
.driver = {
.name = "epson1355fb",
},
}; };
static struct platform_device epson1355fb_device = { static struct platform_device epson1355fb_device = {
@ -747,11 +747,11 @@ int __init epson1355fb_init(void)
if (fb_get_options("epson1355fb", NULL)) if (fb_get_options("epson1355fb", NULL))
return -ENODEV; return -ENODEV;
ret = driver_register(&epson1355fb_driver); ret = platform_driver_register(&epson1355fb_driver);
if (!ret) { if (!ret) {
ret = platform_device_register(&epson1355fb_device); ret = platform_device_register(&epson1355fb_device);
if (ret) if (ret)
driver_unregister(&epson1355fb_driver); platform_driver_unregister(&epson1355fb_driver);
} }
return ret; return ret;
} }
@ -762,7 +762,7 @@ module_init(epson1355fb_init);
static void __exit epson1355fb_exit(void) static void __exit epson1355fb_exit(void)
{ {
platform_device_unregister(&epson1355fb_device); platform_device_unregister(&epson1355fb_device);
driver_unregister(&epson1355fb_driver); platform_driver_unregister(&epson1355fb_driver);
} }
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -1105,12 +1105,11 @@ int __init gbefb_setup(char *options)
return 0; return 0;
} }
static int __init gbefb_probe(struct device *dev) static int __init gbefb_probe(struct platform_device *p_dev)
{ {
int i, ret = 0; int i, ret = 0;
struct fb_info *info; struct fb_info *info;
struct gbefb_par *par; struct gbefb_par *par;
struct platform_device *p_dev = to_platform_device(dev);
#ifndef MODULE #ifndef MODULE
char *options = NULL; char *options = NULL;
#endif #endif
@ -1204,8 +1203,8 @@ static int __init gbefb_probe(struct device *dev)
goto out_gbe_unmap; goto out_gbe_unmap;
} }
dev_set_drvdata(&p_dev->dev, info); platform_set_drvdata(p_dev, info);
gbefb_create_sysfs(dev); gbefb_create_sysfs(&p_dev->dev);
printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n", printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n",
info->node, info->fix.id, gbe_revision, (unsigned) GBE_BASE, info->node, info->fix.id, gbe_revision, (unsigned) GBE_BASE,
@ -1231,10 +1230,9 @@ out_release_framebuffer:
return ret; return ret;
} }
static int __devexit gbefb_remove(struct device* dev) static int __devexit gbefb_remove(struct platform_device* p_dev)
{ {
struct platform_device *p_dev = to_platform_device(dev); struct fb_info *info = platform_get_drvdata(p_dev);
struct fb_info *info = dev_get_drvdata(&p_dev->dev);
unregister_framebuffer(info); unregister_framebuffer(info);
gbe_turn_off(); gbe_turn_off();
@ -1252,18 +1250,19 @@ static int __devexit gbefb_remove(struct device* dev)
return 0; return 0;
} }
static struct device_driver gbefb_driver = { static struct platform_driver gbefb_driver = {
.name = "gbefb",
.bus = &platform_bus_type,
.probe = gbefb_probe, .probe = gbefb_probe,
.remove = __devexit_p(gbefb_remove), .remove = __devexit_p(gbefb_remove),
.driver = {
.name = "gbefb",
},
}; };
static struct platform_device *gbefb_device; static struct platform_device *gbefb_device;
int __init gbefb_init(void) int __init gbefb_init(void)
{ {
int ret = driver_register(&gbefb_driver); int ret = platform_driver_register(&gbefb_driver);
if (!ret) { if (!ret) {
gbefb_device = platform_device_alloc("gbefb", 0); gbefb_device = platform_device_alloc("gbefb", 0);
if (gbefb_device) { if (gbefb_device) {
@ -1273,7 +1272,7 @@ int __init gbefb_init(void)
} }
if (ret) { if (ret) {
platform_device_put(gbefb_device); platform_device_put(gbefb_device);
driver_unregister(&gbefb_driver); platform_driver_unregister(&gbefb_driver);
} }
} }
return ret; return ret;
@ -1282,7 +1281,7 @@ int __init gbefb_init(void)
void __exit gbefb_exit(void) void __exit gbefb_exit(void)
{ {
platform_device_unregister(gbefb_device); platform_device_unregister(gbefb_device);
driver_unregister(&gbefb_driver); platform_driver_unregister(&gbefb_driver);
} }
module_init(gbefb_init); module_init(gbefb_init);

View File

@ -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, * Power management hooks. Note that we won't be called from IRQ context,
* unlike the blank functions above, so we may sleep. * unlike the blank functions above, so we may sleep.
*/ */
static int imxfb_suspend(struct device *dev, pm_message_t state) static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct imxfb_info *fbi = dev_get_drvdata(dev); struct imxfb_info *fbi = platform_get_drvdata(dev);
pr_debug("%s\n",__FUNCTION__); pr_debug("%s\n",__FUNCTION__);
imxfb_disable_controller(fbi); imxfb_disable_controller(fbi);
return 0; return 0;
} }
static int imxfb_resume(struct device *dev) static int imxfb_resume(struct platform_device *dev)
{ {
struct imxfb_info *fbi = dev_get_drvdata(dev); struct imxfb_info *fbi = platform_get_drvdata(dev);
pr_debug("%s\n",__FUNCTION__); pr_debug("%s\n",__FUNCTION__);
imxfb_enable_controller(fbi); imxfb_enable_controller(fbi);
@ -538,9 +538,8 @@ static int __init imxfb_map_video_memory(struct fb_info *info)
return fbi->map_cpu ? 0 : -ENOMEM; return fbi->map_cpu ? 0 : -ENOMEM;
} }
static int __init imxfb_probe(struct device *dev) static int __init imxfb_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct imxfb_info *fbi; struct imxfb_info *fbi;
struct fb_info *info; struct fb_info *info;
struct imxfb_mach_info *inf; struct imxfb_mach_info *inf;
@ -553,21 +552,21 @@ static int __init imxfb_probe(struct device *dev)
if(!res) if(!res)
return -ENODEV; return -ENODEV;
inf = dev->platform_data; inf = pdev->dev.platform_data;
if(!inf) { if(!inf) {
dev_err(dev,"No platform_data available\n"); dev_err(dev,"No platform_data available\n");
return -ENOMEM; return -ENOMEM;
} }
info = framebuffer_alloc(sizeof(struct imxfb_info), dev); info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
if(!info) if(!info)
return -ENOMEM; return -ENOMEM;
fbi = info->par; fbi = info->par;
dev_set_drvdata(dev, info); platform_set_drvdata(pdev, info);
ret = imxfb_init_fbinfo(dev); ret = imxfb_init_fbinfo(&pdev->dev);
if( ret < 0 ) if( ret < 0 )
goto failed_init; goto failed_init;
@ -621,22 +620,21 @@ failed_register:
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
failed_cmap: failed_cmap:
if (!inf->fixed_screen_cpu) if (!inf->fixed_screen_cpu)
dma_free_writecombine(dev,fbi->map_size,fbi->map_cpu, dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu,
fbi->map_dma); fbi->map_dma);
failed_map: failed_map:
kfree(info->pseudo_palette); kfree(info->pseudo_palette);
failed_regs: failed_regs:
release_mem_region(res->start, res->end - res->start); release_mem_region(res->start, res->end - res->start);
failed_init: failed_init:
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
framebuffer_release(info); framebuffer_release(info);
return ret; return ret;
} }
static int imxfb_remove(struct device *dev) static int imxfb_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct fb_info *info = platform_get_drvdata(pdev);
struct fb_info *info = dev_get_drvdata(dev);
struct imxfb_info *fbi = info->par; struct imxfb_info *fbi = info->par;
struct resource *res; struct resource *res;
@ -651,36 +649,37 @@ static int imxfb_remove(struct device *dev)
framebuffer_release(info); framebuffer_release(info);
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, res->end - res->start + 1);
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
return 0; return 0;
} }
void imxfb_shutdown(struct device * dev) void imxfb_shutdown(struct platform_device * dev)
{ {
struct fb_info *info = dev_get_drvdata(dev); struct fb_info *info = platform_get_drvdata(dev);
struct imxfb_info *fbi = info->par; struct imxfb_info *fbi = info->par;
imxfb_disable_controller(fbi); imxfb_disable_controller(fbi);
} }
static struct device_driver imxfb_driver = { static struct platform_driver imxfb_driver = {
.name = "imx-fb",
.bus = &platform_bus_type,
.probe = imxfb_probe, .probe = imxfb_probe,
.suspend = imxfb_suspend, .suspend = imxfb_suspend,
.resume = imxfb_resume, .resume = imxfb_resume,
.remove = imxfb_remove, .remove = imxfb_remove,
.shutdown = imxfb_shutdown, .shutdown = imxfb_shutdown,
.driver = {
.name = "imx-fb",
},
}; };
int __init imxfb_init(void) int __init imxfb_init(void)
{ {
return driver_register(&imxfb_driver); return platform_driver_register(&imxfb_driver);
} }
static void __exit imxfb_cleanup(void) static void __exit imxfb_cleanup(void)
{ {
driver_unregister(&imxfb_driver); platform_driver_unregister(&imxfb_driver);
} }
module_init(imxfb_init); module_init(imxfb_init);

View File

@ -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, * Power management hooks. Note that we won't be called from IRQ context,
* unlike the blank functions above, so we may sleep. * unlike the blank functions above, so we may sleep.
*/ */
static int pxafb_suspend(struct device *dev, pm_message_t state) static int pxafb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct pxafb_info *fbi = dev_get_drvdata(dev); struct pxafb_info *fbi = platform_get_drvdata(dev);
set_ctrlr_state(fbi, C_DISABLE_PM); set_ctrlr_state(fbi, C_DISABLE_PM);
return 0; return 0;
} }
static int pxafb_resume(struct device *dev) static int pxafb_resume(struct platform_device *dev)
{ {
struct pxafb_info *fbi = dev_get_drvdata(dev); struct pxafb_info *fbi = platform_get_drvdata(dev);
set_ctrlr_state(fbi, C_ENABLE_PM); set_ctrlr_state(fbi, C_ENABLE_PM);
return 0; return 0;
@ -1268,7 +1268,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
} }
#endif #endif
int __init pxafb_probe(struct device *dev) int __init pxafb_probe(struct platform_device *dev)
{ {
struct pxafb_info *fbi; struct pxafb_info *fbi;
struct pxafb_mach_info *inf; struct pxafb_mach_info *inf;
@ -1276,14 +1276,14 @@ int __init pxafb_probe(struct device *dev)
dev_dbg(dev, "pxafb_probe\n"); dev_dbg(dev, "pxafb_probe\n");
inf = dev->platform_data; inf = dev->dev.platform_data;
ret = -ENOMEM; ret = -ENOMEM;
fbi = NULL; fbi = NULL;
if (!inf) if (!inf)
goto failed; goto failed;
#ifdef CONFIG_FB_PXA_PARAMETERS #ifdef CONFIG_FB_PXA_PARAMETERS
ret = pxafb_parse_options(dev, g_options); ret = pxafb_parse_options(&dev->dev, g_options);
if (ret < 0) if (ret < 0)
goto failed; goto failed;
#endif #endif
@ -1293,36 +1293,36 @@ int __init pxafb_probe(struct device *dev)
* a warning is given. */ * a warning is given. */
if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK)
dev_warn(dev, "machine LCCR0 setting contains illegal bits: %08x\n", dev_warn(&dev->dev, "machine LCCR0 setting contains illegal bits: %08x\n",
inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); inf->lccr0 & LCCR0_INVALID_CONFIG_MASK);
if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK)
dev_warn(dev, "machine LCCR3 setting contains illegal bits: %08x\n", dev_warn(&dev->dev, "machine LCCR3 setting contains illegal bits: %08x\n",
inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); inf->lccr3 & LCCR3_INVALID_CONFIG_MASK);
if (inf->lccr0 & LCCR0_DPD && if (inf->lccr0 & LCCR0_DPD &&
((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas ||
(inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl ||
(inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono))
dev_warn(dev, "Double Pixel Data (DPD) mode is only valid in passive mono" dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is only valid in passive mono"
" single panel mode\n"); " single panel mode\n");
if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act &&
(inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual)
dev_warn(dev, "Dual panel only valid in passive mode\n"); dev_warn(&dev->dev, "Dual panel only valid in passive mode\n");
if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas &&
(inf->upper_margin || inf->lower_margin)) (inf->upper_margin || inf->lower_margin))
dev_warn(dev, "Upper and lower margins must be 0 in passive mode\n"); dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n");
#endif #endif
dev_dbg(dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp);
if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) { if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) {
dev_err(dev, "Invalid resolution or bit depth\n"); dev_err(&dev->dev, "Invalid resolution or bit depth\n");
ret = -EINVAL; ret = -EINVAL;
goto failed; goto failed;
} }
pxafb_backlight_power = inf->pxafb_backlight_power; pxafb_backlight_power = inf->pxafb_backlight_power;
pxafb_lcd_power = inf->pxafb_lcd_power; pxafb_lcd_power = inf->pxafb_lcd_power;
fbi = pxafb_init_fbinfo(dev); fbi = pxafb_init_fbinfo(&dev->dev);
if (!fbi) { if (!fbi) {
dev_err(dev, "Failed to initialize framebuffer device\n"); dev_err(&dev->dev, "Failed to initialize framebuffer device\n");
ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc
goto failed; goto failed;
} }
@ -1330,14 +1330,14 @@ int __init pxafb_probe(struct device *dev)
/* Initialize video memory */ /* Initialize video memory */
ret = pxafb_map_video_memory(fbi); ret = pxafb_map_video_memory(fbi);
if (ret) { if (ret) {
dev_err(dev, "Failed to allocate video RAM: %d\n", ret); dev_err(&dev->dev, "Failed to allocate video RAM: %d\n", ret);
ret = -ENOMEM; ret = -ENOMEM;
goto failed; goto failed;
} }
ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi);
if (ret) { if (ret) {
dev_err(dev, "request_irq failed: %d\n", ret); dev_err(&dev->dev, "request_irq failed: %d\n", ret);
ret = -EBUSY; ret = -EBUSY;
goto failed; goto failed;
} }
@ -1349,11 +1349,11 @@ int __init pxafb_probe(struct device *dev)
pxafb_check_var(&fbi->fb.var, &fbi->fb); pxafb_check_var(&fbi->fb.var, &fbi->fb);
pxafb_set_par(&fbi->fb); pxafb_set_par(&fbi->fb);
dev_set_drvdata(dev, fbi); platform_set_drvdata(dev, fbi);
ret = register_framebuffer(&fbi->fb); ret = register_framebuffer(&fbi->fb);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Failed to register framebuffer device: %d\n", ret); dev_err(&dev->dev, "Failed to register framebuffer device: %d\n", ret);
goto failed; goto failed;
} }
@ -1376,19 +1376,20 @@ int __init pxafb_probe(struct device *dev)
return 0; return 0;
failed: failed:
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
kfree(fbi); kfree(fbi);
return ret; return ret;
} }
static struct device_driver pxafb_driver = { static struct platform_driver pxafb_driver = {
.name = "pxa2xx-fb",
.bus = &platform_bus_type,
.probe = pxafb_probe, .probe = pxafb_probe,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = pxafb_suspend, .suspend = pxafb_suspend,
.resume = pxafb_resume, .resume = pxafb_resume,
#endif #endif
.driver = {
.name = "pxa2xx-fb",
},
}; };
#ifndef MODULE #ifndef MODULE
@ -1415,7 +1416,7 @@ int __devinit pxafb_init(void)
return -ENODEV; return -ENODEV;
pxafb_setup(option); pxafb_setup(option);
#endif #endif
return driver_register(&pxafb_driver); return platform_driver_register(&pxafb_driver);
} }
module_init(pxafb_init); module_init(pxafb_init);

View File

@ -86,9 +86,8 @@ static struct fb_ops q40fb_ops = {
.fb_imageblit = cfb_imageblit, .fb_imageblit = cfb_imageblit,
}; };
static int __init q40fb_probe(struct device *device) static int __init q40fb_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(device);
struct fb_info *info; struct fb_info *info;
if (!MACH_IS_Q40) if (!MACH_IS_Q40)
@ -128,10 +127,11 @@ static int __init q40fb_probe(struct device *device)
return 0; return 0;
} }
static struct device_driver q40fb_driver = { static struct platform_driver q40fb_driver = {
.name = "q40fb",
.bus = &platform_bus_type,
.probe = q40fb_probe, .probe = q40fb_probe,
.driver = {
.name = "q40fb",
},
}; };
static struct platform_device q40fb_device = { static struct platform_device q40fb_device = {
@ -145,12 +145,12 @@ int __init q40fb_init(void)
if (fb_get_options("q40fb", NULL)) if (fb_get_options("q40fb", NULL))
return -ENODEV; return -ENODEV;
ret = driver_register(&q40fb_driver); ret = platform_driver_register(&q40fb_driver);
if (!ret) { if (!ret) {
ret = platform_device_register(&q40fb_device); ret = platform_device_register(&q40fb_device);
if (ret) if (ret)
driver_unregister(&q40fb_driver); platform_driver_unregister(&q40fb_driver);
} }
return ret; return ret;
} }

View File

@ -503,10 +503,9 @@ s1d13xxxfb_fetch_hw_state(struct fb_info *info)
static int static int
s1d13xxxfb_remove(struct device *dev) s1d13xxxfb_remove(struct platform_device *pdev)
{ {
struct fb_info *info = dev_get_drvdata(dev); struct fb_info *info = platform_get_drvdata(pdev);
struct platform_device *pdev = to_platform_device(dev);
struct s1d13xxxfb_par *par = NULL; struct s1d13xxxfb_par *par = NULL;
if (info) { if (info) {
@ -534,9 +533,8 @@ s1d13xxxfb_remove(struct device *dev)
} }
static int __devinit static int __devinit
s1d13xxxfb_probe(struct device *dev) s1d13xxxfb_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct s1d13xxxfb_par *default_par; struct s1d13xxxfb_par *default_par;
struct fb_info *info; struct fb_info *info;
struct s1d13xxxfb_pdata *pdata = NULL; struct s1d13xxxfb_pdata *pdata = NULL;
@ -548,8 +546,8 @@ s1d13xxxfb_probe(struct device *dev)
printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); printk(KERN_INFO "Epson S1D13XXX FB Driver\n");
/* enable platform-dependent hardware glue, if any */ /* enable platform-dependent hardware glue, if any */
if (dev->platform_data) if (pdev->dev.platform_data)
pdata = dev->platform_data; pdata = pdev->dev.platform_data;
if (pdata && pdata->platform_init_video) if (pdata && pdata->platform_init_video)
pdata->platform_init_video(); pdata->platform_init_video();
@ -572,14 +570,14 @@ s1d13xxxfb_probe(struct device *dev)
if (!request_mem_region(pdev->resource[0].start, if (!request_mem_region(pdev->resource[0].start,
pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) { pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) {
dev_dbg(dev, "request_mem_region failed\n"); dev_dbg(&pdev->dev, "request_mem_region failed\n");
ret = -EBUSY; ret = -EBUSY;
goto bail; goto bail;
} }
if (!request_mem_region(pdev->resource[1].start, if (!request_mem_region(pdev->resource[1].start,
pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) { pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) {
dev_dbg(dev, "request_mem_region failed\n"); dev_dbg(&pdev->dev, "request_mem_region failed\n");
ret = -EBUSY; ret = -EBUSY;
goto bail; goto bail;
} }
@ -640,7 +638,7 @@ s1d13xxxfb_probe(struct device *dev)
goto bail; goto bail;
} }
dev_set_drvdata(&pdev->dev, info); platform_set_drvdata(pdev, info);
printk(KERN_INFO "fb%d: %s frame buffer device\n", printk(KERN_INFO "fb%d: %s frame buffer device\n",
info->node, info->fix.id); info->node, info->fix.id);
@ -648,15 +646,15 @@ s1d13xxxfb_probe(struct device *dev)
return 0; return 0;
bail: bail:
s1d13xxxfb_remove(dev); s1d13xxxfb_remove(pdev);
return ret; return ret;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state) static int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct fb_info *info = dev_get_drvdata(dev); struct fb_info *info = platform_get_drvdata(dev);
struct s1d13xxxfb_par *s1dfb = info->par; struct s1d13xxxfb_par *s1dfb = info->par;
struct s1d13xxxfb_pdata *pdata = NULL; struct s1d13xxxfb_pdata *pdata = NULL;
@ -664,8 +662,8 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state)
lcd_enable(s1dfb, 0); lcd_enable(s1dfb, 0);
crt_enable(s1dfb, 0); crt_enable(s1dfb, 0);
if (dev->platform_data) if (dev->dev.platform_data)
pdata = dev->platform_data; pdata = dev->dev.platform_data;
#if 0 #if 0
if (!s1dfb->disp_save) if (!s1dfb->disp_save)
@ -701,9 +699,9 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int s1d13xxxfb_resume(struct device *dev) static int s1d13xxxfb_resume(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(dev); struct fb_info *info = platform_get_drvdata(dev);
struct s1d13xxxfb_par *s1dfb = info->par; struct s1d13xxxfb_par *s1dfb = info->par;
struct s1d13xxxfb_pdata *pdata = NULL; struct s1d13xxxfb_pdata *pdata = NULL;
@ -714,8 +712,8 @@ static int s1d13xxxfb_resume(struct device *dev)
while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01)) while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01))
udelay(10); udelay(10);
if (dev->platform_data) if (dev->dev.platform_data)
pdata = dev->platform_data; pdata = dev->dev.platform_data;
if (s1dfb->regs_save) { if (s1dfb->regs_save) {
/* will write RO regs, *should* get away with it :) */ /* will write RO regs, *should* get away with it :) */
@ -741,15 +739,16 @@ static int s1d13xxxfb_resume(struct device *dev)
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct device_driver s1d13xxxfb_driver = { static struct platform_driver s1d13xxxfb_driver = {
.name = S1D_DEVICENAME,
.bus = &platform_bus_type,
.probe = s1d13xxxfb_probe, .probe = s1d13xxxfb_probe,
.remove = s1d13xxxfb_remove, .remove = s1d13xxxfb_remove,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = s1d13xxxfb_suspend, .suspend = s1d13xxxfb_suspend,
.resume = s1d13xxxfb_resume .resume = s1d13xxxfb_resume,
#endif #endif
.driver = {
.name = S1D_DEVICENAME,
},
}; };
@ -759,14 +758,14 @@ s1d13xxxfb_init(void)
if (fb_get_options("s1d13xxxfb", NULL)) if (fb_get_options("s1d13xxxfb", NULL))
return -ENODEV; return -ENODEV;
return driver_register(&s1d13xxxfb_driver); return platform_driver_register(&s1d13xxxfb_driver);
} }
static void __exit static void __exit
s1d13xxxfb_exit(void) s1d13xxxfb_exit(void)
{ {
driver_unregister(&s1d13xxxfb_driver); platform_driver_unregister(&s1d13xxxfb_driver);
} }
module_init(s1d13xxxfb_init); module_init(s1d13xxxfb_init);

View File

@ -634,19 +634,18 @@ static irqreturn_t s3c2410fb_irq(int irq, void *dev_id, struct pt_regs *r)
static char driver_name[]="s3c2410fb"; static char driver_name[]="s3c2410fb";
int __init s3c2410fb_probe(struct device *dev) int __init s3c2410fb_probe(struct platform_device *pdev)
{ {
struct s3c2410fb_info *info; struct s3c2410fb_info *info;
struct fb_info *fbinfo; struct fb_info *fbinfo;
struct platform_device *pdev = to_platform_device(dev);
struct s3c2410fb_hw *mregs; struct s3c2410fb_hw *mregs;
int ret; int ret;
int irq; int irq;
int i; int i;
mach_info = dev->platform_data; mach_info = pdev->dev.platform_data;
if (mach_info == NULL) { if (mach_info == NULL) {
dev_err(dev,"no platform data for lcd, cannot attach\n"); dev_err(&pdev->dev,"no platform data for lcd, cannot attach\n");
return -EINVAL; return -EINVAL;
} }
@ -654,11 +653,11 @@ int __init s3c2410fb_probe(struct device *dev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_err(dev, "no irq for device\n"); dev_err(&pdev->dev, "no irq for device\n");
return -ENOENT; return -ENOENT;
} }
fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), dev); fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), &pdev->dev);
if (!fbinfo) { if (!fbinfo) {
return -ENOMEM; return -ENOMEM;
} }
@ -666,7 +665,7 @@ int __init s3c2410fb_probe(struct device *dev)
info = fbinfo->par; info = fbinfo->par;
info->fb = fbinfo; info->fb = fbinfo;
dev_set_drvdata(dev, fbinfo); platform_set_drvdata(pdev, fbinfo);
s3c2410fb_init_registers(info); s3c2410fb_init_registers(info);
@ -676,7 +675,7 @@ int __init s3c2410fb_probe(struct device *dev)
memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); memcpy(&info->regs, &mach_info->regs, sizeof(info->regs));
info->mach_info = dev->platform_data; info->mach_info = pdev->dev.platform_data;
fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; fbinfo->fix.type = FB_TYPE_PACKED_PIXELS;
fbinfo->fix.type_aux = 0; fbinfo->fix.type_aux = 0;
@ -735,7 +734,7 @@ int __init s3c2410fb_probe(struct device *dev)
ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info);
if (ret) { if (ret) {
dev_err(dev, "cannot get irq %d - err %d\n", irq, ret); dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret);
ret = -EBUSY; ret = -EBUSY;
goto release_mem; goto release_mem;
} }
@ -773,7 +772,7 @@ int __init s3c2410fb_probe(struct device *dev)
} }
/* create device files */ /* create device files */
device_create_file(dev, &dev_attr_debug); device_create_file(&pdev->dev, &dev_attr_debug);
printk(KERN_INFO "fb%d: %s frame buffer device\n", printk(KERN_INFO "fb%d: %s frame buffer device\n",
fbinfo->node, fbinfo->fix.id); fbinfo->node, fbinfo->fix.id);
@ -816,10 +815,9 @@ static void s3c2410fb_stop_lcd(void)
/* /*
* Cleanup * Cleanup
*/ */
static int s3c2410fb_remove(struct device *dev) static int s3c2410fb_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct fb_info *fbinfo = platform_get_drvdata(pdev);
struct fb_info *fbinfo = dev_get_drvdata(dev);
struct s3c2410fb_info *info = fbinfo->par; struct s3c2410fb_info *info = fbinfo->par;
int irq; int irq;
@ -847,9 +845,9 @@ static int s3c2410fb_remove(struct device *dev)
/* suspend and resume support for the lcd controller */ /* suspend and resume support for the lcd controller */
static int s3c2410fb_suspend(struct device *dev, pm_message_t state) static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct fb_info *fbinfo = dev_get_drvdata(dev); struct fb_info *fbinfo = platform_get_drvdata(dev);
struct s3c2410fb_info *info = fbinfo->par; struct s3c2410fb_info *info = fbinfo->par;
s3c2410fb_stop_lcd(); s3c2410fb_stop_lcd();
@ -864,9 +862,9 @@ static int s3c2410fb_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int s3c2410fb_resume(struct device *dev) static int s3c2410fb_resume(struct platform_device *dev)
{ {
struct fb_info *fbinfo = dev_get_drvdata(dev); struct fb_info *fbinfo = platform_get_drvdata(dev);
struct s3c2410fb_info *info = fbinfo->par; struct s3c2410fb_info *info = fbinfo->par;
clk_enable(info->clk); clk_enable(info->clk);
@ -882,24 +880,25 @@ static int s3c2410fb_resume(struct device *dev)
#define s3c2410fb_resume NULL #define s3c2410fb_resume NULL
#endif #endif
static struct device_driver s3c2410fb_driver = { static struct platform_driver s3c2410fb_driver = {
.name = "s3c2410-lcd",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
.probe = s3c2410fb_probe, .probe = s3c2410fb_probe,
.remove = s3c2410fb_remove,
.suspend = s3c2410fb_suspend, .suspend = s3c2410fb_suspend,
.resume = s3c2410fb_resume, .resume = s3c2410fb_resume,
.remove = s3c2410fb_remove .driver = {
.name = "s3c2410-lcd",
.owner = THIS_MODULE,
},
}; };
int __devinit s3c2410fb_init(void) int __devinit s3c2410fb_init(void)
{ {
return driver_register(&s3c2410fb_driver); return platform_driver_register(&s3c2410fb_driver);
} }
static void __exit s3c2410fb_cleanup(void) static void __exit s3c2410fb_cleanup(void)
{ {
driver_unregister(&s3c2410fb_driver); platform_driver_unregister(&s3c2410fb_driver);
} }

View File

@ -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, * Power management hooks. Note that we won't be called from IRQ context,
* unlike the blank functions above, so we may sleep. * unlike the blank functions above, so we may sleep.
*/ */
static int sa1100fb_suspend(struct device *dev, pm_message_t state) static int sa1100fb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct sa1100fb_info *fbi = dev_get_drvdata(dev); struct sa1100fb_info *fbi = platform_get_drvdata(dev);
set_ctrlr_state(fbi, C_DISABLE_PM); set_ctrlr_state(fbi, C_DISABLE_PM);
return 0; return 0;
} }
static int sa1100fb_resume(struct device *dev) static int sa1100fb_resume(struct platform_device *dev)
{ {
struct sa1100fb_info *fbi = dev_get_drvdata(dev); struct sa1100fb_info *fbi = platform_get_drvdata(dev);
set_ctrlr_state(fbi, C_ENABLE_PM); set_ctrlr_state(fbi, C_ENABLE_PM);
return 0; return 0;
@ -1452,7 +1452,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
return fbi; return fbi;
} }
static int __init sa1100fb_probe(struct device *dev) static int __init sa1100fb_probe(struct platform_device *pdev)
{ {
struct sa1100fb_info *fbi; struct sa1100fb_info *fbi;
int ret; int ret;
@ -1460,7 +1460,7 @@ static int __init sa1100fb_probe(struct device *dev)
if (!request_mem_region(0xb0100000, 0x10000, "LCD")) if (!request_mem_region(0xb0100000, 0x10000, "LCD"))
return -EBUSY; return -EBUSY;
fbi = sa1100fb_init_fbinfo(dev); fbi = sa1100fb_init_fbinfo(&pdev->dev);
ret = -ENOMEM; ret = -ENOMEM;
if (!fbi) if (!fbi)
goto failed; goto failed;
@ -1488,7 +1488,7 @@ static int __init sa1100fb_probe(struct device *dev)
*/ */
sa1100fb_check_var(&fbi->fb.var, &fbi->fb); sa1100fb_check_var(&fbi->fb.var, &fbi->fb);
dev_set_drvdata(dev, fbi); platform_set_drvdata(pdev, fbi);
ret = register_framebuffer(&fbi->fb); ret = register_framebuffer(&fbi->fb);
if (ret < 0) if (ret < 0)
@ -1505,18 +1505,19 @@ static int __init sa1100fb_probe(struct device *dev)
return 0; return 0;
failed: failed:
dev_set_drvdata(dev, NULL); platform_set_drvdata(pdev, NULL);
kfree(fbi); kfree(fbi);
release_mem_region(0xb0100000, 0x10000); release_mem_region(0xb0100000, 0x10000);
return ret; return ret;
} }
static struct device_driver sa1100fb_driver = { static struct platform_driver sa1100fb_driver = {
.name = "sa11x0-fb",
.bus = &platform_bus_type,
.probe = sa1100fb_probe, .probe = sa1100fb_probe,
.suspend = sa1100fb_suspend, .suspend = sa1100fb_suspend,
.resume = sa1100fb_resume, .resume = sa1100fb_resume,
.driver = {
.name = "sa11x0-fb",
},
}; };
int __init sa1100fb_init(void) int __init sa1100fb_init(void)
@ -1524,7 +1525,7 @@ int __init sa1100fb_init(void)
if (fb_get_options("sa1100fb", NULL)) if (fb_get_options("sa1100fb", NULL))
return -ENODEV; return -ENODEV;
return driver_register(&sa1100fb_driver); return platform_driver_register(&sa1100fb_driver);
} }
int __init sa1100fb_setup(char *options) int __init sa1100fb_setup(char *options)

View File

@ -750,9 +750,8 @@ int __init sgivwfb_setup(char *options)
/* /*
* Initialisation * Initialisation
*/ */
static int __init sgivwfb_probe(struct device *device) static int __init sgivwfb_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(device);
struct sgivw_par *par; struct sgivw_par *par;
struct fb_info *info; struct fb_info *info;
char *monitor; char *monitor;
@ -813,7 +812,7 @@ static int __init sgivwfb_probe(struct device *device)
goto fail_register_framebuffer; goto fail_register_framebuffer;
} }
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
printk(KERN_INFO "fb%d: SGI DBE frame buffer device, using %ldK of video memory at %#lx\n", 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); info->node, sgivwfb_mem_size >> 10, sgivwfb_mem_phys);
@ -831,9 +830,9 @@ fail_ioremap_regs:
return -ENXIO; return -ENXIO;
} }
static int sgivwfb_remove(struct device *device) static int sgivwfb_remove(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(device); struct fb_info *info = platform_get_drvdata(dev);
if (info) { if (info) {
struct sgivw_par *par = info->par; struct sgivw_par *par = info->par;
@ -847,11 +846,12 @@ static int sgivwfb_remove(struct device *device)
return 0; return 0;
} }
static struct device_driver sgivwfb_driver = { static struct platform_driver sgivwfb_driver = {
.name = "sgivwfb",
.bus = &platform_bus_type,
.probe = sgivwfb_probe, .probe = sgivwfb_probe,
.remove = sgivwfb_remove, .remove = sgivwfb_remove,
.driver = {
.name = "sgivwfb",
},
}; };
static struct platform_device *sgivwfb_device; static struct platform_device *sgivwfb_device;
@ -867,7 +867,7 @@ int __init sgivwfb_init(void)
return -ENODEV; return -ENODEV;
sgivwfb_setup(option); sgivwfb_setup(option);
#endif #endif
ret = driver_register(&sgivwfb_driver); ret = platform_driver_register(&sgivwfb_driver);
if (!ret) { if (!ret) {
sgivwfb_device = platform_device_alloc("sgivwfb", 0); sgivwfb_device = platform_device_alloc("sgivwfb", 0);
if (sgivwfb_device) { if (sgivwfb_device) {
@ -875,7 +875,7 @@ int __init sgivwfb_init(void)
} else } else
ret = -ENOMEM; ret = -ENOMEM;
if (ret) { if (ret) {
driver_unregister(&sgivwfb_driver); platform_driver_unregister(&sgivwfb_driver);
platform_device_put(sgivwfb_device); platform_device_put(sgivwfb_device);
} }
} }
@ -890,7 +890,7 @@ MODULE_LICENSE("GPL");
static void __exit sgivwfb_exit(void) static void __exit sgivwfb_exit(void)
{ {
platform_device_unregister(sgivwfb_device); platform_device_unregister(sgivwfb_device);
driver_unregister(&sgivwfb_driver); platform_driver_unregister(&sgivwfb_driver);
} }
module_exit(sgivwfb_exit); module_exit(sgivwfb_exit);

View File

@ -245,9 +245,8 @@ static int __init vesafb_setup(char *options)
return 0; return 0;
} }
static int __init vesafb_probe(struct device *device) static int __init vesafb_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(device);
struct fb_info *info; struct fb_info *info;
int i, err; int i, err;
unsigned int size_vmode; unsigned int size_vmode;
@ -480,10 +479,11 @@ err:
return err; return err;
} }
static struct device_driver vesafb_driver = { static struct platform_driver vesafb_driver = {
.name = "vesafb",
.bus = &platform_bus_type,
.probe = vesafb_probe, .probe = vesafb_probe,
.driver = {
.name = "vesafb",
},
}; };
static struct platform_device vesafb_device = { static struct platform_device vesafb_device = {
@ -498,12 +498,12 @@ static int __init vesafb_init(void)
/* ignore error return of fb_get_options */ /* ignore error return of fb_get_options */
fb_get_options("vesafb", &option); fb_get_options("vesafb", &option);
vesafb_setup(option); vesafb_setup(option);
ret = driver_register(&vesafb_driver); ret = platform_driver_register(&vesafb_driver);
if (!ret) { if (!ret) {
ret = platform_device_register(&vesafb_device); ret = platform_device_register(&vesafb_device);
if (ret) if (ret)
driver_unregister(&vesafb_driver); platform_driver_unregister(&vesafb_driver);
} }
return ret; return ret;
} }

View File

@ -403,9 +403,8 @@ static void vfb_platform_release(struct device *device)
// This is called when the reference count goes to zero. // This is called when the reference count goes to zero.
} }
static int __init vfb_probe(struct device *device) static int __init vfb_probe(struct platform_device *dev)
{ {
struct platform_device *dev = to_platform_device(device);
struct fb_info *info; struct fb_info *info;
int retval = -ENOMEM; int retval = -ENOMEM;
@ -447,7 +446,7 @@ static int __init vfb_probe(struct device *device)
retval = register_framebuffer(info); retval = register_framebuffer(info);
if (retval < 0) if (retval < 0)
goto err2; goto err2;
dev_set_drvdata(&dev->dev, info); platform_set_drvdata(dev, info);
printk(KERN_INFO printk(KERN_INFO
"fb%d: Virtual frame buffer device, using %ldK of video memory\n", "fb%d: Virtual frame buffer device, using %ldK of video memory\n",
@ -462,9 +461,9 @@ err:
return retval; return retval;
} }
static int vfb_remove(struct device *device) static int vfb_remove(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(device); struct fb_info *info = platform_get_drvdata(dev);
if (info) { if (info) {
unregister_framebuffer(info); unregister_framebuffer(info);
@ -474,11 +473,12 @@ static int vfb_remove(struct device *device)
return 0; return 0;
} }
static struct device_driver vfb_driver = { static struct platform_driver vfb_driver = {
.name = "vfb",
.bus = &platform_bus_type,
.probe = vfb_probe, .probe = vfb_probe,
.remove = vfb_remove, .remove = vfb_remove,
.driver = {
.name = "vfb",
},
}; };
static struct platform_device vfb_device = { static struct platform_device vfb_device = {
@ -504,12 +504,12 @@ static int __init vfb_init(void)
if (!vfb_enable) if (!vfb_enable)
return -ENXIO; return -ENXIO;
ret = driver_register(&vfb_driver); ret = platform_driver_register(&vfb_driver);
if (!ret) { if (!ret) {
ret = platform_device_register(&vfb_device); ret = platform_device_register(&vfb_device);
if (ret) if (ret)
driver_unregister(&vfb_driver); platform_driver_unregister(&vfb_driver);
} }
return ret; return ret;
} }
@ -520,7 +520,7 @@ module_init(vfb_init);
static void __exit vfb_exit(void) static void __exit vfb_exit(void)
{ {
platform_device_unregister(&vfb_device); platform_device_unregister(&vfb_device);
driver_unregister(&vfb_driver); platform_driver_unregister(&vfb_driver);
} }
module_exit(vfb_exit); module_exit(vfb_exit);

View File

@ -437,9 +437,9 @@ static void w100fb_restore_vidmem(struct w100fb_par *par)
} }
} }
static int w100fb_suspend(struct device *dev, pm_message_t state) static int w100fb_suspend(struct platform_device *dev, pm_message_t state)
{ {
struct fb_info *info = dev_get_drvdata(dev); struct fb_info *info = platform_get_drvdata(dev);
struct w100fb_par *par=info->par; struct w100fb_par *par=info->par;
struct w100_tg_info *tg = par->mach->tg; struct w100_tg_info *tg = par->mach->tg;
@ -452,9 +452,9 @@ static int w100fb_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int w100fb_resume(struct device *dev) static int w100fb_resume(struct platform_device *dev)
{ {
struct fb_info *info = dev_get_drvdata(dev); struct fb_info *info = platform_get_drvdata(dev);
struct w100fb_par *par=info->par; struct w100fb_par *par=info->par;
struct w100_tg_info *tg = par->mach->tg; struct w100_tg_info *tg = par->mach->tg;
@ -473,13 +473,12 @@ static int w100fb_resume(struct device *dev)
#endif #endif
int __init w100fb_probe(struct device *dev) int __init w100fb_probe(struct platform_device *pdev)
{ {
int err = -EIO; int err = -EIO;
struct w100fb_mach_info *inf; struct w100fb_mach_info *inf;
struct fb_info *info = NULL; struct fb_info *info = NULL;
struct w100fb_par *par; struct w100fb_par *par;
struct platform_device *pdev = to_platform_device(dev);
struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
unsigned int chip_id; unsigned int chip_id;
@ -522,9 +521,9 @@ int __init w100fb_probe(struct device *dev)
} }
par = info->par; par = info->par;
dev_set_drvdata(dev, info); platform_set_drvdata(pdev, info);
inf = dev->platform_data; inf = pdev->dev.platform_data;
par->chip_id = chip_id; par->chip_id = chip_id;
par->mach = inf; par->mach = inf;
par->fastpll_mode = 0; par->fastpll_mode = 0;
@ -600,10 +599,10 @@ int __init w100fb_probe(struct device *dev)
goto out; goto out;
} }
device_create_file(dev, &dev_attr_fastpllclk); device_create_file(&pdev->dev, &dev_attr_fastpllclk);
device_create_file(dev, &dev_attr_reg_read); device_create_file(&pdev->dev, &dev_attr_reg_read);
device_create_file(dev, &dev_attr_reg_write); device_create_file(&pdev->dev, &dev_attr_reg_write);
device_create_file(dev, &dev_attr_flip); device_create_file(&pdev->dev, &dev_attr_flip);
printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
return 0; return 0;
@ -622,15 +621,15 @@ out:
} }
static int w100fb_remove(struct device *dev) static int w100fb_remove(struct platform_device *pdev)
{ {
struct fb_info *info = dev_get_drvdata(dev); struct fb_info *info = platform_get_drvdata(pdev);
struct w100fb_par *par=info->par; struct w100fb_par *par=info->par;
device_remove_file(dev, &dev_attr_fastpllclk); device_remove_file(&pdev->dev, &dev_attr_fastpllclk);
device_remove_file(dev, &dev_attr_reg_read); device_remove_file(&pdev->dev, &dev_attr_reg_read);
device_remove_file(dev, &dev_attr_reg_write); device_remove_file(&pdev->dev, &dev_attr_reg_write);
device_remove_file(dev, &dev_attr_flip); device_remove_file(&pdev->dev, &dev_attr_flip);
unregister_framebuffer(info); unregister_framebuffer(info);
@ -1448,23 +1447,24 @@ static void w100_vsync(void)
writel(0x00000002, remapped_regs + mmGEN_INT_STATUS); writel(0x00000002, remapped_regs + mmGEN_INT_STATUS);
} }
static struct device_driver w100fb_driver = { static struct platform_driver w100fb_driver = {
.name = "w100fb",
.bus = &platform_bus_type,
.probe = w100fb_probe, .probe = w100fb_probe,
.remove = w100fb_remove, .remove = w100fb_remove,
.suspend = w100fb_suspend, .suspend = w100fb_suspend,
.resume = w100fb_resume, .resume = w100fb_resume,
.driver = {
.name = "w100fb",
},
}; };
int __devinit w100fb_init(void) int __devinit w100fb_init(void)
{ {
return driver_register(&w100fb_driver); return platform_driver_register(&w100fb_driver);
} }
void __exit w100fb_cleanup(void) void __exit w100fb_cleanup(void)
{ {
driver_unregister(&w100fb_driver); platform_driver_unregister(&w100fb_driver);
} }
module_init(w100fb_init); module_init(w100fb_init);

View File

@ -275,9 +275,9 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card)
return 0; return 0;
} }
static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state) static int pxa2xx_ac97_suspend(struct platform_device *dev, pm_message_t state)
{ {
snd_card_t *card = dev_get_drvdata(_dev); snd_card_t *card = platform_get_drvdata(dev);
int ret = 0; int ret = 0;
if (card) if (card)
@ -286,9 +286,9 @@ static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state)
return ret; return ret;
} }
static int pxa2xx_ac97_resume(struct device *_dev) static int pxa2xx_ac97_resume(struct platform_device *dev)
{ {
snd_card_t *card = dev_get_drvdata(_dev); snd_card_t *card = platform_get_drvdata(dev);
int ret = 0; int ret = 0;
if (card) if (card)
@ -302,7 +302,7 @@ static int pxa2xx_ac97_resume(struct device *_dev)
#define pxa2xx_ac97_resume NULL #define pxa2xx_ac97_resume NULL
#endif #endif
static int pxa2xx_ac97_probe(struct device *dev) static int pxa2xx_ac97_probe(struct platform_device *dev)
{ {
snd_card_t *card; snd_card_t *card;
ac97_bus_t *ac97_bus; ac97_bus_t *ac97_bus;
@ -315,8 +315,8 @@ static int pxa2xx_ac97_probe(struct device *dev)
if (!card) if (!card)
goto err; goto err;
card->dev = dev; card->dev = &dev->dev;
strncpy(card->driver, dev->driver->name, sizeof(card->driver)); strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
if (ret) if (ret)
@ -347,13 +347,13 @@ static int pxa2xx_ac97_probe(struct device *dev)
snprintf(card->shortname, sizeof(card->shortname), snprintf(card->shortname, sizeof(card->shortname),
"%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97)); "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
snprintf(card->longname, sizeof(card->longname), snprintf(card->longname, sizeof(card->longname),
"%s (%s)", dev->driver->name, card->mixername); "%s (%s)", dev->dev.driver->name, card->mixername);
snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend, snd_card_set_pm_callback(card, pxa2xx_ac97_do_suspend,
pxa2xx_ac97_do_resume, NULL); pxa2xx_ac97_do_resume, NULL);
ret = snd_card_register(card); ret = snd_card_register(card);
if (ret == 0) { if (ret == 0) {
dev_set_drvdata(dev, card); platform_set_drvdata(dev, card);
return 0; return 0;
} }
@ -368,13 +368,13 @@ static int pxa2xx_ac97_probe(struct device *dev)
return ret; return ret;
} }
static int pxa2xx_ac97_remove(struct device *dev) static int pxa2xx_ac97_remove(struct platform_device *dev)
{ {
snd_card_t *card = dev_get_drvdata(dev); snd_card_t *card = platform_get_drvdata(dev);
if (card) { if (card) {
snd_card_free(card); snd_card_free(card);
dev_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
GCR |= GCR_ACLINK_OFF; GCR |= GCR_ACLINK_OFF;
free_irq(IRQ_AC97, NULL); free_irq(IRQ_AC97, NULL);
pxa_set_cken(CKEN2_AC97, 0); pxa_set_cken(CKEN2_AC97, 0);
@ -383,23 +383,24 @@ static int pxa2xx_ac97_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver pxa2xx_ac97_driver = { static struct platform_driver pxa2xx_ac97_driver = {
.name = "pxa2xx-ac97",
.bus = &platform_bus_type,
.probe = pxa2xx_ac97_probe, .probe = pxa2xx_ac97_probe,
.remove = pxa2xx_ac97_remove, .remove = pxa2xx_ac97_remove,
.suspend = pxa2xx_ac97_suspend, .suspend = pxa2xx_ac97_suspend,
.resume = pxa2xx_ac97_resume, .resume = pxa2xx_ac97_resume,
.driver = {
.name = "pxa2xx-ac97",
},
}; };
static int __init pxa2xx_ac97_init(void) static int __init pxa2xx_ac97_init(void)
{ {
return driver_register(&pxa2xx_ac97_driver); return platform_driver_register(&pxa2xx_ac97_driver);
} }
static void __exit pxa2xx_ac97_exit(void) static void __exit pxa2xx_ac97_exit(void)
{ {
driver_unregister(&pxa2xx_ac97_driver); platform_driver_unregister(&pxa2xx_ac97_driver);
} }
module_init(pxa2xx_ac97_init); module_init(pxa2xx_ac97_init);

View File

@ -674,23 +674,24 @@ struct snd_generic_device {
snd_card_t *card; snd_card_t *card;
}; };
#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card #define get_snd_generic_card(dev) container_of(dev, struct snd_generic_device, pdev)->card
#define SND_GENERIC_NAME "snd_generic" #define SND_GENERIC_NAME "snd_generic"
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int snd_generic_suspend(struct device *dev, pm_message_t state); static int snd_generic_suspend(struct platform_device *dev, pm_message_t state);
static int snd_generic_resume(struct device *dev); static int snd_generic_resume(struct platform_device *dev);
#endif #endif
/* initialized in sound.c */ /* initialized in sound.c */
struct device_driver snd_generic_driver = { struct platform_driver snd_generic_driver = {
.name = SND_GENERIC_NAME,
.bus = &platform_bus_type,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = snd_generic_suspend, .suspend = snd_generic_suspend,
.resume = snd_generic_resume, .resume = snd_generic_resume,
#endif #endif
.driver = {
.name = SND_GENERIC_NAME,
},
}; };
void snd_generic_device_release(struct device *dev) void snd_generic_device_release(struct device *dev)
@ -821,7 +822,7 @@ int snd_card_set_pm_callback(snd_card_t *card,
#ifdef CONFIG_SND_GENERIC_DRIVER #ifdef CONFIG_SND_GENERIC_DRIVER
/* suspend/resume callbacks for snd_generic platform device */ /* suspend/resume callbacks for snd_generic platform device */
static int snd_generic_suspend(struct device *dev, pm_message_t state) static int snd_generic_suspend(struct platform_device *dev, pm_message_t state)
{ {
snd_card_t *card; snd_card_t *card;
@ -834,7 +835,7 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int snd_generic_resume(struct device *dev) static int snd_generic_resume(struct platform_device *dev)
{ {
snd_card_t *card; snd_card_t *card;

View File

@ -32,7 +32,7 @@
#include <sound/initval.h> #include <sound/initval.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/device.h> #include <linux/platform_device.h>
#define SNDRV_OS_MINORS 256 #define SNDRV_OS_MINORS 256
@ -329,7 +329,7 @@ int __exit snd_minor_info_done(void)
*/ */
#ifdef CONFIG_SND_GENERIC_DRIVER #ifdef CONFIG_SND_GENERIC_DRIVER
extern struct device_driver snd_generic_driver; extern struct platform_driver snd_generic_driver;
#endif #endif
static int __init alsa_sound_init(void) static int __init alsa_sound_init(void)
@ -357,7 +357,7 @@ static int __init alsa_sound_init(void)
} }
snd_info_minor_register(); snd_info_minor_register();
#ifdef CONFIG_SND_GENERIC_DRIVER #ifdef CONFIG_SND_GENERIC_DRIVER
driver_register(&snd_generic_driver); platform_driver_register(&snd_generic_driver);
#endif #endif
for (controlnum = 0; controlnum < cards_limit; controlnum++) for (controlnum = 0; controlnum < cards_limit; controlnum++)
devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", 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); devfs_remove("snd/controlC%d", controlnum);
#ifdef CONFIG_SND_GENERIC_DRIVER #ifdef CONFIG_SND_GENERIC_DRIVER
driver_unregister(&snd_generic_driver); platform_driver_unregister(&snd_generic_driver);
#endif #endif
snd_info_minor_unregister(); snd_info_minor_unregister();
snd_info_done(); snd_info_done();