提交 3ae5eaec 编写于 作者: R Russell King 提交者: Russell King

[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: NRussell King <rmk+kernel@arm.linux.org.uk>
Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 00d3dcdd
无相关合并请求
......@@ -550,9 +550,9 @@ struct locomo_save_data {
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;
unsigned long flags;
......@@ -560,7 +560,7 @@ static int locomo_suspend(struct device *dev, pm_message_t state)
if (!save)
return -ENOMEM;
dev->power.saved_state = (void *) save;
dev->dev.power.saved_state = (void *) save;
spin_lock_irqsave(&lchip->lock, flags);
......@@ -594,14 +594,14 @@ static int locomo_suspend(struct device *dev, pm_message_t state)
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;
unsigned long r;
unsigned long flags;
save = (struct locomo_save_data *) dev->power.saved_state;
save = (struct locomo_save_data *) dev->dev.power.saved_state;
if (!save)
return 0;
......@@ -760,27 +760,26 @@ static void __locomo_remove(struct locomo *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;
int irq;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!mem)
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) {
__locomo_remove(lchip);
dev_set_drvdata(dev, NULL);
platform_set_drvdata(dev, NULL);
}
return 0;
......@@ -792,15 +791,16 @@ static int locomo_remove(struct device *dev)
* the per-machine level, and then have this driver pick
* up the registered devices.
*/
static struct device_driver locomo_device_driver = {
.name = "locomo",
.bus = &platform_bus_type,
static struct platform_driver locomo_device_driver = {
.probe = locomo_probe,
.remove = locomo_remove,
#ifdef CONFIG_PM
.suspend = locomo_suspend,
.resume = locomo_resume,
#endif
.driver = {
.name = "locomo",
},
};
/*
......@@ -1126,13 +1126,13 @@ static int __init locomo_init(void)
{
int ret = bus_register(&locomo_bus_type);
if (ret == 0)
driver_register(&locomo_device_driver);
platform_driver_register(&locomo_device_driver);
return ret;
}
static void __exit locomo_exit(void)
{
driver_unregister(&locomo_device_driver);
platform_driver_unregister(&locomo_device_driver);
bus_unregister(&locomo_bus_type);
}
......
......@@ -801,9 +801,9 @@ struct sa1111_save_data {
#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;
unsigned long flags;
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);
if (!save)
return -ENOMEM;
dev->power.saved_state = save;
dev->dev.power.saved_state = save;
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
* 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;
unsigned long flags, id;
void __iomem *base;
save = (struct sa1111_save_data *)dev->power.saved_state;
save = (struct sa1111_save_data *)dev->dev.power.saved_state;
if (!save)
return 0;
......@@ -879,7 +879,7 @@ static int sa1111_resume(struct device *dev)
id = sa1111_readl(sachip->base + SA1111_SKID);
if ((id & SKID_ID_MASK) != SKID_SA1111_ID) {
__sa1111_remove(sachip);
dev_set_drvdata(dev, NULL);
platform_set_drvdata(dev, NULL);
kfree(save);
return 0;
}
......@@ -911,7 +911,7 @@ static int sa1111_resume(struct device *dev)
spin_unlock_irqrestore(&sachip->lock, flags);
dev->power.saved_state = NULL;
dev->dev.power.saved_state = NULL;
kfree(save);
return 0;
......@@ -922,9 +922,8 @@ static int sa1111_resume(struct device *dev)
#define sa1111_resume NULL
#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;
int irq;
......@@ -933,20 +932,20 @@ static int sa1111_probe(struct device *dev)
return -EINVAL;
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) {
__sa1111_remove(sachip);
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
#ifdef CONFIG_PM
kfree(dev->power.saved_state);
dev->power.saved_state = NULL;
kfree(pdev->dev.power.saved_state);
pdev->dev.power.saved_state = NULL;
#endif
}
......@@ -962,13 +961,14 @@ static int sa1111_remove(struct device *dev)
* We also need to handle the SDRAM configuration for
* PXA250/SA1110 machine classes.
*/
static struct device_driver sa1111_device_driver = {
.name = "sa1111",
.bus = &platform_bus_type,
static struct platform_driver sa1111_device_driver = {
.probe = sa1111_probe,
.remove = sa1111_remove,
.suspend = sa1111_suspend,
.resume = sa1111_resume,
.driver = {
.name = "sa1111",
},
};
/*
......@@ -1256,13 +1256,13 @@ static int __init sa1111_init(void)
{
int ret = bus_register(&sa1111_bus_type);
if (ret == 0)
driver_register(&sa1111_device_driver);
platform_driver_register(&sa1111_device_driver);
return ret;
}
static void __exit sa1111_exit(void)
{
driver_unregister(&sa1111_device_driver);
platform_driver_unregister(&sa1111_device_driver);
bus_unregister(&sa1111_bus_type);
}
......
......@@ -98,9 +98,9 @@ static void check_scoop_reg(struct scoop_dev *sdev)
}
#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);
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;
}
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);
SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
......@@ -123,11 +123,10 @@ static int scoop_resume(struct device *dev)
#define scoop_resume NULL
#endif
int __init scoop_probe(struct device *dev)
int __init scoop_probe(struct platform_device *pdev)
{
struct scoop_dev *devptr;
struct scoop_config *inf;
struct platform_device *pdev = to_platform_device(dev);
struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem)
......@@ -141,7 +140,7 @@ int __init scoop_probe(struct device *dev)
memset(devptr, 0, sizeof(struct scoop_dev));
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);
if (!devptr->base) {
......@@ -149,7 +148,7 @@ int __init scoop_probe(struct device *dev)
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);
......@@ -164,29 +163,30 @@ int __init scoop_probe(struct device *dev)
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) {
iounmap(sdev->base);
kfree(sdev);
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
}
return 0;
}
static struct device_driver scoop_driver = {
.name = "sharp-scoop",
.bus = &platform_bus_type,
static struct platform_driver scoop_driver = {
.probe = scoop_probe,
.remove = scoop_remove,
.suspend = scoop_suspend,
.resume = scoop_resume,
.driver = {
.name = "sharp-scoop",
},
};
int __init scoop_init(void)
{
return driver_register(&scoop_driver);
return platform_driver_register(&scoop_driver);
}
subsys_initcall(scoop_init);
......@@ -191,7 +191,7 @@ void __init corgi_ssp_set_machinfo(struct corgissp_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;
......@@ -216,13 +216,13 @@ static int __init corgi_ssp_probe(struct device *dev)
return ret;
}
static int corgi_ssp_remove(struct device *dev)
static int corgi_ssp_remove(struct platform_device *dev)
{
ssp_exit(&corgi_ssp_dev);
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_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;
}
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_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/
......@@ -241,18 +241,19 @@ static int corgi_ssp_resume(struct device *dev)
return 0;
}
static struct device_driver corgissp_driver = {
.name = "corgi-ssp",
.bus = &platform_bus_type,
static struct platform_driver corgissp_driver = {
.probe = corgi_ssp_probe,
.remove = corgi_ssp_remove,
.suspend = corgi_ssp_suspend,
.resume = corgi_ssp_resume,
.driver = {
.name = "corgi-ssp",
},
};
int __init corgi_ssp_init(void)
{
return driver_register(&corgissp_driver);
return platform_driver_register(&corgissp_driver);
}
arch_initcall(corgi_ssp_init);
......@@ -137,7 +137,7 @@ static struct sa1100_port_fns neponset_port_fns __initdata = {
.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);
......@@ -178,27 +178,27 @@ static int neponset_probe(struct device *dev)
/*
* 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.
*/
if (!dev->power.saved_state)
dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->power.saved_state)
if (!dev->dev.power.saved_state)
dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->dev.power.saved_state)
return -ENOMEM;
*(unsigned int *)dev->power.saved_state = NCR_0;
*(unsigned int *)dev->dev.power.saved_state = NCR_0;
return 0;
}
static int neponset_resume(struct device *dev)
static int neponset_resume(struct platform_device *dev)
{
if (dev->power.saved_state) {
NCR_0 = *(unsigned int *)dev->power.saved_state;
kfree(dev->power.saved_state);
dev->power.saved_state = NULL;
if (dev->dev.power.saved_state) {
NCR_0 = *(unsigned int *)dev->dev.power.saved_state;
kfree(dev->dev.power.saved_state);
dev->dev.power.saved_state = NULL;
}
return 0;
......@@ -209,12 +209,13 @@ static int neponset_resume(struct device *dev)
#define neponset_resume NULL
#endif
static struct device_driver neponset_device_driver = {
.name = "neponset",
.bus = &platform_bus_type,
static struct platform_driver neponset_device_driver = {
.probe = neponset_probe,
.suspend = neponset_suspend,
.resume = neponset_resume,
.driver = {
.name = "neponset",
},
};
static struct resource neponset_resources[] = {
......@@ -293,7 +294,7 @@ static struct platform_device *devices[] __initdata = {
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.
......
......@@ -284,9 +284,10 @@ void uml_net_user_timer_expire(unsigned long _conn)
static DEFINE_SPINLOCK(devices_lock);
static struct list_head devices = LIST_HEAD_INIT(devices);
static struct device_driver uml_net_driver = {
.name = DRIVER_NAME,
.bus = &platform_bus_type,
static struct platform_driver uml_net_driver = {
.driver = {
.name = DRIVER_NAME,
},
};
static int driver_registered;
......@@ -333,7 +334,7 @@ static int eth_configure(int n, void *init, char *mac,
/* sysfs register */
if (!driver_registered) {
driver_register(&uml_net_driver);
platform_driver_register(&uml_net_driver);
driver_registered = 1;
}
device->pdev.id = n;
......
......@@ -823,9 +823,10 @@ static int ubd_mc_init(void)
__initcall(ubd_mc_init);
static struct device_driver ubd_driver = {
.name = DRIVER_NAME,
.bus = &platform_bus_type,
static struct platform_driver ubd_driver = {
.driver = {
.name = DRIVER_NAME,
},
};
int ubd_init(void)
......@@ -850,7 +851,7 @@ int ubd_init(void)
if (register_blkdev(fake_major, "ubd"))
return -1;
}
driver_register(&ubd_driver);
platform_driver_register(&ubd_driver);
for (i = 0; i < MAX_DEV; i++)
ubd_add(i);
return 0;
......
......@@ -648,9 +648,10 @@ void iss_net_user_timer_expire(unsigned long _conn)
}
static struct device_driver iss_net_driver = {
.name = DRIVER_NAME,
.bus = &platform_bus_type,
static struct platform_driver iss_net_driver = {
.driver = {
.name = DRIVER_NAME,
},
};
static int driver_registered;
......@@ -701,7 +702,7 @@ static int iss_net_configure(int index, char *init)
/* sysfs register */
if (!driver_registered) {
driver_register(&iss_net_driver);
platform_driver_register(&iss_net_driver);
driver_registered = 1;
}
......
......@@ -382,7 +382,7 @@ static struct rtc_ops s3c2410_rtcops = {
.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;
......@@ -399,21 +399,21 @@ static void s3c2410_rtc_enable(struct device *dev, int en)
/* re-enable the device, and check it is ok */
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);
writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON);
}
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);
writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON);
}
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);
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);
......@@ -438,25 +438,24 @@ static int s3c2410_rtc_remove(struct device *dev)
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;
int ret;
pr_debug("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev);
pr_debug("%s: probe=%p\n", __FUNCTION__, pdev);
/* find the IRQs */
s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
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;
}
s3c2410_rtc_alarmno = platform_get_irq(pdev, 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;
}
......@@ -467,7 +466,7 @@ static int s3c2410_rtc_probe(struct device *dev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
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;
}
......@@ -475,14 +474,14 @@ static int s3c2410_rtc_probe(struct device *dev)
pdev->name);
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;
goto exit_err;
}
s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1);
if (s3c2410_rtc_base == NULL) {
dev_err(dev, "failed ioremap()\n");
dev_err(&pdev->dev, "failed ioremap()\n");
ret = -EINVAL;
goto exit_err;
}
......@@ -494,7 +493,7 @@ static int s3c2410_rtc_probe(struct device *dev)
/* 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));
......@@ -506,7 +505,7 @@ static int s3c2410_rtc_probe(struct device *dev)
return 0;
exit_err:
dev_err(dev, "error %d during initialisation\n", ret);
dev_err(&pdev->dev, "error %d during initialisation\n", ret);
return ret;
}
......@@ -519,7 +518,7 @@ static struct timespec s3c2410_rtc_delta;
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 timespec time;
......@@ -535,19 +534,19 @@ static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state)
s3c2410_rtc_gettime(&tm);
rtc_tm_to_time(&tm, &time.tv_sec);
save_time_delta(&s3c2410_rtc_delta, &time);
s3c2410_rtc_enable(dev, 0);
s3c2410_rtc_enable(pdev, 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 timespec time;
time.tv_nsec = 0;
s3c2410_rtc_enable(dev, 1);
s3c2410_rtc_enable(pdev, 1);
s3c2410_rtc_gettime(&tm);
rtc_tm_to_time(&tm, &time.tv_sec);
restore_time_delta(&s3c2410_rtc_delta, &time);
......@@ -560,14 +559,15 @@ static int s3c2410_rtc_resume(struct device *dev)
#define s3c2410_rtc_resume NULL
#endif
static struct device_driver s3c2410_rtcdrv = {
.name = "s3c2410-rtc",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver s3c2410_rtcdrv = {
.probe = s3c2410_rtc_probe,
.remove = s3c2410_rtc_remove,
.suspend = s3c2410_rtc_suspend,
.resume = s3c2410_rtc_resume,
.driver = {
.name = "s3c2410-rtc",
.owner = THIS_MODULE,
},
};
static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n";
......@@ -575,12 +575,12 @@ static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n";
static int __init s3c2410_rtc_init(void)
{
printk(banner);
return driver_register(&s3c2410_rtcdrv);
return platform_driver_register(&s3c2410_rtcdrv);
}
static void __exit s3c2410_rtc_exit(void)
{
driver_unregister(&s3c2410_rtcdrv);
platform_driver_unregister(&s3c2410_rtcdrv);
}
module_init(s3c2410_rtc_init);
......
......@@ -1168,7 +1168,7 @@ static int sonypi_disable(void)
#ifdef CONFIG_PM
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;
sonypi_disable();
......@@ -1176,26 +1176,27 @@ static int sonypi_suspend(struct device *dev, pm_message_t state)
return 0;
}
static int sonypi_resume(struct device *dev)
static int sonypi_resume(struct platform_device *dev)
{
sonypi_enable(old_camera_power);
return 0;
}
#endif
static void sonypi_shutdown(struct device *dev)
static void sonypi_shutdown(struct platform_device *dev)
{
sonypi_disable();
}
static struct device_driver sonypi_driver = {
.name = "sonypi",
.bus = &platform_bus_type,
static struct platform_driver sonypi_driver = {
#ifdef CONFIG_PM
.suspend = sonypi_suspend,
.resume = sonypi_resume,
#endif
.shutdown = sonypi_shutdown,
.driver = {
.name = "sonypi",
},
};
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))
return -ENODEV;
ret = driver_register(&sonypi_driver);
ret = platform_driver_register(&sonypi_driver);
if (ret)
return ret;
ret = sonypi_probe();
if (ret)
driver_unregister(&sonypi_driver);
platform_driver_unregister(&sonypi_driver);
return ret;
}
static void __exit sonypi_exit(void)
{
driver_unregister(&sonypi_driver);
platform_driver_unregister(&sonypi_driver);
sonypi_remove();
}
......
......@@ -283,7 +283,7 @@ static void tb0219_pci_irq_init(void)
vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW);
}
static int tb0219_probe(struct device *dev)
static int tb0219_probe(struct platform_device *dev)
{
int retval;
......@@ -319,7 +319,7 @@ static int tb0219_probe(struct device *dev)
return 0;
}
static int tb0219_remove(struct device *dev)
static int tb0219_remove(struct platform_device *dev)
{
_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 device_driver tb0219_device_driver = {
.name = "TB0219",
.bus = &platform_bus_type,
static struct platform_driver tb0219_device_driver = {
.probe = tb0219_probe,
.remove = tb0219_remove,
.driver = {
.name = "TB0219",
},
};
static int __devinit tanbac_tb0219_init(void)
......@@ -348,7 +349,7 @@ static int __devinit tanbac_tb0219_init(void)
if (IS_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)
platform_device_unregister(tb0219_platform_device);
......@@ -357,7 +358,7 @@ static int __devinit tanbac_tb0219_init(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);
}
......
......@@ -613,7 +613,7 @@ static struct file_operations gpio_fops = {
.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 int nr_pins = 0;
......@@ -697,7 +697,7 @@ static int giu_probe(struct device *dev)
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);
......@@ -710,11 +710,12 @@ static int giu_remove(struct device *dev)
static struct platform_device *giu_platform_device;
static struct device_driver giu_device_driver = {
.name = "GIU",
.bus = &platform_bus_type,
static struct platform_driver giu_device_driver = {
.probe = giu_probe,
.remove = giu_remove,
.driver = {
.name = "GIU",
},
};
static int __devinit vr41xx_giu_init(void)
......@@ -725,7 +726,7 @@ static int __devinit vr41xx_giu_init(void)
if (IS_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)
platform_device_unregister(giu_platform_device);
......@@ -734,7 +735,7 @@ static int __devinit vr41xx_giu_init(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);
}
......
......@@ -560,13 +560,11 @@ static struct miscdevice rtc_miscdevice = {
.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;
int retval;
pdev = to_platform_device(dev);
if (pdev->num_resources != 2)
return -EBUSY;
......@@ -635,7 +633,7 @@ static int rtc_probe(struct device *dev)
return 0;
}
static int rtc_remove(struct device *dev)
static int rtc_remove(struct platform_device *dev)
{
int retval;
......@@ -655,11 +653,12 @@ static int rtc_remove(struct device *dev)
static struct platform_device *rtc_platform_device;
static struct device_driver rtc_device_driver = {
.name = rtc_name,
.bus = &platform_bus_type,
static struct platform_driver rtc_device_driver = {
.probe = rtc_probe,
.remove = rtc_remove,
.driver = {
.name = rtc_name,
},
};
static int __devinit vr41xx_rtc_init(void)
......@@ -691,7 +690,7 @@ static int __devinit vr41xx_rtc_init(void)
if (IS_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)
platform_device_unregister(rtc_platform_device);
......@@ -700,7 +699,7 @@ static int __devinit vr41xx_rtc_init(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);
}
......
......@@ -139,7 +139,7 @@ static int mpcore_wdt_set_heartbeat(int t)
*/
static int mpcore_wdt_open(struct inode *inode, struct file *file)
{
struct mpcore_wdt *wdt = 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))
return -EBUSY;
......@@ -291,9 +291,9 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
* System shutdown handler. Turn off the watchdog if we're
* restarting or halting the system.
*/
static void mpcore_wdt_shutdown(struct 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)
mpcore_wdt_stop(wdt);
......@@ -317,9 +317,8 @@ static struct miscdevice mpcore_wdt_miscdev = {
.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 resource *res;
int ret;
......@@ -364,7 +363,7 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
}
mpcore_wdt_stop(wdt);
dev_set_drvdata(&dev->dev, wdt);
platform_set_drvdata(&dev->dev, wdt);
mpcore_wdt_dev = dev;
return 0;
......@@ -379,11 +378,11 @@ static int __devinit mpcore_wdt_probe(struct device *_dev)
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);
......@@ -395,13 +394,14 @@ static int __devexit mpcore_wdt_remove(struct device *dev)
return 0;
}
static struct device_driver mpcore_wdt_driver = {
.owner = THIS_MODULE,
.name = "mpcore_wdt",
.bus = &platform_bus_type,
static struct platform_driver mpcore_wdt_driver = {
.probe = mpcore_wdt_probe,
.remove = __devexit_p(mpcore_wdt_remove),
.shutdown = mpcore_wdt_shutdown,
.driver = {
.owner = THIS_MODULE,
.name = "mpcore_wdt",
},
};
static char banner[] __initdata = KERN_INFO "MPcore Watchdog Timer: 0.1. mpcore_noboot=%d mpcore_margin=%d sec (nowayout= %d)\n";
......@@ -420,12 +420,12 @@ static int __init mpcore_wdt_init(void)
printk(banner, mpcore_noboot, mpcore_margin, nowayout);
return driver_register(&mpcore_wdt_driver);
return platform_driver_register(&mpcore_wdt_driver);
}
static void __exit mpcore_wdt_exit(void)
{
driver_unregister(&mpcore_wdt_driver);
platform_driver_unregister(&mpcore_wdt_driver);
}
module_init(mpcore_wdt_init);
......
......@@ -182,10 +182,9 @@ static struct miscdevice mv64x60_wdt_miscdev = {
.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 = pd->dev.platform_data;
struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data;
int bus_clk = 133;
mv64x60_wdt_timeout = 10;
......@@ -202,7 +201,7 @@ static int __devinit mv64x60_wdt_probe(struct device *dev)
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);
......@@ -212,12 +211,13 @@ static int __devexit mv64x60_wdt_remove(struct device *dev)
return 0;
}
static struct device_driver mv64x60_wdt_driver = {
.owner = THIS_MODULE,
.name = MV64x60_WDT_NAME,
.bus = &platform_bus_type,
static struct platform_driver mv64x60_wdt_driver = {
.probe = mv64x60_wdt_probe,
.remove = __devexit_p(mv64x60_wdt_remove),
.driver = {
.owner = THIS_MODULE,
.name = MV64x60_WDT_NAME,
},
};
static struct platform_device *mv64x60_wdt_dev;
......@@ -235,14 +235,14 @@ static int __init mv64x60_wdt_init(void)
goto out;
}
ret = driver_register(&mv64x60_wdt_driver);
ret = platform_driver_register(&mv64x60_wdt_driver);
out:
return ret;
}
static void __exit mv64x60_wdt_exit(void)
{
driver_unregister(&mv64x60_wdt_driver);
platform_driver_unregister(&mv64x60_wdt_driver);
platform_device_unregister(mv64x60_wdt_dev);
}
......
......@@ -347,15 +347,14 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
}
/* 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;
int started = 0;
int ret;
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 */
......@@ -386,13 +385,13 @@ static int s3c2410wdt_probe(struct device *dev)
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) {
printk(KERN_INFO PFX "failed to install irq (%d)\n", ret);
return ret;
}
wdt_clock = clk_get(dev, "watchdog");
wdt_clock = clk_get(&pdev->dev, "watchdog");
if (wdt_clock == NULL) {
printk(KERN_INFO PFX "failed to find watchdog clock source\n");
return -ENOENT;
......@@ -430,7 +429,7 @@ static int s3c2410wdt_probe(struct device *dev)
return 0;
}
static int s3c2410wdt_remove(struct device *dev)
static int s3c2410wdt_remove(struct platform_device *dev)
{
if (wdt_mem != NULL) {
release_resource(wdt_mem);
......@@ -454,7 +453,7 @@ static int s3c2410wdt_remove(struct device *dev)
return 0;
}
static void s3c2410wdt_shutdown(struct device *dev)
static void s3c2410wdt_shutdown(struct platform_device *dev)
{
s3c2410wdt_stop();
}
......@@ -464,7 +463,7 @@ static void s3c2410wdt_shutdown(struct device *dev)
static unsigned long wtcon_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. */
wtcon_save = readl(wdt_base + S3C2410_WTCON);
......@@ -476,7 +475,7 @@ static int s3c2410wdt_suspend(struct device *dev, pm_message_t state)
return 0;
}
static int s3c2410wdt_resume(struct device *dev)
static int s3c2410wdt_resume(struct platform_device *dev)
{
/* Restore watchdog state. */
......@@ -496,15 +495,16 @@ static int s3c2410wdt_resume(struct device *dev)
#endif /* CONFIG_PM */
static struct device_driver s3c2410wdt_driver = {
.owner = THIS_MODULE,
.name = "s3c2410-wdt",
.bus = &platform_bus_type,
static struct platform_driver s3c2410wdt_driver = {
.probe = s3c2410wdt_probe,
.remove = s3c2410wdt_remove,
.shutdown = s3c2410wdt_shutdown,
.suspend = s3c2410wdt_suspend,
.resume = s3c2410wdt_resume,
.driver = {
.owner = THIS_MODULE,
.name = "s3c2410-wdt",
},
};
......@@ -513,12 +513,12 @@ static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Si
static int __init watchdog_init(void)
{
printk(banner);
return driver_register(&s3c2410wdt_driver);
return platform_driver_register(&s3c2410wdt_driver);
}
static void __exit watchdog_exit(void)
{
driver_unregister(&s3c2410wdt_driver);
platform_driver_unregister(&s3c2410wdt_driver);
}
module_init(watchdog_init);
......
......@@ -284,7 +284,7 @@ static int hdaps_device_init(void)
/* Device model stuff */
static int hdaps_probe(struct device *dev)
static int hdaps_probe(struct platform_device *dev)
{
int ret;
......@@ -296,17 +296,18 @@ static int hdaps_probe(struct device *dev)
return 0;
}
static int hdaps_resume(struct device *dev)
static int hdaps_resume(struct platform_device *dev)
{
return hdaps_device_init();
}
static struct device_driver hdaps_driver = {
.name = "hdaps",
.bus = &platform_bus_type,
.owner = THIS_MODULE,
static struct platform_driver hdaps_driver = {
.probe = hdaps_probe,
.resume = hdaps_resume
.resume = hdaps_resume,
.driver = {
.name = "hdaps",
.owner = THIS_MODULE,
},
};
/* Input class stuff */
......@@ -550,7 +551,7 @@ static int __init hdaps_init(void)
goto out;
}
ret = driver_register(&hdaps_driver);
ret = platform_driver_register(&hdaps_driver);
if (ret)
goto out_region;
......@@ -583,7 +584,7 @@ static int __init hdaps_init(void)
out_device:
platform_device_unregister(pdev);
out_driver:
driver_unregister(&hdaps_driver);
platform_driver_unregister(&hdaps_driver);
out_region:
release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
out:
......@@ -597,7 +598,7 @@ static void __exit hdaps_exit(void)
input_unregister_device(&hdaps_idev);
sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
platform_device_unregister(pdev);
driver_unregister(&hdaps_driver);
platform_driver_unregister(&hdaps_driver);
release_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS);
printk(KERN_INFO "hdaps: driver unloaded.\n");
......
......@@ -405,10 +405,9 @@ static struct i2c_algorithm iop3xx_i2c_algo = {
};
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 = dev_get_drvdata(&pdev->dev);
struct i2c_adapter *padapter = platform_get_drvdata(pdev);
struct i2c_algo_iop3xx_data *adapter_data =
(struct i2c_algo_iop3xx_data *)padapter->algo_data;
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......@@ -426,15 +425,14 @@ iop3xx_i2c_remove(struct device *device)
kfree(adapter_data);
kfree(padapter);
dev_set_drvdata(&pdev->dev, NULL);
platform_set_drvdata(pdev, NULL);
return 0;
}
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;
int ret;
struct i2c_adapter *new_adapter;
......@@ -499,7 +497,7 @@ iop3xx_i2c_probe(struct device *dev)
iop3xx_i2c_set_slave_addr(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;
i2c_add_adapter(new_adapter);
......@@ -523,24 +521,25 @@ iop3xx_i2c_probe(struct device *dev)
}
static struct device_driver iop3xx_i2c_driver = {
.owner = THIS_MODULE,
.name = "IOP3xx-I2C",
.bus = &platform_bus_type,
static struct platform_driver iop3xx_i2c_driver = {
.probe = iop3xx_i2c_probe,
.remove = iop3xx_i2c_remove
.remove = iop3xx_i2c_remove,
.driver = {
.owner = THIS_MODULE,
.name = "IOP3xx-I2C",
},
};
static int __init
i2c_iop3xx_init (void)
{
return driver_register(&iop3xx_i2c_driver);
return platform_driver_register(&iop3xx_i2c_driver);
}
static void __exit
i2c_iop3xx_exit (void)
{
driver_unregister(&iop3xx_i2c_driver);
platform_driver_unregister(&iop3xx_i2c_driver);
return;
}
......
......@@ -86,12 +86,11 @@ struct ixp2000_i2c_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 = dev_get_drvdata(&plat_dev->dev);
struct ixp2000_i2c_data *drv_data = platform_get_drvdata(plat_dev);
dev_set_drvdata(&plat_dev->dev, NULL);
platform_set_drvdata(plat_dev, NULL);
i2c_bit_del_bus(&drv_data->adapter);
......@@ -100,10 +99,9 @@ static int ixp2000_i2c_remove(struct device *dev)
return 0;
}
static int ixp2000_i2c_probe(struct device *dev)
static int ixp2000_i2c_probe(struct platform_device *plat_dev)
{
int err;
struct platform_device *plat_dev = to_platform_device(dev);
struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data;
struct ixp2000_i2c_data *drv_data =
kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL);
......@@ -139,27 +137,28 @@ static int ixp2000_i2c_probe(struct device *dev)
return err;
}
dev_set_drvdata(&plat_dev->dev, drv_data);
platform_set_drvdata(plat_dev, drv_data);
return 0;
}
static struct device_driver ixp2000_i2c_driver = {
.owner = THIS_MODULE,
.name = "IXP2000-I2C",
.bus = &platform_bus_type,
static struct platform_driver ixp2000_i2c_driver = {
.probe = ixp2000_i2c_probe,
.remove = ixp2000_i2c_remove,
.driver = {
.name = "IXP2000-I2C",
.owner = THIS_MODULE,
},
};
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)
{
driver_unregister(&ixp2000_i2c_driver);
platform_driver_unregister(&ixp2000_i2c_driver);
}
module_init(ixp2000_i2c_init);
......
......@@ -87,12 +87,11 @@ struct ixp4xx_i2c_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 = dev_get_drvdata(&plat_dev->dev);
struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev);
dev_set_drvdata(&plat_dev->dev, NULL);
platform_set_drvdata(plat_dev, NULL);
i2c_bit_del_bus(&drv_data->adapter);
......@@ -101,10 +100,9 @@ static int ixp4xx_i2c_remove(struct device *dev)
return 0;
}
static int ixp4xx_i2c_probe(struct device *dev)
static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
{
int err;
struct platform_device *plat_dev = to_platform_device(dev);
struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data;
struct ixp4xx_i2c_data *drv_data =
kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
......@@ -148,27 +146,28 @@ static int ixp4xx_i2c_probe(struct device *dev)
return err;
}
dev_set_drvdata(&plat_dev->dev, drv_data);
platform_set_drvdata(plat_dev, drv_data);
return 0;
}
static struct device_driver ixp4xx_i2c_driver = {
.owner = THIS_MODULE,
.name = "IXP4XX-I2C",
.bus = &platform_bus_type,
static struct platform_driver ixp4xx_i2c_driver = {
.probe = ixp4xx_i2c_probe,
.remove = ixp4xx_i2c_remove,
.driver = {
.name = "IXP4XX-I2C",
.owner = THIS_MODULE,
},
};
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)
{
driver_unregister(&ixp4xx_i2c_driver);
platform_driver_unregister(&ixp4xx_i2c_driver);
}
module_init(ixp4xx_i2c_init);
......
......@@ -288,11 +288,10 @@ static struct i2c_adapter mpc_ops = {
.retries = 1
};
static int fsl_i2c_probe(struct device *device)
static int fsl_i2c_probe(struct platform_device *pdev)
{
int result = 0;
struct mpc_i2c *i2c;
struct platform_device *pdev = to_platform_device(device);
struct fsl_i2c_platform_data *pdata;
struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......@@ -323,7 +322,7 @@ static int fsl_i2c_probe(struct device *device)
}
mpc_i2c_setclock(i2c);
dev_set_drvdata(device, i2c);
platform_set_drvdata(pdev, i2c);
i2c->adap = mpc_ops;
i2c_set_adapdata(&i2c->adap, i2c);
......@@ -345,12 +344,12 @@ static int fsl_i2c_probe(struct device *device)
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);
dev_set_drvdata(device, NULL);
platform_set_drvdata(pdev, NULL);
if (i2c->irq != 0)
free_irq(i2c->irq, i2c);
......@@ -361,22 +360,23 @@ static int fsl_i2c_remove(struct device *device)
};
/* Structure for a device driver */
static struct device_driver fsl_i2c_driver = {
.owner = THIS_MODULE,
.name = "fsl-i2c",
.bus = &platform_bus_type,
static struct platform_driver fsl_i2c_driver = {
.probe = fsl_i2c_probe,
.remove = fsl_i2c_remove,
.driver = {
.owner = THIS_MODULE,
.name = "fsl-i2c",
},
};
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)
{
driver_unregister(&fsl_i2c_driver);
platform_driver_unregister(&fsl_i2c_driver);
}
module_init(fsl_i2c_init);
......
......@@ -492,11 +492,10 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
}
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_pdata *pdata = dev->platform_data;
struct mv64xxx_i2c_pdata *pdata = pd->dev.platform_data;
int rc;
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.timeout = pdata->timeout;
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);
if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0,
......@@ -555,9 +554,9 @@ mv64xxx_i2c_probe(struct device *dev)
}
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;
rc = i2c_del_adapter(&drv_data->adapter);
......@@ -568,24 +567,25 @@ mv64xxx_i2c_remove(struct device *dev)
return rc;
}
static struct device_driver mv64xxx_i2c_driver = {
.owner = THIS_MODULE,
.name = MV64XXX_I2C_CTLR_NAME,
.bus = &platform_bus_type,
static struct platform_driver mv64xxx_i2c_driver = {
.probe = mv64xxx_i2c_probe,
.remove = mv64xxx_i2c_remove,
.driver = {
.owner = THIS_MODULE,
.name = MV64XXX_I2C_CTLR_NAME,
},
};
static int __init
mv64xxx_i2c_init(void)
{
return driver_register(&mv64xxx_i2c_driver);
return platform_driver_register(&mv64xxx_i2c_driver);
}
static void __exit
mv64xxx_i2c_exit(void)
{
driver_unregister(&mv64xxx_i2c_driver);
platform_driver_unregister(&mv64xxx_i2c_driver);
}
module_init(mv64xxx_i2c_init);
......
......@@ -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 i2c_pxa_platform_data *plat = dev->platform_data;
struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
int ret;
#ifdef CONFIG_PXA27x
......@@ -968,7 +968,7 @@ static int i2c_pxa_probe(struct device *dev)
i2c_pxa_reset(i2c);
i2c->adap.algo_data = i2c;
i2c->adap.dev.parent = dev;
i2c->adap.dev.parent = &dev->dev;
ret = i2c_add_adapter(&i2c->adap);
if (ret < 0) {
......@@ -976,7 +976,7 @@ static int i2c_pxa_probe(struct device *dev)
goto err_irq;
}
dev_set_drvdata(dev, i2c);
platform_set_drvdata(dev, i2c);
#ifdef CONFIG_I2C_PXA_SLAVE
printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
......@@ -993,11 +993,11 @@ static int i2c_pxa_probe(struct device *dev)
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);
free_irq(IRQ_I2C, i2c);
......@@ -1006,21 +1006,22 @@ static int i2c_pxa_remove(struct device *dev)
return 0;
}
static struct device_driver i2c_pxa_driver = {
.name = "pxa2xx-i2c",
.bus = &platform_bus_type,
static struct platform_driver i2c_pxa_driver = {
.probe = i2c_pxa_probe,
.remove = i2c_pxa_remove,
.driver = {
.name = "pxa2xx-i2c",
},
};
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)
{
return driver_unregister(&i2c_pxa_driver);
return platform_driver_unregister(&i2c_pxa_driver);
}
module_init(i2c_adap_pxa_init);
......
......@@ -760,24 +760,23 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c)
* called by the bus driver when a suitable device is found
*/
static int s3c24xx_i2c_probe(struct 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 resource *res;
int ret;
/* find the clock and enable it */
i2c->dev = dev;
i2c->clk = clk_get(dev, "i2c");
i2c->dev = &pdev->dev;
i2c->clk = clk_get(&pdev->dev, "i2c");
if (IS_ERR(i2c->clk)) {
dev_err(dev, "cannot get clock\n");
dev_err(&pdev->dev, "cannot get clock\n");
ret = -ENOENT;
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_enable(i2c->clk);
......@@ -786,7 +785,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(dev, "cannot find IO resource\n");
dev_err(&pdev->dev, "cannot find IO resource\n");
ret = -ENOENT;
goto out;
}
......@@ -795,7 +794,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
pdev->name);
if (i2c->ioarea == NULL) {
dev_err(dev, "cannot request IO\n");
dev_err(&pdev->dev, "cannot request IO\n");
ret = -ENXIO;
goto out;
}
......@@ -803,17 +802,17 @@ static int s3c24xx_i2c_probe(struct device *dev)
i2c->regs = ioremap(res->start, (res->end-res->start)+1);
if (i2c->regs == NULL) {
dev_err(dev, "cannot map IO\n");
dev_err(&pdev->dev, "cannot map IO\n");
ret = -ENXIO;
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 */
i2c->adap.algo_data = i2c;
i2c->adap.dev.parent = dev;
i2c->adap.dev.parent = &pdev->dev;
/* initialise the i2c controller */
......@@ -827,7 +826,7 @@ static int s3c24xx_i2c_probe(struct device *dev)
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) {
dev_err(dev, "cannot find IRQ\n");
dev_err(&pdev->dev, "cannot find IRQ\n");
ret = -ENOENT;
goto out;
}
......@@ -836,23 +835,23 @@ static int s3c24xx_i2c_probe(struct device *dev)
pdev->name, i2c);
if (ret != 0) {
dev_err(dev, "cannot claim IRQ\n");
dev_err(&pdev->dev, "cannot claim IRQ\n");
goto out;
}
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);
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;
}
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:
if (ret < 0)
......@@ -866,22 +865,22 @@ static int s3c24xx_i2c_probe(struct device *dev)
* 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) {
s3c24xx_i2c_free(i2c);
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
}
return 0;
}
#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)
s3c24xx_i2c_init(i2c);
......@@ -895,33 +894,35 @@ static int s3c24xx_i2c_resume(struct device *dev)
/* device driver for platform bus bits */
static struct device_driver s3c2410_i2c_driver = {
.owner = THIS_MODULE,
.name = "s3c2410-i2c",
.bus = &platform_bus_type,
static struct platform_driver s3c2410_i2c_driver = {
.probe = s3c24xx_i2c_probe,
.remove = s3c24xx_i2c_remove,
.resume = s3c24xx_i2c_resume,
.driver = {
.owner = THIS_MODULE,
.name = "s3c2410-i2c",
},
};
static struct device_driver s3c2440_i2c_driver = {
.owner = THIS_MODULE,
.name = "s3c2440-i2c",
.bus = &platform_bus_type,
static struct platform_driver s3c2440_i2c_driver = {
.probe = s3c24xx_i2c_probe,
.remove = s3c24xx_i2c_remove,
.resume = s3c24xx_i2c_resume,
.driver = {
.owner = THIS_MODULE,
.name = "s3c2440-i2c",
},
};
static int __init i2c_adap_s3c_init(void)
{
int ret;
ret = driver_register(&s3c2410_i2c_driver);
ret = platform_driver_register(&s3c2410_i2c_driver);
if (ret == 0) {
ret = driver_register(&s3c2440_i2c_driver);
ret = platform_driver_register(&s3c2440_i2c_driver);
if (ret)
driver_unregister(&s3c2410_i2c_driver);
platform_driver_unregister(&s3c2410_i2c_driver);
}
return ret;
......@@ -929,8 +930,8 @@ static int __init i2c_adap_s3c_init(void)
static void __exit i2c_adap_s3c_exit(void)
{
driver_unregister(&s3c2410_i2c_driver);
driver_unregister(&s3c2440_i2c_driver);
platform_driver_unregister(&s3c2410_i2c_driver);
platform_driver_unregister(&s3c2440_i2c_driver);
}
module_init(i2c_adap_s3c_init);
......
......@@ -873,26 +873,27 @@ static int otg_init(struct isp1301 *isp)
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;
otg_dev = to_platform_device(dev);
otg_dev = dev;
return 0;
}
static int otg_remove(struct device *dev)
static int otg_remove(struct platform_device *dev)
{
otg_dev = 0;
return 0;
}
struct device_driver omap_otg_driver = {
.owner = THIS_MODULE,
.name = "omap_otg",
.bus = &platform_bus_type,
struct platform_driver omap_otg_driver = {
.probe = otg_probe,
.remove = otg_remove,
.remove = otg_remove,
.driver = {
.owner = THIS_MODULE,
.name = "omap_otg",
},
};
static int otg_bind(struct isp1301 *isp)
......@@ -902,7 +903,7 @@ static int otg_bind(struct isp1301 *isp)
if (otg_dev)
return -EBUSY;
status = driver_register(&omap_otg_driver);
status = platform_driver_register(&omap_otg_driver);
if (status < 0)
return status;
......@@ -913,7 +914,7 @@ static int otg_bind(struct isp1301 *isp)
status = -ENODEV;
if (status < 0)
driver_unregister(&omap_otg_driver);
platform_driver_unregister(&omap_otg_driver);
return status;
}
......
......@@ -259,17 +259,17 @@ static void corgikbd_hinge_timer(unsigned long data)
}
#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;
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 */
corgikbd->suspend_jiffies=jiffies;
......@@ -282,7 +282,7 @@ static int corgikbd_resume(struct device *dev)
#define corgikbd_resume NULL
#endif
static int __init corgikbd_probe(struct device *dev)
static int __init corgikbd_probe(struct platform_device *pdev)
{
struct corgikbd *corgikbd;
struct input_dev *input_dev;
......@@ -296,7 +296,7 @@ static int __init corgikbd_probe(struct device *dev)
return -ENOMEM;
}
dev_set_drvdata(dev, corgikbd);
platform_set_drvdata(pdev, corgikbd);
corgikbd->input = input_dev;
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.product = 0x0001;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = dev;
input_dev->cdev.dev = &pdev->dev;
input_dev->private = corgikbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
......@@ -356,10 +356,10 @@ static int __init corgikbd_probe(struct device *dev)
return 0;
}
static int corgikbd_remove(struct device *dev)
static int corgikbd_remove(struct platform_device *pdev)
{
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++)
free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd);
......@@ -374,23 +374,24 @@ static int corgikbd_remove(struct device *dev)
return 0;
}
static struct device_driver corgikbd_driver = {
.name = "corgi-keyboard",
.bus = &platform_bus_type,
static struct platform_driver corgikbd_driver = {
.probe = corgikbd_probe,
.remove = corgikbd_remove,
.suspend = corgikbd_suspend,
.resume = corgikbd_resume,
.driver = {
.name = "corgi-keyboard",
},
};
static int __devinit corgikbd_init(void)
{
return driver_register(&corgikbd_driver);
return platform_driver_register(&corgikbd_driver);
}
static void __exit corgikbd_exit(void)
{
driver_unregister(&corgikbd_driver);
platform_driver_unregister(&corgikbd_driver);
}
module_init(corgikbd_init);
......
......@@ -309,10 +309,10 @@ static void spitzkbd_hinge_timer(unsigned long data)
}
#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;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev);
struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
spitzkbd->suspended = 1;
/* Set Strobe lines as inputs - *except* strobe line 0 leave this
......@@ -323,10 +323,10 @@ static int spitzkbd_suspend(struct device *dev, pm_message_t state)
return 0;
}
static int spitzkbd_resume(struct device *dev)
static int spitzkbd_resume(struct platform_device *dev)
{
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++)
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
#endif
static int __init spitzkbd_probe(struct device *dev)
static int __init spitzkbd_probe(struct platform_device *dev)
{
struct spitzkbd *spitzkbd;
struct input_dev *input_dev;
......@@ -358,7 +358,7 @@ static int __init spitzkbd_probe(struct device *dev)
return -ENOMEM;
}
dev_set_drvdata(dev, spitzkbd);
platform_set_drvdata(dev, spitzkbd);
strcpy(spitzkbd->phys, "spitzkbd/input0");
spin_lock_init(&spitzkbd->lock);
......@@ -380,7 +380,7 @@ static int __init spitzkbd_probe(struct device *dev)
input_dev->private = spitzkbd;
input_dev->name = "Spitz Keyboard";
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.vendor = 0x0001;
......@@ -437,10 +437,10 @@ static int __init spitzkbd_probe(struct device *dev)
return 0;
}
static int spitzkbd_remove(struct device *dev)
static int spitzkbd_remove(struct platform_device *dev)
{
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++)
free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd);
......@@ -460,23 +460,24 @@ static int spitzkbd_remove(struct device *dev)
return 0;
}
static struct device_driver spitzkbd_driver = {
.name = "spitz-keyboard",
.bus = &platform_bus_type,
static struct platform_driver spitzkbd_driver = {
.probe = spitzkbd_probe,
.remove = spitzkbd_remove,
.suspend = spitzkbd_suspend,
.resume = spitzkbd_resume,
.driver = {
.name = "spitz-keyboard",
},
};
static int __devinit spitzkbd_init(void)
{
return driver_register(&spitzkbd_driver);
return platform_driver_register(&spitzkbd_driver);
}
static void __exit spitzkbd_exit(void)
{
driver_unregister(&spitzkbd_driver);
platform_driver_unregister(&spitzkbd_driver);
}
module_init(spitzkbd_init);
......
......@@ -912,7 +912,7 @@ static long i8042_panic_blink(long count)
* Here we try to restore the original BIOS settings
*/
static int i8042_suspend(struct device *dev, pm_message_t state)
static int i8042_suspend(struct platform_device *dev, pm_message_t state)
{
del_timer_sync(&i8042_timer);
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
*/
static int i8042_resume(struct device *dev)
static int i8042_resume(struct platform_device *dev)
{
int i;
......@@ -964,17 +964,18 @@ static int i8042_resume(struct device *dev)
* because otherwise BIOSes will be confused.
*/
static void i8042_shutdown(struct device *dev)
static void i8042_shutdown(struct platform_device *dev)
{
i8042_controller_cleanup();
}
static struct device_driver i8042_driver = {
.name = "i8042",
.bus = &platform_bus_type,
static struct platform_driver i8042_driver = {
.suspend = i8042_suspend,
.resume = i8042_resume,
.shutdown = i8042_shutdown,
.driver = {
.name = "i8042",
},
};
static int __init i8042_create_kbd_port(void)
......@@ -1078,7 +1079,7 @@ static int __init i8042_init(void)
goto err_platform_exit;
}
err = driver_register(&i8042_driver);
err = platform_driver_register(&i8042_driver);
if (err)
goto err_controller_cleanup;
......@@ -1126,7 +1127,7 @@ static int __init i8042_init(void)
err_unregister_device:
platform_device_unregister(i8042_platform_device);
err_unregister_driver:
driver_unregister(&i8042_driver);
platform_driver_unregister(&i8042_driver);
err_controller_cleanup:
i8042_controller_cleanup();
err_platform_exit:
......@@ -1148,7 +1149,7 @@ static void __exit i8042_exit(void)
del_timer_sync(&i8042_timer);
platform_device_unregister(i8042_platform_device);
driver_unregister(&i8042_driver);
platform_driver_unregister(&i8042_driver);
i8042_platform_exit();
......
......@@ -107,7 +107,7 @@ static void rpckbd_close(struct serio *port)
* Allocate and initialize serio structure for subsequent registration
* with serio core.
*/
static int __devinit rpckbd_probe(struct device *dev)
static int __devinit rpckbd_probe(struct platform_device *dev)
{
struct serio *serio;
......@@ -120,37 +120,38 @@ static int __devinit rpckbd_probe(struct device *dev)
serio->write = rpckbd_write;
serio->open = rpckbd_open;
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->phys, "rpckbd/serio0", sizeof(serio->phys));
dev_set_drvdata(dev, serio);
platform_set_drvdata(dev, serio);
serio_register_port(serio);
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);
return 0;
}
static struct device_driver rpckbd_driver = {
.name = "kart",
.bus = &platform_bus_type,
static struct platform_driver rpckbd_driver = {
.probe = rpckbd_probe,
.remove = __devexit_p(rpckbd_remove),
.driver = {
.name = "kart",
},
};
static int __init rpckbd_init(void)
{
return driver_register(&rpckbd_driver);
return platform_driver_register(&rpckbd_driver);
}
static void __exit rpckbd_exit(void)
{
driver_unregister(&rpckbd_driver);
platform_driver_unregister(&rpckbd_driver);
}
module_init(rpckbd_init);
......
......@@ -231,9 +231,9 @@ static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
#ifdef CONFIG_PM
static int corgits_suspend(struct 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) {
del_timer_sync(&corgi_ts->timer);
......@@ -248,9 +248,9 @@ static int corgits_suspend(struct device *dev, pm_message_t state)
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);
/* Enable Falling Edge */
......@@ -264,10 +264,9 @@ static int corgits_resume(struct device *dev)
#define corgits_resume NULL
#endif
static int __init corgits_probe(struct device *dev)
static int __init corgits_probe(struct platform_device *pdev)
{
struct corgi_ts *corgi_ts;
struct platform_device *pdev = to_platform_device(dev);
struct input_dev *input_dev;
int err = -ENOMEM;
......@@ -276,9 +275,9 @@ static int __init corgits_probe(struct device *dev)
if (!corgi_ts || !input_dev)
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);
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.product = 0x0002;
input_dev->id.version = 0x0100;
input_dev->cdev.dev = dev;
input_dev->cdev.dev = &pdev->dev;
input_dev->private = corgi_ts;
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);
del_timer_sync(&corgi_ts->timer);
......@@ -351,23 +350,24 @@ static int corgits_remove(struct device *dev)
return 0;
}
static struct device_driver corgits_driver = {
.name = "corgi-ts",
.bus = &platform_bus_type,
static struct platform_driver corgits_driver = {
.probe = corgits_probe,
.remove = corgits_remove,
.suspend = corgits_suspend,
.resume = corgits_resume,
.driver = {
.name = "corgi-ts",
},
};
static int __devinit corgits_init(void)
{
return driver_register(&corgits_driver);
return platform_driver_register(&corgits_driver);
}
static void __exit corgits_exit(void)
{
driver_unregister(&corgits_driver);
platform_driver_unregister(&corgits_driver);
}
module_init(corgits_init);
......
......@@ -138,9 +138,8 @@ static struct mcp_ops mcp_sa11x0 = {
.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 *mcp;
int ret;
......@@ -165,7 +164,7 @@ static int mcp_sa11x0_probe(struct device *dev)
mcp->dma_telco_rd = DMA_Ser4MCP1Rd;
mcp->dma_telco_wr = DMA_Ser4MCP1Wr;
dev_set_drvdata(dev, mcp);
platform_set_drvdata(pdev, mcp);
if (machine_is_assabet()) {
ASSABET_BCR_set(ASSABET_BCR_CODEC_RST);
......@@ -202,26 +201,26 @@ static int mcp_sa11x0_probe(struct device *dev)
release:
release_mem_region(0x80060000, 0x60);
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
out:
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);
release_mem_region(0x80060000, 0x60);
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)->mccr1 = Ser4MCCR1;
......@@ -230,9 +229,9 @@ static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state)
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;
Ser4MCCR0 = priv(mcp)->mccr0;
......@@ -243,13 +242,14 @@ static int mcp_sa11x0_resume(struct device *dev)
/*
* The driver for the SA11x0 MCP port.
*/
static struct device_driver mcp_sa11x0_driver = {
.name = "sa11x0-mcp",
.bus = &platform_bus_type,
static struct platform_driver mcp_sa11x0_driver = {
.probe = mcp_sa11x0_probe,
.remove = mcp_sa11x0_remove,
.suspend = mcp_sa11x0_suspend,
.resume = mcp_sa11x0_resume,
.driver = {
.name = "sa11x0-mcp",
},
};
/*
......@@ -257,12 +257,12 @@ static struct device_driver mcp_sa11x0_driver = {
*/
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)
{
driver_unregister(&mcp_sa11x0_driver);
platform_driver_unregister(&mcp_sa11x0_driver);
}
module_init(mcp_sa11x0_init);
......
......@@ -27,8 +27,8 @@
#define SKY_CPUSTATE_VERSION "1.1"
static int hdpu_cpustate_probe(struct device *ddev);
static int hdpu_cpustate_remove(struct device *ddev);
static int hdpu_cpustate_probe(struct platform_device *pdev);
static int hdpu_cpustate_remove(struct platform_device *pdev);
struct cpustate_t cpustate;
......@@ -159,11 +159,12 @@ static int cpustate_read_proc(char *page, char **start, off_t off,
return len;
}
static struct device_driver hdpu_cpustate_driver = {
.name = HDPU_CPUSTATE_NAME,
.bus = &platform_bus_type,
static struct platform_driver hdpu_cpustate_driver = {
.probe = hdpu_cpustate_probe,
.remove = hdpu_cpustate_remove,
.driver = {
.name = HDPU_CPUSTATE_NAME,
},
};
/*
......@@ -188,9 +189,8 @@ static struct miscdevice cpustate_dev = {
&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 proc_dir_entry *proc_de;
int ret;
......@@ -218,7 +218,7 @@ static int hdpu_cpustate_probe(struct device *ddev)
return 0;
}
static int hdpu_cpustate_remove(struct device *ddev)
static int hdpu_cpustate_remove(struct platform_device *pdev)
{
cpustate.set_addr = NULL;
......@@ -233,13 +233,13 @@ static int hdpu_cpustate_remove(struct device *ddev)
static int __init cpustate_init(void)
{
int rc;
rc = driver_register(&hdpu_cpustate_driver);
rc = platform_driver_register(&hdpu_cpustate_driver);
return rc;
}
static void __exit cpustate_exit(void)
{
driver_unregister(&hdpu_cpustate_driver);
platform_driver_unregister(&hdpu_cpustate_driver);
}
module_init(cpustate_init);
......
......@@ -23,19 +23,20 @@
#include <linux/platform_device.h>
static int hdpu_nexus_probe(struct device *ddev);
static int hdpu_nexus_remove(struct device *ddev);
static int hdpu_nexus_probe(struct platform_device *pdev);
static int hdpu_nexus_remove(struct platform_device *pdev);
static struct proc_dir_entry *hdpu_slot_id;
static struct proc_dir_entry *hdpu_chassis_id;
static int slot_id = -1;
static int chassis_id = -1;
static struct device_driver hdpu_nexus_driver = {
.name = HDPU_NEXUS_NAME,
.bus = &platform_bus_type,
static struct platform_driver hdpu_nexus_driver = {
.probe = hdpu_nexus_probe,
.remove = hdpu_nexus_remove,
.driver = {
.name = HDPU_NEXUS_NAME,
},
};
int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset,
......@@ -56,9 +57,8 @@ int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset,
return sprintf(buffer, "%d\n", chassis_id);
}
static int hdpu_nexus_probe(struct device *ddev)
static int hdpu_nexus_probe(struct platform_device *pdev)
{
struct platform_device *pdev = to_platform_device(ddev);
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......@@ -81,7 +81,7 @@ static int hdpu_nexus_probe(struct device *ddev)
return 0;
}
static int hdpu_nexus_remove(struct device *ddev)
static int hdpu_nexus_remove(struct platform_device *pdev)
{
slot_id = -1;
chassis_id = -1;
......@@ -95,13 +95,13 @@ static int hdpu_nexus_remove(struct device *ddev)
static int __init nexus_init(void)
{
int rc;
rc = driver_register(&hdpu_nexus_driver);
rc = platform_driver_register(&hdpu_nexus_driver);
return rc;
}
static void __exit nexus_exit(void)
{
driver_unregister(&hdpu_nexus_driver);
platform_driver_unregister(&hdpu_nexus_driver);
}
module_init(nexus_init);
......
......@@ -428,9 +428,8 @@ static irqreturn_t pxamci_detect_irq(int irq, void *devid, struct pt_regs *regs)
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 pxamci_host *host = NULL;
struct resource *r;
......@@ -445,7 +444,7 @@ static int pxamci_probe(struct device *dev)
if (!r)
return -EBUSY;
mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev);
mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev);
if (!mmc) {
ret = -ENOMEM;
goto out;
......@@ -474,7 +473,7 @@ static int pxamci_probe(struct device *dev)
host->pdata->ocr_mask :
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) {
ret = -ENOMEM;
goto out;
......@@ -511,10 +510,10 @@ static int pxamci_probe(struct device *dev)
if (ret)
goto out;
dev_set_drvdata(dev, mmc);
platform_set_drvdata(pdev, mmc);
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);
......@@ -527,7 +526,7 @@ static int pxamci_probe(struct device *dev)
if (host->base)
iounmap(host->base);
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)
mmc_free_host(mmc);
......@@ -535,17 +534,17 @@ static int pxamci_probe(struct device *dev)
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) {
struct pxamci_host *host = mmc_priv(mmc);
if (host->pdata && host->pdata->exit)
host->pdata->exit(dev, mmc);
host->pdata->exit(&pdev->dev, mmc);
mmc_remove_host(mmc);
......@@ -560,7 +559,7 @@ static int pxamci_remove(struct device *dev)
free_irq(host->irq, host);
pxa_free_dma(host->dma);
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);
......@@ -570,9 +569,9 @@ static int pxamci_remove(struct device *dev)
}
#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;
if (mmc)
......@@ -581,9 +580,9 @@ static int pxamci_suspend(struct device *dev, pm_message_t state)
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;
if (mmc)
......@@ -596,23 +595,24 @@ static int pxamci_resume(struct device *dev)
#define pxamci_resume NULL
#endif
static struct device_driver pxamci_driver = {
.name = DRIVER_NAME,
.bus = &platform_bus_type,
static struct platform_driver pxamci_driver = {
.probe = pxamci_probe,
.remove = pxamci_remove,
.suspend = pxamci_suspend,
.resume = pxamci_resume,
.driver = {
.name = DRIVER_NAME,
},
};
static int __init pxamci_init(void)
{
return driver_register(&pxamci_driver);
return platform_driver_register(&pxamci_driver);
}
static void __exit pxamci_exit(void)
{
driver_unregister(&pxamci_driver);
platform_driver_unregister(&pxamci_driver);
}
module_init(pxamci_init);
......
......@@ -1932,14 +1932,14 @@ static void __devexit wbsd_shutdown(struct device* dev, int 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;
}
......@@ -1983,9 +1983,9 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev)
#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;
int ret;
......@@ -2005,9 +2005,9 @@ static int wbsd_suspend(struct device *dev, pm_message_t state)
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;
if (!mmc)
......@@ -2038,14 +2038,15 @@ static int wbsd_resume(struct device *dev)
static struct platform_device *wbsd_device;
static struct device_driver wbsd_driver = {
.name = DRIVER_NAME,
.bus = &platform_bus_type,
static struct platform_driver wbsd_driver = {
.probe = wbsd_probe,
.remove = wbsd_remove,
.suspend = wbsd_suspend,
.resume = wbsd_resume,
.driver = {
.name = DRIVER_NAME,
},
};
#ifdef CONFIG_PNP
......@@ -2085,7 +2086,7 @@ static int __init wbsd_drv_init(void)
if (nopnp)
{
result = driver_register(&wbsd_driver);
result = platform_driver_register(&wbsd_driver);
if (result < 0)
return result;
......@@ -2111,7 +2112,7 @@ static void __exit wbsd_drv_exit(void)
{
platform_device_unregister(wbsd_device);
driver_unregister(&wbsd_driver);
platform_driver_unregister(&wbsd_driver);
}
DBG("unloaded\n");
......
......@@ -63,11 +63,6 @@ struct bast_flash_info {
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
static struct bast_flash_info *to_bast_info(struct device *dev)
{
return (struct bast_flash_info *)dev_get_drvdata(dev);
}
static void bast_flash_setrw(int to)
{
unsigned int val;
......@@ -87,11 +82,11 @@ static void bast_flash_setrw(int to)
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)
return 0;
......@@ -116,9 +111,8 @@ static int bast_flash_remove(struct device *dev)
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 resource *res;
int err = 0;
......@@ -131,13 +125,13 @@ static int bast_flash_probe(struct device *dev)
}
memzero(info, sizeof(*info));
dev_set_drvdata(dev, info);
platform_set_drvdata(pdev, info);
res = pdev->resource; /* assume that the flash has one resource */
info->map.phys = res->start;
info->map.size = res->end - res->start + 1;
info->map.name = dev->bus_id;
info->map.name = pdev->dev.bus_id;
info->map.bankwidth = 2;
if (info->map.size > AREA_MAXSIZE)
......@@ -199,27 +193,28 @@ static int bast_flash_probe(struct device *dev)
/* fall through to exit error */
exit_error:
bast_flash_remove(dev);
bast_flash_remove(pdev);
return err;
}
static struct device_driver bast_flash_driver = {
.name = "bast-nor",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver bast_flash_driver = {
.probe = bast_flash_probe,
.remove = bast_flash_remove,
.driver = {
.name = "bast-nor",
.owner = THIS_MODULE,
},
};
static int __init bast_flash_init(void)
{
printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n");
return driver_register(&bast_flash_driver);
return platform_driver_register(&bast_flash_driver);
}
static void __exit bast_flash_exit(void)
{
driver_unregister(&bast_flash_driver);
platform_driver_unregister(&bast_flash_driver);
}
module_init(bast_flash_init);
......
......@@ -67,9 +67,8 @@ static void armflash_set_vpp(struct map_info *map, int on)
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 resource *res = dev->resource;
unsigned int size = res->end - res->start + 1;
......@@ -138,7 +137,7 @@ static int armflash_probe(struct device *_dev)
}
if (err == 0)
dev_set_drvdata(&dev->dev, info);
platform_set_drvdata(dev, info);
/*
* If we got an error, free all resources.
......@@ -163,12 +162,11 @@ static int armflash_probe(struct device *_dev)
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 = dev_get_drvdata(&dev->dev);
struct armflash_info *info = platform_get_drvdata(dev);
dev_set_drvdata(&dev->dev, NULL);
platform_set_drvdata(dev, NULL);
if (info) {
if (info->mtd) {
......@@ -190,21 +188,22 @@ static int armflash_remove(struct device *_dev)
return 0;
}
static struct device_driver armflash_driver = {
.name = "armflash",
.bus = &platform_bus_type,
static struct platform_driver armflash_driver = {
.probe = armflash_probe,
.remove = armflash_remove,
.driver = {
.name = "armflash",
},
};
static int __init armflash_init(void)
{
return driver_register(&armflash_driver);
return platform_driver_register(&armflash_driver);
}
static void __exit armflash_exit(void)
{
driver_unregister(&armflash_driver);
platform_driver_unregister(&armflash_driver);
}
module_init(armflash_init);
......
......@@ -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 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)
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 };
struct platform_device *dev = to_platform_device(_dev);
struct ixp2000_flash_data *ixp_data = dev->dev.platform_data;
struct flash_platform_data *plat;
struct ixp2000_flash_info *info;
......@@ -177,7 +175,7 @@ static int ixp2000_flash_probe(struct device *_dev)
}
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
......@@ -248,25 +246,26 @@ static int ixp2000_flash_probe(struct device *_dev)
return 0;
Error:
ixp2000_flash_remove(_dev);
ixp2000_flash_remove(dev);
return err;
}
static struct device_driver ixp2000_flash_driver = {
.name = "IXP2000-Flash",
.bus = &platform_bus_type,
static struct platform_driver ixp2000_flash_driver = {
.probe = &ixp2000_flash_probe,
.remove = &ixp2000_flash_remove
.driver = {
.name = "IXP2000-Flash",
},
};
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)
{
driver_unregister(&ixp2000_flash_driver);
platform_driver_unregister(&ixp2000_flash_driver);
}
module_init(ixp2000_flash_init);
......
......@@ -99,13 +99,12 @@ struct ixp4xx_flash_info {
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 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)
return 0;
......@@ -130,9 +129,8 @@ static int ixp4xx_flash_remove(struct device *_dev)
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 ixp4xx_flash_info *info;
int err = -1;
......@@ -153,7 +151,7 @@ static int ixp4xx_flash_probe(struct device *_dev)
}
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
......@@ -214,25 +212,26 @@ static int ixp4xx_flash_probe(struct device *_dev)
return 0;
Error:
ixp4xx_flash_remove(_dev);
ixp4xx_flash_remove(dev);
return err;
}
static struct device_driver ixp4xx_flash_driver = {
.name = "IXP4XX-Flash",
.bus = &platform_bus_type,
static struct platform_driver ixp4xx_flash_driver = {
.probe = ixp4xx_flash_probe,
.remove = ixp4xx_flash_remove,
.driver = {
.name = "IXP4XX-Flash",
},
};
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)
{
driver_unregister(&ixp4xx_flash_driver);
platform_driver_unregister(&ixp4xx_flash_driver);
}
......
......@@ -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;
struct omapflash_info *info;
struct platform_device *pdev = to_platform_device(dev);
struct flash_platform_data *pdata = pdev->dev.platform_data;
struct resource *res = pdev->resource;
unsigned long size = res->end - res->start + 1;
......@@ -119,7 +118,7 @@ static int __devinit omapflash_probe(struct device *dev)
#endif
add_mtd_device(info->mtd);
dev_set_drvdata(&pdev->dev, info);
platform_set_drvdata(pdev, info);
return 0;
......@@ -133,12 +132,11 @@ static int __devinit omapflash_probe(struct device *dev)
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 = dev_get_drvdata(&pdev->dev);
struct omapflash_info *info = platform_get_drvdata(pdev);
dev_set_drvdata(&pdev->dev, NULL);
platform_set_drvdata(pdev, NULL);
if (info) {
if (info->parts) {
......@@ -155,21 +153,22 @@ static int __devexit omapflash_remove(struct device *dev)
return 0;
}
static struct device_driver omapflash_driver = {
.name = "omapflash",
.bus = &platform_bus_type,
static struct platform_driver omapflash_driver = {
.probe = omapflash_probe,
.remove = __devexit_p(omapflash_remove),
.driver = {
.name = "omapflash",
},
};
static int __init omapflash_init(void)
{
return driver_register(&omapflash_driver);
return platform_driver_register(&omapflash_driver);
}
static void __exit omapflash_exit(void)
{
driver_unregister(&omapflash_driver);
platform_driver_unregister(&omapflash_driver);
}
module_init(omapflash_init);
......
......@@ -56,9 +56,9 @@ struct platram_info {
* 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
......@@ -83,13 +83,13 @@ static inline void platram_setrw(struct platram_info *info, int to)
* called to remove the device from the driver's control
*/
static int platram_remove(struct 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)
return 0;
......@@ -130,61 +130,60 @@ static int platram_remove(struct device *dev)
* 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 platram_info *info;
struct resource *res;
int err = 0;
dev_dbg(dev, "probe entered\n");
dev_dbg(&pdev->dev, "probe entered\n");
if (dev->platform_data == NULL) {
dev_err(dev, "no platform data supplied\n");
if (pdev->dev.platform_data == NULL) {
dev_err(&pdev->dev, "no platform data supplied\n");
err = -ENOENT;
goto exit_error;
}
pdata = dev->platform_data;
pdata = pdev->dev.platform_data;
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) {
dev_err(dev, "no memory for flash info\n");
dev_err(&pdev->dev, "no memory for flash info\n");
err = -ENOMEM;
goto exit_error;
}
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;
/* 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) {
dev_err(dev, "no memory resource specified\n");
dev_err(&pdev->dev, "no memory resource specified\n");
err = -ENOENT;
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 */
info->map.phys = res->start;
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;
/* 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) {
dev_err(dev, "failed to request memory region\n");
dev_err(&pdev->dev, "failed to request memory region\n");
err = -EIO;
goto exit_free;
}
......@@ -192,23 +191,23 @@ static int platram_probe(struct device *dev)
/* remap the memory area */
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) {
dev_err(dev, "failed to ioremap() region\n");
dev_err(&pdev->dev, "failed to ioremap() region\n");
err = -EIO;
goto exit_free;
}
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 */
info->mtd = do_map_probe("map_ram" , &info->map);
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;
goto exit_free;
}
......@@ -237,27 +236,28 @@ static int platram_probe(struct device *dev)
#endif /* CONFIG_MTD_PARTITIONS */
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;
}
dev_info(dev, "registered mtd device\n");
dev_info(&pdev->dev, "registered mtd device\n");
return err;
exit_free:
platram_remove(dev);
platram_remove(pdev);
exit_error:
return err;
}
/* device driver info */
static struct device_driver platram_driver = {
.name = "mtd-ram",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver platram_driver = {
.probe = platram_probe,
.remove = platram_remove,
.driver = {
.name = "mtd-ram",
.owner = THIS_MODULE,
},
};
/* module init/exit */
......@@ -265,12 +265,12 @@ static struct device_driver platram_driver = {
static int __init platram_init(void)
{
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)
{
driver_unregister(&platram_driver);
platform_driver_unregister(&platram_driver);
}
module_init(platram_init);
......
......@@ -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 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 mtd_partition *parts;
const char *part_type = NULL;
......@@ -402,28 +401,28 @@ static int __init sa1100_mtd_probe(struct device *dev)
info->nr_parts = nr_parts;
dev_set_drvdata(dev, info);
platform_set_drvdata(pdev, info);
err = 0;
out:
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 flash_platform_data *plat = dev->platform_data;
struct sa_info *info = platform_get_drvdata(pdev);
struct flash_platform_data *plat = pdev->dev.platform_data;
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
sa1100_destroy(info, plat);
return 0;
}
#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;
if (info)
......@@ -432,17 +431,17 @@ static int sa1100_mtd_suspend(struct device *dev, pm_message_t state)
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)
info->mtd->resume(info->mtd);
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)
info->mtd->resume(info->mtd);
}
......@@ -452,24 +451,25 @@ static void sa1100_mtd_shutdown(struct device *dev)
#define sa1100_mtd_shutdown NULL
#endif
static struct device_driver sa1100_mtd_driver = {
.name = "flash",
.bus = &platform_bus_type,
static struct platform_driver sa1100_mtd_driver = {
.probe = sa1100_mtd_probe,
.remove = __exit_p(sa1100_mtd_remove),
.suspend = sa1100_mtd_suspend,
.resume = sa1100_mtd_resume,
.shutdown = sa1100_mtd_shutdown,
.driver = {
.name = "flash",
},
};
static int __init sa1100_mtd_init(void)
{
return driver_register(&sa1100_mtd_driver);
return platform_driver_register(&sa1100_mtd_driver);
}
static void __exit sa1100_mtd_exit(void)
{
driver_unregister(&sa1100_mtd_driver);
platform_driver_unregister(&sa1100_mtd_driver);
}
module_init(sa1100_mtd_init);
......
......@@ -125,14 +125,14 @@ static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd)
return s3c2410_nand_mtd_toours(mtd)->info;
}
static struct s3c2410_nand_info *to_nand_info(struct 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 */
......@@ -165,9 +165,9 @@ static int s3c2410_nand_calc_rate(int wanted, unsigned long clk, int max)
/* controller setup */
static int s3c2410_nand_inithw(struct s3c2410_nand_info *info,
struct 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);
int tacls, twrph0, twrph1;
unsigned long cfg;
......@@ -430,11 +430,11 @@ static void s3c2410_nand_write_buf(struct mtd_info *mtd,
/* device management functions */
static int s3c2410_nand_remove(struct 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)
return 0;
......@@ -562,10 +562,9 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
* 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(dev);
struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
struct s3c2410_nand_info *info;
struct s3c2410_nand_mtd *nmtd;
struct s3c2410_nand_set *sets;
......@@ -575,26 +574,26 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
int nr_sets;
int setno;
pr_debug("s3c2410_nand_probe(%p)\n", dev);
pr_debug("s3c2410_nand_probe(%p)\n", pdev);
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) {
dev_err(dev, "no memory for flash info\n");
dev_err(&pdev->dev, "no memory for flash info\n");
err = -ENOMEM;
goto exit_error;
}
memzero(info, sizeof(*info));
dev_set_drvdata(dev, info);
platform_set_drvdata(pdev, info);
spin_lock_init(&info->controller.lock);
init_waitqueue_head(&info->controller.wq);
/* 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)) {
dev_err(dev, "failed to get clock");
dev_err(&pdev->dev, "failed to get clock");
err = -ENOENT;
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);
if (info->area == NULL) {
dev_err(dev, "cannot reserve register region\n");
dev_err(&pdev->dev, "cannot reserve register region\n");
err = -ENOENT;
goto exit_error;
}
info->device = dev;
info->device = &pdev->dev;
info->platform = plat;
info->regs = ioremap(res->start, size);
info->is_s3c2440 = is_s3c2440;
if (info->regs == NULL) {
dev_err(dev, "cannot reserve register region\n");
dev_err(&pdev->dev, "cannot reserve register region\n");
err = -EIO;
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 */
err = s3c2410_nand_inithw(info, dev);
err = s3c2410_nand_inithw(info, pdev);
if (err != 0)
goto exit_error;
......@@ -645,7 +644,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
size = nr_sets * sizeof(*info->mtds);
info->mtds = kmalloc(size, GFP_KERNEL);
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;
goto exit_error;
}
......@@ -677,7 +676,7 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
return 0;
exit_error:
s3c2410_nand_remove(dev);
s3c2410_nand_remove(pdev);
if (err == 0)
err = -EINVAL;
......@@ -686,44 +685,46 @@ static int s3c24xx_nand_probe(struct device *dev, int is_s3c2440)
/* 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);
}
static int s3c2440_nand_probe(struct device *dev)
static int s3c2440_nand_probe(struct platform_device *dev)
{
return s3c24xx_nand_probe(dev, 1);
}
static struct device_driver s3c2410_nand_driver = {
.name = "s3c2410-nand",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver s3c2410_nand_driver = {
.probe = s3c2410_nand_probe,
.remove = s3c2410_nand_remove,
.driver = {
.name = "s3c2410-nand",
.owner = THIS_MODULE,
},
};
static struct device_driver s3c2440_nand_driver = {
.name = "s3c2440-nand",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver s3c2440_nand_driver = {
.probe = s3c2440_nand_probe,
.remove = s3c2410_nand_remove,
.driver = {
.name = "s3c2440-nand",
.owner = THIS_MODULE,
},
};
static int __init s3c2410_nand_init(void)
{
printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n");
driver_register(&s3c2440_nand_driver);
return driver_register(&s3c2410_nand_driver);
platform_driver_register(&s3c2440_nand_driver);
return platform_driver_register(&s3c2410_nand_driver);
}
static void __exit s3c2410_nand_exit(void)
{
driver_unregister(&s3c2440_nand_driver);
driver_unregister(&s3c2410_nand_driver);
platform_driver_unregister(&s3c2440_nand_driver);
platform_driver_unregister(&s3c2410_nand_driver);
}
module_init(s3c2410_nand_init);
......
......@@ -398,13 +398,19 @@ static struct mca_driver depca_mca_driver = {
};
#endif
static int depca_isa_probe (struct device *);
static int depca_isa_probe (struct platform_device *);
static struct device_driver depca_isa_driver = {
.name = depca_string,
.bus = &platform_bus_type,
static int __devexit depca_isa_remove(struct platform_device *pdev)
{
return depca_device_remove(&pdev->dev);
}
static struct platform_driver depca_isa_driver = {
.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;
}
static int __init depca_isa_probe (struct device *device)
static int __init depca_isa_probe (struct platform_device *device)
{
struct net_device *dev;
struct depca_private *lp;
......@@ -1533,7 +1539,7 @@ static int __init depca_isa_probe (struct device *device)
enum depca_type adapter = unknown;
int status = 0;
ioaddr = (u_long) device->platform_data;
ioaddr = (u_long) device->dev.platform_data;
if ((status = depca_common_init (ioaddr, &dev)))
goto out;
......@@ -1553,7 +1559,7 @@ static int __init depca_isa_probe (struct device *device)
lp->adapter = adapter;
lp->mem_start = mem_start;
if ((status = depca_hw_init(dev, device)))
if ((status = depca_hw_init(dev, &device->dev)))
goto out_free;
return 0;
......@@ -2082,7 +2088,7 @@ static int __init depca_module_init (void)
#ifdef CONFIG_EISA
err |= eisa_driver_register (&depca_eisa_driver);
#endif
err |= driver_register (&depca_isa_driver);
err |= platform_driver_register (&depca_isa_driver);
depca_platform_probe ();
return err;
......@@ -2097,7 +2103,7 @@ static void __exit depca_module_exit (void)
#ifdef CONFIG_EISA
eisa_driver_unregister (&depca_eisa_driver);
#endif
driver_unregister (&depca_isa_driver);
platform_driver_unregister (&depca_isa_driver);
for (i = 0; depca_io_ports[i].iobase; i++) {
if (depca_io_ports[i].device) {
......
......@@ -149,7 +149,7 @@ typedef struct board_info {
} board_info_t;
/* 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_start_xmit(struct sk_buff *, 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
*/
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 board_info *db; /* Point a board information structure */
struct net_device *ndev;
......@@ -399,7 +398,7 @@ dm9000_probe(struct device *dev)
}
SET_MODULE_OWNER(ndev);
SET_NETDEV_DEV(ndev, dev);
SET_NETDEV_DEV(ndev, &pdev->dev);
PRINTK2("dm9000_probe()");
......@@ -570,7 +569,7 @@ dm9000_probe(struct device *dev)
printk("%s: Invalid ethernet MAC address. Please "
"set using ifconfig\n", ndev->name);
dev_set_drvdata(dev, ndev);
platform_set_drvdata(pdev, ndev);
ret = register_netdev(ndev);
if (ret == 0) {
......@@ -1141,9 +1140,9 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
}
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 (netif_running(ndev)) {
......@@ -1155,9 +1154,9 @@ dm9000_drv_suspend(struct device *dev, pm_message_t state)
}
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;
if (ndev) {
......@@ -1173,12 +1172,11 @@ dm9000_drv_resume(struct device *dev)
}
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 = dev_get_drvdata(dev);
struct net_device *ndev = platform_get_drvdata(pdev);
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
unregister_netdev(ndev);
dm9000_release_board(pdev, (board_info_t *) ndev->priv);
......@@ -1189,13 +1187,14 @@ dm9000_drv_remove(struct device *dev)
return 0;
}
static struct device_driver dm9000_driver = {
.name = "dm9000",
.bus = &platform_bus_type,
static struct platform_driver dm9000_driver = {
.probe = dm9000_probe,
.remove = dm9000_drv_remove,
.suspend = dm9000_drv_suspend,
.resume = dm9000_drv_resume,
.driver = {
.name = "dm9000",
},
};
static int __init
......@@ -1203,13 +1202,13 @@ dm9000_init(void)
{
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
dm9000_cleanup(void)
{
driver_unregister(&dm9000_driver);
platform_driver_unregister(&dm9000_driver);
}
module_init(dm9000_init);
......
......@@ -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 init_registers(struct net_device *dev);
static int init_phy(struct net_device *dev);
static int gfar_probe(struct device *device);
static int gfar_remove(struct device *device);
static int gfar_probe(struct platform_device *pdev);
static int gfar_remove(struct platform_device *pdev);
static void free_skb_resources(struct gfar_private *priv);
static void gfar_set_multi(struct net_device *dev);
static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
......@@ -157,12 +157,11 @@ int gfar_uses_fcb(struct gfar_private *priv)
/* Set up the ethernet device structure, private data,
* and anything else we need before we start */
static int gfar_probe(struct device *device)
static int gfar_probe(struct platform_device *pdev)
{
u32 tempval;
struct net_device *dev = NULL;
struct gfar_private *priv = NULL;
struct platform_device *pdev = to_platform_device(device);
struct gianfar_platform_data *einfo;
struct resource *r;
int idx;
......@@ -209,7 +208,7 @@ static int gfar_probe(struct device *device)
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 */
/* (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);
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, device);
SET_NETDEV_DEV(dev, &pdev->dev);
/* Fill in the dev structure */
dev->open = gfar_enet_open;
......@@ -378,12 +377,12 @@ static int gfar_probe(struct device *device)
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);
dev_set_drvdata(device, NULL);
platform_set_drvdata(pdev, NULL);
iounmap((void *) priv->regs);
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 */
static struct device_driver gfar_driver = {
.name = "fsl-gianfar",
.bus = &platform_bus_type,
static struct platform_driver gfar_driver = {
.probe = gfar_probe,
.remove = gfar_remove,
.driver = {
.name = "fsl-gianfar",
},
};
static int __init gfar_init(void)
......@@ -1876,7 +1876,7 @@ static int __init gfar_init(void)
if (err)
return err;
err = driver_register(&gfar_driver);
err = platform_driver_register(&gfar_driver);
if (err)
gfar_mdio_exit();
......@@ -1886,7 +1886,7 @@ static int __init gfar_init(void)
static void __exit gfar_exit(void)
{
driver_unregister(&gfar_driver);
platform_driver_unregister(&gfar_driver);
gfar_mdio_exit();
}
......
......@@ -291,9 +291,9 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si)
/*
* 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;
if (!dev)
......@@ -316,9 +316,9 @@ static int sa1100_irda_suspend(struct device *_dev, pm_message_t state)
/*
* 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;
if (!dev)
......@@ -886,9 +886,8 @@ static int sa1100_irda_init_iobuf(iobuff_t *io, int size)
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 sa1100_irda *si;
unsigned int baudrate_mask;
......@@ -967,7 +966,7 @@ static int sa1100_irda_probe(struct device *_dev)
err = register_netdev(dev);
if (err == 0)
dev_set_drvdata(&pdev->dev, dev);
platform_set_drvdata(pdev, dev);
if (err) {
err_mem_5:
......@@ -985,9 +984,9 @@ static int sa1100_irda_probe(struct device *_dev)
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) {
struct sa1100_irda *si = dev->priv;
......@@ -1004,13 +1003,14 @@ static int sa1100_irda_remove(struct device *_dev)
return 0;
}
static struct device_driver sa1100ir_driver = {
.name = "sa11x0-ir",
.bus = &platform_bus_type,
static struct platform_driver sa1100ir_driver = {
.probe = sa1100_irda_probe,
.remove = sa1100_irda_remove,
.suspend = sa1100_irda_suspend,
.resume = sa1100_irda_resume,
.driver = {
.name = "sa11x0-ir",
},
};
static int __init sa1100_irda_init(void)
......@@ -1023,12 +1023,12 @@ static int __init sa1100_irda_init(void)
if (power_level > 3)
power_level = 3;
return driver_register(&sa1100ir_driver);
return platform_driver_register(&sa1100ir_driver);
}
static void __exit sa1100_irda_exit(void)
{
driver_unregister(&sa1100ir_driver);
platform_driver_unregister(&sa1100ir_driver);
}
module_init(sa1100_irda_init);
......
......@@ -214,14 +214,15 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base);
/* Power Management */
static int smsc_ircc_suspend(struct device *dev, pm_message_t state);
static int smsc_ircc_resume(struct device *dev);
static int smsc_ircc_suspend(struct platform_device *dev, pm_message_t state);
static int smsc_ircc_resume(struct platform_device *dev);
static struct device_driver smsc_ircc_driver = {
.name = SMSC_IRCC2_DRIVER_NAME,
.bus = &platform_bus_type,
static struct platform_driver smsc_ircc_driver = {
.suspend = smsc_ircc_suspend,
.resume = smsc_ircc_resume,
.driver = {
.name = SMSC_IRCC2_DRIVER_NAME,
},
};
/* Transceivers for SMSC-ircc */
......@@ -346,7 +347,7 @@ static int __init smsc_ircc_init(void)
IRDA_DEBUG(1, "%s\n", __FUNCTION__);
ret = driver_register(&smsc_ircc_driver);
ret = platform_driver_register(&smsc_ircc_driver);
if (ret) {
IRDA_ERROR("%s, Can't register driver!\n", driver_name);
return ret;
......@@ -378,7 +379,7 @@ static int __init smsc_ircc_init(void)
}
if (ret)
driver_unregister(&smsc_ircc_driver);
platform_driver_unregister(&smsc_ircc_driver);
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);
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);
dev_count++;
......@@ -1685,9 +1686,9 @@ static int smsc_ircc_net_close(struct net_device *dev)
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) {
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;
}
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) {
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]);
}
driver_unregister(&smsc_ircc_driver);
platform_driver_unregister(&smsc_ircc_driver);
}
/*
......
......@@ -194,7 +194,7 @@ static int __init sonic_probe1(struct net_device *dev)
* Probe for a SONIC ethernet controller on a Mips Jazz board.
* Actually probing is superfluous but we're paranoid.
*/
static int __init jazz_sonic_probe(struct device *device)
static int __init jazz_sonic_probe(struct platform_device *pdev)
{
struct net_device *dev;
struct sonic_local *lp;
......@@ -212,8 +212,8 @@ static int __init jazz_sonic_probe(struct device *device)
return -ENOMEM;
lp = netdev_priv(dev);
lp->device = device;
SET_NETDEV_DEV(dev, device);
lp->device = &pdev->dev;
SET_NETDEV_DEV(dev, &pdev->dev);
SET_MODULE_OWNER(dev);
netdev_boot_setup_check(dev);
......@@ -264,9 +264,9 @@ MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
#include "sonic.c"
static int __devexit jazz_sonic_device_remove (struct 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);
unregister_netdev (dev);
......@@ -278,18 +278,19 @@ static int __devexit jazz_sonic_device_remove (struct device *device)
return 0;
}
static struct device_driver jazz_sonic_driver = {
.name = jazz_sonic_string,
.bus = &platform_bus_type,
static struct platform_driver jazz_sonic_driver = {
.probe = jazz_sonic_probe,
.remove = __devexit_p(jazz_sonic_device_remove),
.driver = {
.name = jazz_sonic_string,
},
};
static int __init jazz_sonic_init_module(void)
{
int err;
if ((err = driver_register(&jazz_sonic_driver))) {
if ((err = platform_driver_register(&jazz_sonic_driver))) {
printk(KERN_ERR "Driver registration failed\n");
return err;
}
......@@ -313,7 +314,7 @@ static int __init jazz_sonic_init_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) {
platform_device_unregister(jazz_sonic_device);
......
......@@ -525,7 +525,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
return macsonic_init(dev);
}
static int __init mac_sonic_probe(struct device *device)
static int __init mac_sonic_probe(struct platform_device *device)
{
struct net_device *dev;
struct sonic_local *lp;
......@@ -537,8 +537,8 @@ static int __init mac_sonic_probe(struct device *device)
return -ENOMEM;
lp = netdev_priv(dev);
lp->device = device;
SET_NETDEV_DEV(dev, device);
lp->device = &device->dev;
SET_NETDEV_DEV(dev, &device->dev);
SET_MODULE_OWNER(dev);
/* This will catch fatal stuff like -ENOMEM as well as success */
......@@ -579,9 +579,9 @@ MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
#include "sonic.c"
static int __devexit mac_sonic_device_remove (struct 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);
unregister_netdev (dev);
......@@ -592,18 +592,19 @@ static int __devexit mac_sonic_device_remove (struct device *device)
return 0;
}
static struct device_driver mac_sonic_driver = {
.name = mac_sonic_string,
.bus = &platform_bus_type,
static struct platform_driver mac_sonic_driver = {
.probe = mac_sonic_probe,
.remove = __devexit_p(mac_sonic_device_remove),
.driver = {
.name = mac_sonic_string,
},
};
static int __init mac_sonic_init_module(void)
{
int err;
if ((err = driver_register(&mac_sonic_driver))) {
if ((err = platform_driver_register(&mac_sonic_driver))) {
printk(KERN_ERR "Driver registration failed\n");
return err;
}
......@@ -628,7 +629,7 @@ static int __init mac_sonic_init_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) {
platform_device_unregister(mac_sonic_device);
......
......@@ -1387,9 +1387,8 @@ static void mv643xx_netpoll(struct net_device *netdev)
* Input : struct device *
* 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;
int port_num = pdev->id;
struct mv643xx_private *mp;
......@@ -1402,7 +1401,7 @@ static int mv643xx_eth_probe(struct device *ddev)
if (!dev)
return -ENOMEM;
dev_set_drvdata(ddev, dev);
platform_set_drvdata(pdev, dev);
mp = netdev_priv(dev);
......@@ -1546,21 +1545,20 @@ static int mv643xx_eth_probe(struct device *ddev)
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);
flush_scheduled_work();
free_netdev(dev);
dev_set_drvdata(ddev, NULL);
platform_set_drvdata(pdev, NULL);
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;
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);
mv643xx_eth_shared_base = NULL;
......@@ -1586,18 +1584,20 @@ static int mv643xx_eth_shared_remove(struct device *ddev)
return 0;
}
static struct device_driver mv643xx_eth_driver = {
.name = MV643XX_ETH_NAME,
.bus = &platform_bus_type,
static struct platform_driver mv643xx_eth_driver = {
.probe = mv643xx_eth_probe,
.remove = mv643xx_eth_remove,
.driver = {
.name = MV643XX_ETH_NAME,
},
};
static struct device_driver mv643xx_eth_shared_driver = {
.name = MV643XX_ETH_SHARED_NAME,
.bus = &platform_bus_type,
static struct platform_driver mv643xx_eth_shared_driver = {
.probe = mv643xx_eth_shared_probe,
.remove = mv643xx_eth_shared_remove,
.driver = {
.name = MV643XX_ETH_SHARED_NAME,
},
};
/*
......@@ -1613,11 +1613,11 @@ static int __init mv643xx_init_module(void)
{
int rc;
rc = driver_register(&mv643xx_eth_shared_driver);
rc = platform_driver_register(&mv643xx_eth_shared_driver);
if (!rc) {
rc = driver_register(&mv643xx_eth_driver);
rc = platform_driver_register(&mv643xx_eth_driver);
if (rc)
driver_unregister(&mv643xx_eth_shared_driver);
platform_driver_unregister(&mv643xx_eth_shared_driver);
}
return rc;
}
......@@ -1633,8 +1633,8 @@ static int __init mv643xx_init_module(void)
*/
static void __exit mv643xx_cleanup_module(void)
{
driver_unregister(&mv643xx_eth_driver);
driver_unregister(&mv643xx_eth_shared_driver);
platform_driver_unregister(&mv643xx_eth_driver);
platform_driver_unregister(&mv643xx_eth_shared_driver);
}
module_init(mv643xx_init_module);
......
......@@ -2183,9 +2183,8 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device *
* 0 --> there is a device
* anything else, error
*/
static int smc_drv_probe(struct device *dev)
static int smc_drv_probe(struct platform_device *pdev)
{
struct platform_device *pdev = to_platform_device(dev);
struct net_device *ndev;
struct resource *res;
unsigned int __iomem *addr;
......@@ -2212,7 +2211,7 @@ static int smc_drv_probe(struct device *dev)
goto out_release_io;
}
SET_MODULE_OWNER(ndev);
SET_NETDEV_DEV(ndev, dev);
SET_NETDEV_DEV(ndev, &pdev->dev);
ndev->dma = (unsigned char)-1;
ndev->irq = platform_get_irq(pdev, 0);
......@@ -2233,7 +2232,7 @@ static int smc_drv_probe(struct device *dev)
goto out_release_attrib;
}
dev_set_drvdata(dev, ndev);
platform_set_drvdata(pdev, ndev);
ret = smc_probe(ndev, addr);
if (ret != 0)
goto out_iounmap;
......@@ -2249,7 +2248,7 @@ static int smc_drv_probe(struct device *dev)
return 0;
out_iounmap:
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
iounmap(addr);
out_release_attrib:
smc_release_attrib(pdev);
......@@ -2263,14 +2262,13 @@ static int smc_drv_probe(struct device *dev)
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 = dev_get_drvdata(dev);
struct net_device *ndev = platform_get_drvdata(pdev);
struct smc_local *lp = netdev_priv(ndev);
struct resource *res;
dev_set_drvdata(dev, NULL);
platform_set_drvdata(pdev, NULL);
unregister_netdev(ndev);
......@@ -2295,9 +2293,9 @@ static int smc_drv_remove(struct device *dev)
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 (netif_running(ndev)) {
......@@ -2309,14 +2307,13 @@ static int smc_drv_suspend(struct device *dev, pm_message_t state)
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 = dev_get_drvdata(dev);
struct net_device *ndev = platform_get_drvdata(dev);
if (ndev) {
struct smc_local *lp = netdev_priv(ndev);
smc_enable_device(pdev);
smc_enable_device(dev);
if (netif_running(ndev)) {
smc_reset(ndev);
smc_enable(ndev);
......@@ -2328,13 +2325,14 @@ static int smc_drv_resume(struct device *dev)
return 0;
}
static struct device_driver smc_driver = {
.name = CARDNAME,
.bus = &platform_bus_type,
static struct platform_driver smc_driver = {
.probe = smc_drv_probe,
.remove = smc_drv_remove,
.suspend = smc_drv_suspend,
.resume = smc_drv_resume,
.driver = {
.name = CARDNAME,
},
};
static int __init smc_init(void)
......@@ -2348,12 +2346,12 @@ static int __init smc_init(void)
#endif
#endif
return driver_register(&smc_driver);
return platform_driver_register(&smc_driver);
}
static void __exit smc_cleanup(void)
{
driver_unregister(&smc_driver);
platform_driver_unregister(&smc_driver);
}
module_init(smc_init);
......
......@@ -344,9 +344,10 @@ module_param_array(dma, int, NULL, 0);
static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS];
static struct device_driver proteon_driver = {
.name = "proteon",
.bus = &platform_bus_type,
static struct platform_driver proteon_driver = {
.driver = {
.name = "proteon",
},
};
static int __init proteon_init(void)
......@@ -355,7 +356,7 @@ static int __init proteon_init(void)
struct platform_device *pdev;
int i, num = 0, err = 0;
err = driver_register(&proteon_driver);
err = platform_driver_register(&proteon_driver);
if (err)
return err;
......@@ -372,7 +373,7 @@ static int __init proteon_init(void)
err = setup_card(dev, &pdev->dev);
if (!err) {
proteon_dev[i] = pdev;
dev_set_drvdata(&pdev->dev, dev);
platform_set_drvdata(pdev, dev);
++num;
} else {
platform_device_unregister(pdev);
......@@ -399,17 +400,17 @@ static void __exit proteon_cleanup(void)
if (!pdev)
continue;
dev = dev_get_drvdata(&pdev->dev);
dev = platform_get_drvdata(pdev);
unregister_netdev(dev);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
free_netdev(dev);
dev_set_drvdata(&pdev->dev, NULL);
platform_set_drvdata(pdev, NULL);
platform_device_unregister(pdev);
}
driver_unregister(&proteon_driver);
platform_driver_unregister(&proteon_driver);
}
module_init(proteon_init);
......
......@@ -354,9 +354,10 @@ module_param_array(dma, int, NULL, 0);
static struct platform_device *sk_isa_dev[ISATR_MAX_ADAPTERS];
static struct device_driver sk_isa_driver = {
.name = "skisa",
.bus = &platform_bus_type,
static struct platform_driver sk_isa_driver = {
.driver = {
.name = "skisa",
},
};
static int __init sk_isa_init(void)
......@@ -365,7 +366,7 @@ static int __init sk_isa_init(void)
struct platform_device *pdev;
int i, num = 0, err = 0;
err = driver_register(&sk_isa_driver);
err = platform_driver_register(&sk_isa_driver);
if (err)
return err;
......@@ -382,7 +383,7 @@ static int __init sk_isa_init(void)
err = setup_card(dev, &pdev->dev);
if (!err) {
sk_isa_dev[i] = pdev;
dev_set_drvdata(&sk_isa_dev[i]->dev, dev);
platform_set_drvdata(sk_isa_dev[i], dev);
++num;
} else {
platform_device_unregister(pdev);
......@@ -409,17 +410,17 @@ static void __exit sk_isa_cleanup(void)
if (!pdev)
continue;
dev = dev_get_drvdata(&pdev->dev);
dev = platform_get_drvdata(pdev);
unregister_netdev(dev);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
free_netdev(dev);
dev_set_drvdata(&pdev->dev, NULL);
platform_set_drvdata(pdev, NULL);
platform_device_unregister(pdev);
}
driver_unregister(&sk_isa_driver);
platform_driver_unregister(&sk_isa_driver);
}
module_init(sk_isa_init);
......
......@@ -2381,9 +2381,9 @@ void serial8250_resume_port(int line)
* list is terminated with a zero flags entry, which means we expect
* all entries to have at least UPF_BOOT_AUTOCONF set.
*/
static int __devinit serial8250_probe(struct 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;
int ret, i;
......@@ -2399,12 +2399,12 @@ static int __devinit serial8250_probe(struct device *dev)
port.flags = p->flags;
port.mapbase = p->mapbase;
port.hub6 = p->hub6;
port.dev = dev;
port.dev = &dev->dev;
if (share_irqs)
port.flags |= UPF_SHARE_IRQ;
ret = serial8250_register_port(&port);
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,
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.
*/
static int __devexit serial8250_remove(struct device *dev)
static int __devexit serial8250_remove(struct platform_device *dev)
{
int i;
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
if (up->port.dev == dev)
if (up->port.dev == &dev->dev)
serial8250_unregister_port(i);
}
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;
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
if (up->port.type != PORT_UNKNOWN && up->port.dev == dev)
if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
uart_suspend_port(&serial8250_reg, &up->port);
}
return 0;
}
static int serial8250_resume(struct device *dev)
static int serial8250_resume(struct platform_device *dev)
{
int i;
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
if (up->port.type != PORT_UNKNOWN && up->port.dev == dev)
if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
uart_resume_port(&serial8250_reg, &up->port);
}
return 0;
}
static struct device_driver serial8250_isa_driver = {
.name = "serial8250",
.bus = &platform_bus_type,
static struct platform_driver serial8250_isa_driver = {
.probe = serial8250_probe,
.remove = __devexit_p(serial8250_remove),
.suspend = serial8250_suspend,
.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);
ret = driver_register(&serial8250_isa_driver);
ret = platform_driver_register(&serial8250_isa_driver);
if (ret == 0)
goto out;
......@@ -2630,7 +2631,7 @@ static void __exit serial8250_exit(void)
*/
serial8250_isa_devs = NULL;
driver_unregister(&serial8250_isa_driver);
platform_driver_unregister(&serial8250_isa_driver);
platform_device_unregister(isa_dev);
uart_unregister_driver(&serial8250_reg);
......
......@@ -921,9 +921,9 @@ static struct uart_driver imx_reg = {
.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)
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;
}
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)
uart_resume_port(&imx_reg, &sport->port);
......@@ -941,21 +941,19 @@ static int serial_imx_resume(struct device *_dev)
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;
imx_ports[dev->id].port.dev = &dev->dev;
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;
}
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)
uart_remove_one_port(&imx_reg, &sport->port);
......@@ -963,14 +961,15 @@ static int serial_imx_remove(struct device *_dev)
return 0;
}
static struct device_driver serial_imx_driver = {
.name = "imx-uart",
.bus = &platform_bus_type,
static struct platform_driver serial_imx_driver = {
.probe = serial_imx_probe,
.remove = serial_imx_remove,
.suspend = serial_imx_suspend,
.resume = serial_imx_resume,
.driver = {
.name = "imx-uart",
},
};
static int __init imx_serial_init(void)
......@@ -985,7 +984,7 @@ static int __init imx_serial_init(void)
if (ret)
return ret;
ret = driver_register(&serial_imx_driver);
ret = platform_driver_register(&serial_imx_driver);
if (ret != 0)
uart_unregister_driver(&imx_reg);
......
......@@ -717,10 +717,9 @@ static struct uart_driver mpc52xx_uart_driver = {
/* ======================================================================== */
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 = pdev->resource;
struct resource *res = dev->resource;
struct uart_port *port = NULL;
int i, idx, ret;
......@@ -761,17 +760,17 @@ mpc52xx_uart_probe(struct device *dev)
/* Add the port to the uart sub-system */
ret = uart_add_one_port(&mpc52xx_uart_driver, port);
if (!ret)
dev_set_drvdata(dev, (void*)port);
platform_set_drvdata(dev, (void*)port);
return ret;
}
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)
uart_remove_one_port(&mpc52xx_uart_driver, port);
......@@ -781,9 +780,9 @@ mpc52xx_uart_remove(struct device *dev)
#ifdef CONFIG_PM
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)
uart_suspend_port(&mpc52xx_uart_driver, port);
......@@ -792,9 +791,9 @@ mpc52xx_uart_suspend(struct device *dev, pm_message_t state)
}
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)
uart_resume_port(&mpc52xx_uart_driver, port);
......@@ -803,15 +802,16 @@ mpc52xx_uart_resume(struct device *dev)
}
#endif
static struct device_driver mpc52xx_uart_platform_driver = {
.name = "mpc52xx-psc",
.bus = &platform_bus_type,
static struct platform_driver mpc52xx_uart_platform_driver = {
.probe = mpc52xx_uart_probe,
.remove = mpc52xx_uart_remove,
#ifdef CONFIG_PM
.suspend = mpc52xx_uart_suspend,
.resume = mpc52xx_uart_resume,
#endif
.driver = {
.name = "mpc52xx-psc",
},
};
......@@ -828,7 +828,7 @@ mpc52xx_uart_init(void)
ret = uart_register_driver(&mpc52xx_uart_driver);
if (ret == 0) {
ret = driver_register(&mpc52xx_uart_platform_driver);
ret = platform_driver_register(&mpc52xx_uart_platform_driver);
if (ret)
uart_unregister_driver(&mpc52xx_uart_driver);
}
......@@ -839,7 +839,7 @@ mpc52xx_uart_init(void)
static void __exit
mpc52xx_uart_exit(void)
{
driver_unregister(&mpc52xx_uart_platform_driver);
platform_driver_unregister(&mpc52xx_uart_platform_driver);
uart_unregister_driver(&mpc52xx_uart_driver);
}
......
......@@ -1551,15 +1551,14 @@ mpsc_shared_unmap_regs(void)
}
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;
int rc = -ENODEV;
if (pd->id == 0) {
if (!(rc = mpsc_shared_map_regs(pd))) {
pdata = (struct mpsc_shared_pdata *)dev->platform_data;
if (dev->id == 0) {
if (!(rc = mpsc_shared_map_regs(dev))) {
pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
......@@ -1577,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev)
}
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;
if (pd->id == 0) {
if (dev->id == 0) {
mpsc_shared_unmap_regs();
mpsc_shared_regs.MPSC_MRR_m = 0;
mpsc_shared_regs.MPSC_RCRR_m = 0;
......@@ -1595,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev)
return rc;
}
static struct device_driver mpsc_shared_driver = {
.name = MPSC_SHARED_NAME,
.bus = &platform_bus_type,
static struct platform_driver mpsc_shared_driver = {
.probe = mpsc_shared_drv_probe,
.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
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;
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) {
pi = &mpsc_ports[pd->id];
if (dev->id < MPSC_NUM_CTLRS) {
pi = &mpsc_ports[dev->id];
if (!(rc = mpsc_drv_map_regs(pi, pd))) {
mpsc_drv_get_platform_data(pi, pd, pd->id);
if (!(rc = mpsc_drv_map_regs(pi, dev))) {
mpsc_drv_get_platform_data(pi, dev, dev->id);
if (!(rc = mpsc_make_ready(pi)))
if (!(rc = uart_add_one_port(&mpsc_reg,
......@@ -1764,27 +1762,26 @@ mpsc_drv_probe(struct device *dev)
}
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 (pd->id < MPSC_NUM_CTLRS) {
uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port);
mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port);
mpsc_drv_unmap_regs(&mpsc_ports[pd->id]);
if (dev->id < MPSC_NUM_CTLRS) {
uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
return 0;
}
else
return -ENODEV;
}
static struct device_driver mpsc_driver = {
.name = MPSC_CTLR_NAME,
.bus = &platform_bus_type,
static struct platform_driver mpsc_driver = {
.probe = mpsc_drv_probe,
.remove = mpsc_drv_remove,
.driver = {
.name = MPSC_CTLR_NAME,
},
};
static int __init
......@@ -1798,9 +1795,9 @@ mpsc_drv_init(void)
memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
if (!(rc = uart_register_driver(&mpsc_reg))) {
if (!(rc = driver_register(&mpsc_shared_driver))) {
if ((rc = driver_register(&mpsc_driver))) {
driver_unregister(&mpsc_shared_driver);
if (!(rc = platform_driver_register(&mpsc_shared_driver))) {
if ((rc = platform_driver_register(&mpsc_driver))) {
platform_driver_unregister(&mpsc_shared_driver);
uart_unregister_driver(&mpsc_reg);
}
}
......@@ -1815,8 +1812,8 @@ mpsc_drv_init(void)
static void __exit
mpsc_drv_exit(void)
{
driver_unregister(&mpsc_driver);
driver_unregister(&mpsc_shared_driver);
platform_driver_unregister(&mpsc_driver);
platform_driver_unregister(&mpsc_shared_driver);
uart_unregister_driver(&mpsc_reg);
memset(mpsc_ports, 0, sizeof(mpsc_ports));
memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
......
......@@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = {
.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)
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;
}
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)
uart_resume_port(&serial_pxa_reg, &sport->port);
......@@ -825,21 +825,19 @@ static int serial_pxa_resume(struct device *_dev)
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;
serial_pxa_ports[dev->id].port.dev = &dev->dev;
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;
}
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)
uart_remove_one_port(&serial_pxa_reg, &sport->port);
......@@ -847,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev)
return 0;
}
static struct device_driver serial_pxa_driver = {
.name = "pxa2xx-uart",
.bus = &platform_bus_type,
static struct platform_driver serial_pxa_driver = {
.probe = serial_pxa_probe,
.remove = serial_pxa_remove,
.suspend = serial_pxa_suspend,
.resume = serial_pxa_resume,
.driver = {
.name = "pxa2xx-uart",
},
};
int __init serial_pxa_init(void)
......@@ -865,7 +864,7 @@ int __init serial_pxa_init(void)
if (ret != 0)
return ret;
ret = driver_register(&serial_pxa_driver);
ret = platform_driver_register(&serial_pxa_driver);
if (ret != 0)
uart_unregister_driver(&serial_pxa_reg);
......@@ -874,7 +873,7 @@ int __init serial_pxa_init(void)
void __exit serial_pxa_exit(void)
{
driver_unregister(&serial_pxa_driver);
platform_driver_unregister(&serial_pxa_driver);
uart_unregister_driver(&serial_pxa_reg);
}
......
......@@ -1092,14 +1092,13 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
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_port *ourport;
struct platform_device *dev = to_platform_device(_dev);
int ret;
dbg("s3c24xx_serial_probe(%p, %p) %d\n", _dev, info, probe_index);
dbg("s3c24xx_serial_probe(%p, %p) %d\n", dev, info, probe_index);
ourport = &s3c24xx_serial_ports[probe_index];
probe_index++;
......@@ -1112,7 +1111,7 @@ static int s3c24xx_serial_probe(struct device *_dev,
dbg("%s: adding port\n", __FUNCTION__);
uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
dev_set_drvdata(_dev, &ourport->port);
platform_set_drvdata(dev, &ourport->port);
return 0;
......@@ -1120,9 +1119,9 @@ static int s3c24xx_serial_probe(struct device *_dev,
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)
uart_remove_one_port(&s3c24xx_uart_drv, port);
......@@ -1134,9 +1133,9 @@ static int s3c24xx_serial_remove(struct device *_dev)
#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)
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;
}
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);
if (port) {
......@@ -1165,11 +1164,11 @@ static int s3c24xx_serial_resume(struct device *dev)
#define s3c24xx_serial_resume NULL
#endif
static int s3c24xx_serial_init(struct device_driver *drv,
static int s3c24xx_serial_init(struct platform_driver *drv,
struct s3c24xx_uart_info *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,
};
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);
}
static struct device_driver s3c2400_serial_drv = {
.name = "s3c2400-uart",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver s3c2400_serial_drv = {
.probe = s3c2400_serial_probe,
.remove = s3c24xx_serial_remove,
.suspend = s3c24xx_serial_suspend,
.resume = s3c24xx_serial_resume,
.driver = {
.name = "s3c2400-uart",
.owner = THIS_MODULE,
},
};
static inline int s3c2400_serial_init(void)
......@@ -1250,7 +1250,7 @@ static inline int s3c2400_serial_init(void)
static inline void s3c2400_serial_exit(void)
{
driver_unregister(&s3c2400_serial_drv);
platform_driver_unregister(&s3c2400_serial_drv);
}
#define s3c2400_uart_inf_at &s3c2400_uart_inf
......@@ -1332,19 +1332,20 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = {
/* 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);
}
static struct device_driver s3c2410_serial_drv = {
.name = "s3c2410-uart",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver s3c2410_serial_drv = {
.probe = s3c2410_serial_probe,
.remove = s3c24xx_serial_remove,
.suspend = s3c24xx_serial_suspend,
.resume = s3c24xx_serial_resume,
.driver = {
.name = "s3c2410-uart",
.owner = THIS_MODULE,
},
};
static inline int s3c2410_serial_init(void)
......@@ -1354,7 +1355,7 @@ static inline int s3c2410_serial_init(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
......@@ -1493,20 +1494,21 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = {
/* 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);
return s3c24xx_serial_probe(dev, &s3c2440_uart_inf);
}
static struct device_driver s3c2440_serial_drv = {
.name = "s3c2440-uart",
.owner = THIS_MODULE,
.bus = &platform_bus_type,
static struct platform_driver s3c2440_serial_drv = {
.probe = s3c2440_serial_probe,
.remove = s3c24xx_serial_remove,
.suspend = s3c24xx_serial_suspend,
.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)
{
driver_unregister(&s3c2440_serial_drv);
platform_driver_unregister(&s3c2440_serial_drv);
}
#define s3c2440_uart_inf_at &s3c2440_uart_inf
......
......@@ -834,9 +834,9 @@ static struct uart_driver sa1100_reg = {
.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)
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;
}
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)
uart_resume_port(&sa1100_reg, &sport->port);
......@@ -854,9 +854,8 @@ static int sa1100_serial_resume(struct device *_dev)
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;
int i;
......@@ -869,9 +868,9 @@ static int sa1100_serial_probe(struct device *_dev)
if (sa1100_ports[i].port.mapbase != res->start)
continue;
sa1100_ports[i].port.dev = _dev;
sa1100_ports[i].port.dev = &dev->dev;
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;
}
}
......@@ -879,11 +878,11 @@ static int sa1100_serial_probe(struct device *_dev)
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)
uart_remove_one_port(&sa1100_reg, &sport->port);
......@@ -891,13 +890,14 @@ static int sa1100_serial_remove(struct device *_dev)
return 0;
}
static struct device_driver sa11x0_serial_driver = {
.name = "sa11x0-uart",
.bus = &platform_bus_type,
static struct platform_driver sa11x0_serial_driver = {
.probe = sa1100_serial_probe,
.remove = sa1100_serial_remove,
.suspend = sa1100_serial_suspend,
.resume = sa1100_serial_resume,
.driver = {
.name = "sa11x0-uart",
},
};
static int __init sa1100_serial_init(void)
......@@ -910,7 +910,7 @@ static int __init sa1100_serial_init(void)
ret = uart_register_driver(&sa1100_reg);
if (ret == 0) {
ret = driver_register(&sa11x0_serial_driver);
ret = platform_driver_register(&sa11x0_serial_driver);
if (ret)
uart_unregister_driver(&sa1100_reg);
}
......@@ -919,7 +919,7 @@ static int __init sa1100_serial_init(void)
static void __exit sa1100_serial_exit(void)
{
driver_unregister(&sa11x0_serial_driver);
platform_driver_unregister(&sa11x0_serial_driver);
uart_unregister_driver(&sa1100_reg);
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部