diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-01 18:02:33 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:15:52 -0500 |
commit | 8661bb5b4af1849c1f5a4e80c4e275fd13c155d6 (patch) | |
tree | ad99d85ea8d6f5c4c99b93f869bfd412994fb4ee /drivers/isdn | |
parent | 50db3fdbbc98260fb538c1cc3f8cc597ba7bffe7 (diff) |
[PATCH] pcmcia: default suspend and resume handling
In all but one case, the suspend and resume functions of PCMCIA drivers
contain mostly of calls to pcmcia_release_configuration() and
pcmcia_request_configuration(). Therefore, move this code out of the
drivers and into the core.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/hardware/avm/avm_cs.c | 38 | ||||
-rw-r--r-- | drivers/isdn/hisax/avma1_cs.c | 26 | ||||
-rw-r--r-- | drivers/isdn/hisax/elsa_cs.c | 6 | ||||
-rw-r--r-- | drivers/isdn/hisax/sedlbauer_cs.c | 6 | ||||
-rw-r--r-- | drivers/isdn/hisax/teles_cs.c | 6 |
5 files changed, 1 insertions, 81 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 5f70661994d8..ae70247d5157 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -371,42 +371,6 @@ static void avmcs_release(dev_link_t *link) | |||
371 | pcmcia_disable_device(link->handle); | 371 | pcmcia_disable_device(link->handle); |
372 | } /* avmcs_release */ | 372 | } /* avmcs_release */ |
373 | 373 | ||
374 | static int avmcs_suspend(struct pcmcia_device *dev) | ||
375 | { | ||
376 | dev_link_t *link = dev_to_instance(dev); | ||
377 | |||
378 | link->state |= DEV_SUSPEND; | ||
379 | if (link->state & DEV_CONFIG) | ||
380 | pcmcia_release_configuration(link->handle); | ||
381 | |||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | static int avmcs_resume(struct pcmcia_device *dev) | ||
386 | { | ||
387 | dev_link_t *link = dev_to_instance(dev); | ||
388 | |||
389 | link->state &= ~DEV_SUSPEND; | ||
390 | if (link->state & DEV_CONFIG) | ||
391 | pcmcia_request_configuration(link->handle, &link->conf); | ||
392 | |||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | /*====================================================================== | ||
397 | |||
398 | The card status event handler. Mostly, this schedules other | ||
399 | stuff to run after an event is received. A CARD_REMOVAL event | ||
400 | also sets some flags to discourage the net drivers from trying | ||
401 | to talk to the card any more. | ||
402 | |||
403 | When a CARD_REMOVAL event is received, we immediately set a flag | ||
404 | to block future accesses to this device. All the functions that | ||
405 | actually access the device should check this flag to make sure | ||
406 | the card is still present. | ||
407 | |||
408 | ======================================================================*/ | ||
409 | |||
410 | 374 | ||
411 | static struct pcmcia_device_id avmcs_ids[] = { | 375 | static struct pcmcia_device_id avmcs_ids[] = { |
412 | PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335), | 376 | PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335), |
@@ -424,8 +388,6 @@ static struct pcmcia_driver avmcs_driver = { | |||
424 | .probe = avmcs_attach, | 388 | .probe = avmcs_attach, |
425 | .remove = avmcs_detach, | 389 | .remove = avmcs_detach, |
426 | .id_table = avmcs_ids, | 390 | .id_table = avmcs_ids, |
427 | .suspend= avmcs_suspend, | ||
428 | .resume = avmcs_resume, | ||
429 | }; | 391 | }; |
430 | 392 | ||
431 | static int __init avmcs_init(void) | 393 | static int __init avmcs_init(void) |
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 845fa14e1bae..5e847cfb96f8 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c | |||
@@ -383,28 +383,6 @@ static void avma1cs_release(dev_link_t *link) | |||
383 | pcmcia_disable_device(link->handle); | 383 | pcmcia_disable_device(link->handle); |
384 | } /* avma1cs_release */ | 384 | } /* avma1cs_release */ |
385 | 385 | ||
386 | static int avma1cs_suspend(struct pcmcia_device *dev) | ||
387 | { | ||
388 | dev_link_t *link = dev_to_instance(dev); | ||
389 | |||
390 | link->state |= DEV_SUSPEND; | ||
391 | if (link->state & DEV_CONFIG) | ||
392 | pcmcia_release_configuration(link->handle); | ||
393 | |||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | static int avma1cs_resume(struct pcmcia_device *dev) | ||
398 | { | ||
399 | dev_link_t *link = dev_to_instance(dev); | ||
400 | |||
401 | link->state &= ~DEV_SUSPEND; | ||
402 | if (link->state & DEV_CONFIG) | ||
403 | pcmcia_request_configuration(link->handle, &link->conf); | ||
404 | |||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | 386 | ||
409 | static struct pcmcia_device_id avma1cs_ids[] = { | 387 | static struct pcmcia_device_id avma1cs_ids[] = { |
410 | PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), | 388 | PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), |
@@ -421,10 +399,8 @@ static struct pcmcia_driver avma1cs_driver = { | |||
421 | .probe = avma1cs_attach, | 399 | .probe = avma1cs_attach, |
422 | .remove = avma1cs_detach, | 400 | .remove = avma1cs_detach, |
423 | .id_table = avma1cs_ids, | 401 | .id_table = avma1cs_ids, |
424 | .suspend = avma1cs_suspend, | ||
425 | .resume = avma1cs_resume, | ||
426 | }; | 402 | }; |
427 | 403 | ||
428 | /*====================================================================*/ | 404 | /*====================================================================*/ |
429 | 405 | ||
430 | static int __init init_avma1_cs(void) | 406 | static int __init init_avma1_cs(void) |
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 60c75c7c016e..b76b303ebf6b 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c | |||
@@ -389,10 +389,7 @@ static int elsa_suspend(struct pcmcia_device *p_dev) | |||
389 | dev_link_t *link = dev_to_instance(p_dev); | 389 | dev_link_t *link = dev_to_instance(p_dev); |
390 | local_info_t *dev = link->priv; | 390 | local_info_t *dev = link->priv; |
391 | 391 | ||
392 | link->state |= DEV_SUSPEND; | ||
393 | dev->busy = 1; | 392 | dev->busy = 1; |
394 | if (link->state & DEV_CONFIG) | ||
395 | pcmcia_release_configuration(link->handle); | ||
396 | 393 | ||
397 | return 0; | 394 | return 0; |
398 | } | 395 | } |
@@ -402,9 +399,6 @@ static int elsa_resume(struct pcmcia_device *p_dev) | |||
402 | dev_link_t *link = dev_to_instance(p_dev); | 399 | dev_link_t *link = dev_to_instance(p_dev); |
403 | local_info_t *dev = link->priv; | 400 | local_info_t *dev = link->priv; |
404 | 401 | ||
405 | link->state &= ~DEV_SUSPEND; | ||
406 | if (link->state & DEV_CONFIG) | ||
407 | pcmcia_request_configuration(link->handle, &link->conf); | ||
408 | dev->busy = 0; | 402 | dev->busy = 0; |
409 | 403 | ||
410 | return 0; | 404 | return 0; |
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index fd0f127e40ba..5745eb1afe35 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c | |||
@@ -472,10 +472,7 @@ static int sedlbauer_suspend(struct pcmcia_device *p_dev) | |||
472 | dev_link_t *link = dev_to_instance(p_dev); | 472 | dev_link_t *link = dev_to_instance(p_dev); |
473 | local_info_t *dev = link->priv; | 473 | local_info_t *dev = link->priv; |
474 | 474 | ||
475 | link->state |= DEV_SUSPEND; | ||
476 | dev->stop = 1; | 475 | dev->stop = 1; |
477 | if (link->state & DEV_CONFIG) | ||
478 | pcmcia_release_configuration(link->handle); | ||
479 | 476 | ||
480 | return 0; | 477 | return 0; |
481 | } | 478 | } |
@@ -485,9 +482,6 @@ static int sedlbauer_resume(struct pcmcia_device *p_dev) | |||
485 | dev_link_t *link = dev_to_instance(p_dev); | 482 | dev_link_t *link = dev_to_instance(p_dev); |
486 | local_info_t *dev = link->priv; | 483 | local_info_t *dev = link->priv; |
487 | 484 | ||
488 | link->state &= ~DEV_SUSPEND; | ||
489 | if (link->state & DEV_CONFIG) | ||
490 | pcmcia_request_configuration(link->handle, &link->conf); | ||
491 | dev->stop = 0; | 485 | dev->stop = 0; |
492 | 486 | ||
493 | return 0; | 487 | return 0; |
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 7945fd64621a..929507eb63af 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c | |||
@@ -380,10 +380,7 @@ static int teles_suspend(struct pcmcia_device *p_dev) | |||
380 | dev_link_t *link = dev_to_instance(p_dev); | 380 | dev_link_t *link = dev_to_instance(p_dev); |
381 | local_info_t *dev = link->priv; | 381 | local_info_t *dev = link->priv; |
382 | 382 | ||
383 | link->state |= DEV_SUSPEND; | ||
384 | dev->busy = 1; | 383 | dev->busy = 1; |
385 | if (link->state & DEV_CONFIG) | ||
386 | pcmcia_release_configuration(link->handle); | ||
387 | 384 | ||
388 | return 0; | 385 | return 0; |
389 | } | 386 | } |
@@ -393,9 +390,6 @@ static int teles_resume(struct pcmcia_device *p_dev) | |||
393 | dev_link_t *link = dev_to_instance(p_dev); | 390 | dev_link_t *link = dev_to_instance(p_dev); |
394 | local_info_t *dev = link->priv; | 391 | local_info_t *dev = link->priv; |
395 | 392 | ||
396 | link->state &= ~DEV_SUSPEND; | ||
397 | if (link->state & DEV_CONFIG) | ||
398 | pcmcia_request_configuration(link->handle, &link->conf); | ||
399 | dev->busy = 0; | 393 | dev->busy = 0; |
400 | 394 | ||
401 | return 0; | 395 | return 0; |