mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually remove the use of the device_driver function pointer methods for platform device drivers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Russell King
parent
00d3dcdd96
commit
3ae5eaec1d
@@ -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(¨_net_driver);
|
||||
platform_driver_register(¨_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 @@ out:
|
||||
|
||||
/* 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 @@ out:
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user