Commit 5dbb10ef authored by Russell King's avatar Russell King

[PCMCIA] Convert sa11xx platforms to use new class code.

parent 3bb31f0d
...@@ -106,17 +106,8 @@ static struct device_driver sa11x0_pcmcia_driver = { ...@@ -106,17 +106,8 @@ static struct device_driver sa11x0_pcmcia_driver = {
.remove = sa11xx_drv_pcmcia_remove, .remove = sa11xx_drv_pcmcia_remove,
.name = "sa11x0-pcmcia", .name = "sa11x0-pcmcia",
.bus = &platform_bus_type, .bus = &platform_bus_type,
.devclass = &pcmcia_socket_class, /* .suspend = pcmcia_socket_dev_suspend,*/
.suspend = pcmcia_socket_dev_suspend, /* .resume = pcmcia_socket_dev_resume,*/
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device sa11x0_pcmcia_device = {
.name = "sa11x0-pcmcia",
.id = 0,
.dev = {
.name = "Intel Corporation SA11x0 [PCMCIA]",
},
}; };
/* sa11x0_pcmcia_init() /* sa11x0_pcmcia_init()
...@@ -129,16 +120,7 @@ static struct platform_device sa11x0_pcmcia_device = { ...@@ -129,16 +120,7 @@ static struct platform_device sa11x0_pcmcia_device = {
*/ */
static int __init sa11x0_pcmcia_init(void) static int __init sa11x0_pcmcia_init(void)
{ {
int ret; return driver_register(&sa11x0_pcmcia_driver);
ret = driver_register(&sa11x0_pcmcia_driver);
if (ret == 0) {
ret = platform_device_register(&sa11x0_pcmcia_device);
if (ret)
driver_unregister(&sa11x0_pcmcia_driver);
}
return ret;
} }
/* sa11x0_pcmcia_exit() /* sa11x0_pcmcia_exit()
...@@ -148,7 +130,6 @@ static int __init sa11x0_pcmcia_init(void) ...@@ -148,7 +130,6 @@ static int __init sa11x0_pcmcia_init(void)
*/ */
static void __exit sa11x0_pcmcia_exit(void) static void __exit sa11x0_pcmcia_exit(void)
{ {
platform_device_unregister(&sa11x0_pcmcia_device);
driver_unregister(&sa11x0_pcmcia_driver); driver_unregister(&sa11x0_pcmcia_driver);
} }
......
...@@ -178,8 +178,8 @@ static struct sa1111_driver pcmcia_driver = { ...@@ -178,8 +178,8 @@ static struct sa1111_driver pcmcia_driver = {
.bus = &sa1111_bus_type, .bus = &sa1111_bus_type,
.probe = pcmcia_probe, .probe = pcmcia_probe,
.remove = __devexit_p(pcmcia_remove), .remove = __devexit_p(pcmcia_remove),
.suspend = pcmcia_socket_dev_suspend, /* .suspend = pcmcia_socket_dev_suspend,*/
.resume = pcmcia_socket_dev_resume, /* .resume = pcmcia_socket_dev_resume,*/
}, },
.devid = SA1111_DEVID_PCMCIA, .devid = SA1111_DEVID_PCMCIA,
}; };
......
...@@ -822,6 +822,10 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, in ...@@ -822,6 +822,10 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, in
memset(cls, 0, sizeof(struct pcmcia_socket_class_data)); memset(cls, 0, sizeof(struct pcmcia_socket_class_data));
cls->ops = &sa11xx_pcmcia_operations; cls->ops = &sa11xx_pcmcia_operations;
cls->nsock = nr; cls->nsock = nr;
cls->class_dev.class = &pcmcia_socket_class;
cls->class_dev.dev = dev;
strlcpy(cls->class_dev.class_id, dev->bus_id, BUS_ID_SIZE);
class_set_devdata(&cls->class_dev, cls);
cpu_clock = cpufreq_get(0); cpu_clock = cpufreq_get(0);
...@@ -901,7 +905,9 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, in ...@@ -901,7 +905,9 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, in
add_timer(&skt->poll_timer); add_timer(&skt->poll_timer);
} }
dev->class_data = cls; dev_set_drvdata(dev, cls);
class_device_register(&cls->class_dev);
return 0; return 0;
do { do {
...@@ -934,10 +940,11 @@ EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); ...@@ -934,10 +940,11 @@ EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);
int sa11xx_drv_pcmcia_remove(struct device *dev) int sa11xx_drv_pcmcia_remove(struct device *dev)
{ {
struct pcmcia_socket_class_data *cls = dev->class_data; struct pcmcia_socket_class_data *cls = dev_get_drvdata(dev);
int i; int i;
dev->class_data = NULL; class_device_unregister(&cls->class_dev);
dev_set_drvdata(dev, NULL);
for (i = 0; i < cls->nsock; i++) { for (i = 0; i < cls->nsock; i++) {
struct sa1100_pcmcia_socket *skt = PCMCIA_SOCKET(cls->sock_offset + i); struct sa1100_pcmcia_socket *skt = PCMCIA_SOCKET(cls->sock_offset + i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment