aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/omap_cf.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-04-08 19:04:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-08 22:47:55 -0400
commitb6d2cccb55b518956a7de75182757276a2057869 (patch)
tree3fd7796ccfb5a2feb414eef3a11ac4a629059505 /drivers/pcmcia/omap_cf.c
parent49f19710512c825aaea73b9207b3a848027cda1d (diff)
[PATCH] omap_cf: oops-on-suspend fix
Convert omap_cf into a platform_driver ... this resolves oopsing during suspend/resume. Evidently folk haven't tried suspend/resume on an OSK (the main platform for this driver) since September or so, which is when platform_device learned about suspend_late()/resume_early() and stopped being able to suspend/resume without a platform_driver. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pcmcia/omap_cf.c')
-rw-r--r--drivers/pcmcia/omap_cf.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index d77f75129f8a..2df216b00817 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -202,15 +202,14 @@ static struct pccard_operations omap_cf_ops = {
202 * "what chipselect is used". Boards could want more. 202 * "what chipselect is used". Boards could want more.
203 */ 203 */
204 204
205static int __devinit omap_cf_probe(struct device *dev) 205static int __init omap_cf_probe(struct platform_device *pdev)
206{ 206{
207 unsigned seg; 207 unsigned seg;
208 struct omap_cf_socket *cf; 208 struct omap_cf_socket *cf;
209 struct platform_device *pdev = to_platform_device(dev);
210 int irq; 209 int irq;
211 int status; 210 int status;
212 211
213 seg = (int) dev->platform_data; 212 seg = (int) pdev->dev.platform_data;
214 if (seg == 0 || seg > 3) 213 if (seg == 0 || seg > 3)
215 return -ENODEV; 214 return -ENODEV;
216 215
@@ -227,7 +226,7 @@ static int __devinit omap_cf_probe(struct device *dev)
227 cf->timer.data = (unsigned long) cf; 226 cf->timer.data = (unsigned long) cf;
228 227
229 cf->pdev = pdev; 228 cf->pdev = pdev;
230 dev_set_drvdata(dev, cf); 229 platform_set_drvdata(pdev, cf);
231 230
232 /* this primarily just shuts up irq handling noise */ 231 /* this primarily just shuts up irq handling noise */
233 status = request_irq(irq, omap_cf_irq, IRQF_SHARED, 232 status = request_irq(irq, omap_cf_irq, IRQF_SHARED,
@@ -291,7 +290,7 @@ static int __devinit omap_cf_probe(struct device *dev)
291 omap_cf_present() ? "present" : "(not present)"); 290 omap_cf_present() ? "present" : "(not present)");
292 291
293 cf->socket.owner = THIS_MODULE; 292 cf->socket.owner = THIS_MODULE;
294 cf->socket.dev.parent = dev; 293 cf->socket.dev.parent = &pdev->dev;
295 cf->socket.ops = &omap_cf_ops; 294 cf->socket.ops = &omap_cf_ops;
296 cf->socket.resource_ops = &pccard_static_ops; 295 cf->socket.resource_ops = &pccard_static_ops;
297 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP 296 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP
@@ -318,9 +317,9 @@ fail0:
318 return status; 317 return status;
319} 318}
320 319
321static int __devexit omap_cf_remove(struct device *dev) 320static int __exit omap_cf_remove(struct platform_device *pdev)
322{ 321{
323 struct omap_cf_socket *cf = dev_get_drvdata(dev); 322 struct omap_cf_socket *cf = platform_get_drvdata(pdev);
324 323
325 cf->active = 0; 324 cf->active = 0;
326 pcmcia_unregister_socket(&cf->socket); 325 pcmcia_unregister_socket(&cf->socket);
@@ -332,26 +331,36 @@ static int __devexit omap_cf_remove(struct device *dev)
332 return 0; 331 return 0;
333} 332}
334 333
335static struct device_driver omap_cf_driver = { 334static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
336 .name = (char *) driver_name, 335{
337 .bus = &platform_bus_type, 336 return pcmcia_socket_dev_suspend(&pdev->dev, mesg);
338 .probe = omap_cf_probe, 337}
339 .remove = __devexit_p(omap_cf_remove), 338
340 .suspend = pcmcia_socket_dev_suspend, 339static int omap_cf_resume(struct platform_device *pdev)
341 .resume = pcmcia_socket_dev_resume, 340{
341 return pcmcia_socket_dev_resume(&pdev->dev);
342}
343
344static struct platform_driver omap_cf_driver = {
345 .driver = {
346 .name = (char *) driver_name,
347 },
348 .remove = __exit_p(omap_cf_remove),
349 .suspend = omap_cf_suspend,
350 .resume = omap_cf_resume,
342}; 351};
343 352
344static int __init omap_cf_init(void) 353static int __init omap_cf_init(void)
345{ 354{
346 if (cpu_is_omap16xx()) 355 if (cpu_is_omap16xx())
347 return driver_register(&omap_cf_driver); 356 return platform_driver_probe(&omap_cf_driver, omap_cf_probe);
348 return -ENODEV; 357 return -ENODEV;
349} 358}
350 359
351static void __exit omap_cf_exit(void) 360static void __exit omap_cf_exit(void)
352{ 361{
353 if (cpu_is_omap16xx()) 362 if (cpu_is_omap16xx())
354 driver_unregister(&omap_cf_driver); 363 platform_driver_unregister(&omap_cf_driver);
355} 364}
356 365
357module_init(omap_cf_init); 366module_init(omap_cf_init);