aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
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/isdn
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/isdn')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c38
-rw-r--r--drivers/isdn/hisax/avma1_cs.c38
-rw-r--r--drivers/isdn/hisax/elsa_cs.c46
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c50
-rw-r--r--drivers/isdn/hisax/teles_cs.c46
5 files changed, 132 insertions, 86 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 27391c32f3eb..6d9816e10ecb 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -430,6 +430,28 @@ static void avmcs_release(dev_link_t *link)
430 430
431} /* avmcs_release */ 431} /* avmcs_release */
432 432
433static int avmcs_suspend(struct pcmcia_device *dev)
434{
435 dev_link_t *link = dev_to_instance(dev);
436
437 link->state |= DEV_SUSPEND;
438 if (link->state & DEV_CONFIG)
439 pcmcia_release_configuration(link->handle);
440
441 return 0;
442}
443
444static int avmcs_resume(struct pcmcia_device *dev)
445{
446 dev_link_t *link = dev_to_instance(dev);
447
448 link->state &= ~DEV_SUSPEND;
449 if (link->state & DEV_CONFIG)
450 pcmcia_request_configuration(link->handle, &link->conf);
451
452 return 0;
453}
454
433/*====================================================================== 455/*======================================================================
434 456
435 The card status event handler. Mostly, this schedules other 457 The card status event handler. Mostly, this schedules other
@@ -459,20 +481,6 @@ static int avmcs_event(event_t event, int priority,
459 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 481 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
460 avmcs_config(link); 482 avmcs_config(link);
461 break; 483 break;
462 case CS_EVENT_PM_SUSPEND:
463 link->state |= DEV_SUSPEND;
464 /* Fall through... */
465 case CS_EVENT_RESET_PHYSICAL:
466 if (link->state & DEV_CONFIG)
467 pcmcia_release_configuration(link->handle);
468 break;
469 case CS_EVENT_PM_RESUME:
470 link->state &= ~DEV_SUSPEND;
471 /* Fall through... */
472 case CS_EVENT_CARD_RESET:
473 if (link->state & DEV_CONFIG)
474 pcmcia_request_configuration(link->handle, &link->conf);
475 break;
476 } 484 }
477 return 0; 485 return 0;
478} /* avmcs_event */ 486} /* avmcs_event */
@@ -494,6 +502,8 @@ static struct pcmcia_driver avmcs_driver = {
494 .event = avmcs_event, 502 .event = avmcs_event,
495 .detach = avmcs_detach, 503 .detach = avmcs_detach,
496 .id_table = avmcs_ids, 504 .id_table = avmcs_ids,
505 .suspend= avmcs_suspend,
506 .resume = avmcs_resume,
497}; 507};
498 508
499static int __init avmcs_init(void) 509static int __init avmcs_init(void)
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 5f5a5ae740d2..433cec4269a3 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -445,6 +445,28 @@ static void avma1cs_release(dev_link_t *link)
445 avma1cs_detach(link); 445 avma1cs_detach(link);
446} /* avma1cs_release */ 446} /* avma1cs_release */
447 447
448static int avma1cs_suspend(struct pcmcia_device *dev)
449{
450 dev_link_t *link = dev_to_instance(dev);
451
452 link->state |= DEV_SUSPEND;
453 if (link->state & DEV_CONFIG)
454 pcmcia_release_configuration(link->handle);
455
456 return 0;
457}
458
459static int avma1cs_resume(struct pcmcia_device *dev)
460{
461 dev_link_t *link = dev_to_instance(dev);
462
463 link->state &= ~DEV_SUSPEND;
464 if (link->state & DEV_CONFIG)
465 pcmcia_request_configuration(link->handle, &link->conf);
466
467 return 0;
468}
469
448/*====================================================================== 470/*======================================================================
449 471
450 The card status event handler. Mostly, this schedules other 472 The card status event handler. Mostly, this schedules other
@@ -475,20 +497,6 @@ static int avma1cs_event(event_t event, int priority,
475 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 497 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
476 avma1cs_config(link); 498 avma1cs_config(link);
477 break; 499 break;
478 case CS_EVENT_PM_SUSPEND:
479 link->state |= DEV_SUSPEND;
480 /* Fall through... */
481 case CS_EVENT_RESET_PHYSICAL:
482 if (link->state & DEV_CONFIG)
483 pcmcia_release_configuration(link->handle);
484 break;
485 case CS_EVENT_PM_RESUME:
486 link->state &= ~DEV_SUSPEND;
487 /* Fall through... */
488 case CS_EVENT_CARD_RESET:
489 if (link->state & DEV_CONFIG)
490 pcmcia_request_configuration(link->handle, &link->conf);
491 break;
492 } 500 }
493 return 0; 501 return 0;
494} /* avma1cs_event */ 502} /* avma1cs_event */
@@ -509,6 +517,8 @@ static struct pcmcia_driver avma1cs_driver = {
509 .event = avma1cs_event, 517 .event = avma1cs_event,
510 .detach = avma1cs_detach, 518 .detach = avma1cs_detach,
511 .id_table = avma1cs_ids, 519 .id_table = avma1cs_ids,
520 .suspend = avma1cs_suspend,
521 .resume = avma1cs_resume,
512}; 522};
513 523
514/*====================================================================*/ 524/*====================================================================*/
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 6fc6868de0b0..0cbe04593d87 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -447,6 +447,32 @@ static void elsa_cs_release(dev_link_t *link)
447 link->state &= ~DEV_CONFIG; 447 link->state &= ~DEV_CONFIG;
448} /* elsa_cs_release */ 448} /* elsa_cs_release */
449 449
450static int elsa_suspend(struct pcmcia_device *p_dev)
451{
452 dev_link_t *link = dev_to_instance(p_dev);
453 local_info_t *dev = link->priv;
454
455 link->state |= DEV_SUSPEND;
456 dev->busy = 1;
457 if (link->state & DEV_CONFIG)
458 pcmcia_release_configuration(link->handle);
459
460 return 0;
461}
462
463static int elsa_resume(struct pcmcia_device *p_dev)
464{
465 dev_link_t *link = dev_to_instance(p_dev);
466 local_info_t *dev = link->priv;
467
468 link->state &= ~DEV_SUSPEND;
469 if (link->state & DEV_CONFIG)
470 pcmcia_request_configuration(link->handle, &link->conf);
471 dev->busy = 0;
472
473 return 0;
474}
475
450/*====================================================================== 476/*======================================================================
451 477
452 The card status event handler. Mostly, this schedules other 478 The card status event handler. Mostly, this schedules other
@@ -465,7 +491,6 @@ static int elsa_cs_event(event_t event, int priority,
465 event_callback_args_t *args) 491 event_callback_args_t *args)
466{ 492{
467 dev_link_t *link = args->client_data; 493 dev_link_t *link = args->client_data;
468 local_info_t *dev = link->priv;
469 494
470 DEBUG(1, "elsa_cs_event(%d)\n", event); 495 DEBUG(1, "elsa_cs_event(%d)\n", event);
471 496
@@ -481,23 +506,6 @@ static int elsa_cs_event(event_t event, int priority,
481 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 506 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
482 elsa_cs_config(link); 507 elsa_cs_config(link);
483 break; 508 break;
484 case CS_EVENT_PM_SUSPEND:
485 link->state |= DEV_SUSPEND;
486 /* Fall through... */
487 case CS_EVENT_RESET_PHYSICAL:
488 /* Mark the device as stopped, to block IO until later */
489 dev->busy = 1;
490 if (link->state & DEV_CONFIG)
491 pcmcia_release_configuration(link->handle);
492 break;
493 case CS_EVENT_PM_RESUME:
494 link->state &= ~DEV_SUSPEND;
495 /* Fall through... */
496 case CS_EVENT_CARD_RESET:
497 if (link->state & DEV_CONFIG)
498 pcmcia_request_configuration(link->handle, &link->conf);
499 dev->busy = 0;
500 break;
501 } 509 }
502 return 0; 510 return 0;
503} /* elsa_cs_event */ 511} /* elsa_cs_event */
@@ -518,6 +526,8 @@ static struct pcmcia_driver elsa_cs_driver = {
518 .event = elsa_cs_event, 526 .event = elsa_cs_event,
519 .detach = elsa_cs_detach, 527 .detach = elsa_cs_detach,
520 .id_table = elsa_ids, 528 .id_table = elsa_ids,
529 .suspend = elsa_suspend,
530 .resume = elsa_resume,
521}; 531};
522 532
523static int __init init_elsa_cs(void) 533static int __init init_elsa_cs(void)
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index dc334aab433e..27dce7c7b760 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -553,6 +553,32 @@ static void sedlbauer_release(dev_link_t *link)
553 553
554} /* sedlbauer_release */ 554} /* sedlbauer_release */
555 555
556static int sedlbauer_suspend(struct pcmcia_device *p_dev)
557{
558 dev_link_t *link = dev_to_instance(p_dev);
559 local_info_t *dev = link->priv;
560
561 link->state |= DEV_SUSPEND;
562 dev->stop = 1;
563 if (link->state & DEV_CONFIG)
564 pcmcia_release_configuration(link->handle);
565
566 return 0;
567}
568
569static int sedlbauer_resume(struct pcmcia_device *p_dev)
570{
571 dev_link_t *link = dev_to_instance(p_dev);
572 local_info_t *dev = link->priv;
573
574 link->state &= ~DEV_SUSPEND;
575 if (link->state & DEV_CONFIG)
576 pcmcia_request_configuration(link->handle, &link->conf);
577 dev->stop = 0;
578
579 return 0;
580}
581
556/*====================================================================== 582/*======================================================================
557 583
558 The card status event handler. Mostly, this schedules other 584 The card status event handler. Mostly, this schedules other
@@ -569,7 +595,6 @@ static int sedlbauer_event(event_t event, int priority,
569 event_callback_args_t *args) 595 event_callback_args_t *args)
570{ 596{
571 dev_link_t *link = args->client_data; 597 dev_link_t *link = args->client_data;
572 local_info_t *dev = link->priv;
573 598
574 DEBUG(1, "sedlbauer_event(0x%06x)\n", event); 599 DEBUG(1, "sedlbauer_event(0x%06x)\n", event);
575 600
@@ -585,27 +610,6 @@ static int sedlbauer_event(event_t event, int priority,
585 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 610 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
586 sedlbauer_config(link); 611 sedlbauer_config(link);
587 break; 612 break;
588 case CS_EVENT_PM_SUSPEND:
589 link->state |= DEV_SUSPEND;
590 /* Fall through... */
591 case CS_EVENT_RESET_PHYSICAL:
592 /* Mark the device as stopped, to block IO until later */
593 dev->stop = 1;
594 if (link->state & DEV_CONFIG)
595 pcmcia_release_configuration(link->handle);
596 break;
597 case CS_EVENT_PM_RESUME:
598 link->state &= ~DEV_SUSPEND;
599 /* Fall through... */
600 case CS_EVENT_CARD_RESET:
601 if (link->state & DEV_CONFIG)
602 pcmcia_request_configuration(link->handle, &link->conf);
603 dev->stop = 0;
604 /*
605 In a normal driver, additional code may go here to restore
606 the device state and restart IO.
607 */
608 break;
609 } 613 }
610 return 0; 614 return 0;
611} /* sedlbauer_event */ 615} /* sedlbauer_event */
@@ -631,6 +635,8 @@ static struct pcmcia_driver sedlbauer_driver = {
631 .event = sedlbauer_event, 635 .event = sedlbauer_event,
632 .detach = sedlbauer_detach, 636 .detach = sedlbauer_detach,
633 .id_table = sedlbauer_ids, 637 .id_table = sedlbauer_ids,
638 .suspend = sedlbauer_suspend,
639 .resume = sedlbauer_resume,
634}; 640};
635 641
636static int __init init_sedlbauer_cs(void) 642static int __init init_sedlbauer_cs(void)
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 0ddef1bf778b..70213bc1d30c 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -428,6 +428,32 @@ static void teles_cs_release(dev_link_t *link)
428 link->state &= ~DEV_CONFIG; 428 link->state &= ~DEV_CONFIG;
429} /* teles_cs_release */ 429} /* teles_cs_release */
430 430
431static int teles_suspend(struct pcmcia_device *p_dev)
432{
433 dev_link_t *link = dev_to_instance(p_dev);
434 local_info_t *dev = link->priv;
435
436 link->state |= DEV_SUSPEND;
437 dev->busy = 1;
438 if (link->state & DEV_CONFIG)
439 pcmcia_release_configuration(link->handle);
440
441 return 0;
442}
443
444static int teles_resume(struct pcmcia_device *p_dev)
445{
446 dev_link_t *link = dev_to_instance(p_dev);
447 local_info_t *dev = link->priv;
448
449 link->state &= ~DEV_SUSPEND;
450 if (link->state & DEV_CONFIG)
451 pcmcia_request_configuration(link->handle, &link->conf);
452 dev->busy = 0;
453
454 return 0;
455}
456
431/*====================================================================== 457/*======================================================================
432 458
433 The card status event handler. Mostly, this schedules other 459 The card status event handler. Mostly, this schedules other
@@ -446,7 +472,6 @@ static int teles_cs_event(event_t event, int priority,
446 event_callback_args_t *args) 472 event_callback_args_t *args)
447{ 473{
448 dev_link_t *link = args->client_data; 474 dev_link_t *link = args->client_data;
449 local_info_t *dev = link->priv;
450 475
451 DEBUG(1, "teles_cs_event(%d)\n", event); 476 DEBUG(1, "teles_cs_event(%d)\n", event);
452 477
@@ -462,23 +487,6 @@ static int teles_cs_event(event_t event, int priority,
462 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 487 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
463 teles_cs_config(link); 488 teles_cs_config(link);
464 break; 489 break;
465 case CS_EVENT_PM_SUSPEND:
466 link->state |= DEV_SUSPEND;
467 /* Fall through... */
468 case CS_EVENT_RESET_PHYSICAL:
469 /* Mark the device as stopped, to block IO until later */
470 dev->busy = 1;
471 if (link->state & DEV_CONFIG)
472 pcmcia_release_configuration(link->handle);
473 break;
474 case CS_EVENT_PM_RESUME:
475 link->state &= ~DEV_SUSPEND;
476 /* Fall through... */
477 case CS_EVENT_CARD_RESET:
478 if (link->state & DEV_CONFIG)
479 pcmcia_request_configuration(link->handle, &link->conf);
480 dev->busy = 0;
481 break;
482 } 490 }
483 return 0; 491 return 0;
484} /* teles_cs_event */ 492} /* teles_cs_event */
@@ -498,6 +506,8 @@ static struct pcmcia_driver teles_cs_driver = {
498 .event = teles_cs_event, 506 .event = teles_cs_event,
499 .detach = teles_detach, 507 .detach = teles_detach,
500 .id_table = teles_ids, 508 .id_table = teles_ids,
509 .suspend = teles_suspend,
510 .resume = teles_resume,
501}; 511};
502 512
503static int __init init_teles_cs(void) 513static int __init init_teles_cs(void)