aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/ibmtr_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:21:18 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 17:59:02 -0500
commit98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch)
treeb3d46f0643352e541d6a39e6da09059687cf713d /drivers/net/pcmcia/ibmtr_cs.c
parent63e7ebd06402951bc8863ba5b7bc9b9f42044849 (diff)
[PATCH] pcmcia: new suspend core
Move the suspend and resume methods out of the event handler, and into special functions. Also use these functions for pre- and post-reset, as almost all drivers already do, and the remaining ones can easily be converted. Bugfix to include/pcmcia/ds.c Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia/ibmtr_cs.c')
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c59
1 files changed, 37 insertions, 22 deletions
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index b6c140eb9799..3a7218e51b73 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -401,6 +401,41 @@ static void ibmtr_release(dev_link_t *link)
401 link->state &= ~DEV_CONFIG; 401 link->state &= ~DEV_CONFIG;
402} 402}
403 403
404static int ibmtr_suspend(struct pcmcia_device *p_dev)
405{
406 dev_link_t *link = dev_to_instance(p_dev);
407 ibmtr_dev_t *info = link->priv;
408 struct net_device *dev = info->dev;
409
410 link->state |= DEV_SUSPEND;
411 if (link->state & DEV_CONFIG) {
412 if (link->open)
413 netif_device_detach(dev);
414 pcmcia_release_configuration(link->handle);
415 }
416
417 return 0;
418}
419
420static int ibmtr_resume(struct pcmcia_device *p_dev)
421{
422 dev_link_t *link = dev_to_instance(p_dev);
423 ibmtr_dev_t *info = link->priv;
424 struct net_device *dev = info->dev;
425
426 link->state &= ~DEV_SUSPEND;
427 if (link->state & DEV_CONFIG) {
428 pcmcia_request_configuration(link->handle, &link->conf);
429 if (link->open) {
430 ibmtr_probe(dev); /* really? */
431 netif_device_attach(dev);
432 }
433 }
434
435 return 0;
436}
437
438
404/*====================================================================== 439/*======================================================================
405 440
406 The card status event handler. Mostly, this schedules other 441 The card status event handler. Mostly, this schedules other
@@ -433,28 +468,6 @@ static int ibmtr_event(event_t event, int priority,
433 link->state |= DEV_PRESENT; 468 link->state |= DEV_PRESENT;
434 ibmtr_config(link); 469 ibmtr_config(link);
435 break; 470 break;
436 case CS_EVENT_PM_SUSPEND:
437 link->state |= DEV_SUSPEND;
438 /* Fall through... */
439 case CS_EVENT_RESET_PHYSICAL:
440 if (link->state & DEV_CONFIG) {
441 if (link->open)
442 netif_device_detach(dev);
443 pcmcia_release_configuration(link->handle);
444 }
445 break;
446 case CS_EVENT_PM_RESUME:
447 link->state &= ~DEV_SUSPEND;
448 /* Fall through... */
449 case CS_EVENT_CARD_RESET:
450 if (link->state & DEV_CONFIG) {
451 pcmcia_request_configuration(link->handle, &link->conf);
452 if (link->open) {
453 ibmtr_probe(dev); /* really? */
454 netif_device_attach(dev);
455 }
456 }
457 break;
458 } 471 }
459 return 0; 472 return 0;
460} /* ibmtr_event */ 473} /* ibmtr_event */
@@ -518,6 +531,8 @@ static struct pcmcia_driver ibmtr_cs_driver = {
518 .event = ibmtr_event, 531 .event = ibmtr_event,
519 .detach = ibmtr_detach, 532 .detach = ibmtr_detach,
520 .id_table = ibmtr_ids, 533 .id_table = ibmtr_ids,
534 .suspend = ibmtr_suspend,
535 .resume = ibmtr_resume,
521}; 536};
522 537
523static int __init init_ibmtr_cs(void) 538static int __init init_ibmtr_cs(void)