diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2005-11-14 15:21:18 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-05 17:59:02 -0500 |
commit | 98e4c28b7ec390c2dad6a4c69d69629c0f7e8b10 (patch) | |
tree | b3d46f0643352e541d6a39e6da09059687cf713d /drivers/parport | |
parent | 63e7ebd06402951bc8863ba5b7bc9b9f42044849 (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/parport')
-rw-r--r-- | drivers/parport/parport_cs.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 24e6aacddb74..4c89853785ed 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c | |||
@@ -325,6 +325,28 @@ void parport_cs_release(dev_link_t *link) | |||
325 | 325 | ||
326 | } /* parport_cs_release */ | 326 | } /* parport_cs_release */ |
327 | 327 | ||
328 | static int parport_suspend(struct pcmcia_device *dev) | ||
329 | { | ||
330 | dev_link_t *link = dev_to_instance(dev); | ||
331 | |||
332 | link->state |= DEV_SUSPEND; | ||
333 | if (link->state & DEV_CONFIG) | ||
334 | pcmcia_release_configuration(link->handle); | ||
335 | |||
336 | return 0; | ||
337 | } | ||
338 | |||
339 | static int parport_resume(struct pcmcia_device *dev) | ||
340 | { | ||
341 | dev_link_t *link = dev_to_instance(dev); | ||
342 | |||
343 | link->state &= ~DEV_SUSPEND; | ||
344 | if (DEV_OK(link)) | ||
345 | pcmcia_request_configuration(link->handle, &link->conf); | ||
346 | |||
347 | return 0; | ||
348 | } | ||
349 | |||
328 | /*====================================================================== | 350 | /*====================================================================== |
329 | 351 | ||
330 | The card status event handler. Mostly, this schedules other | 352 | The card status event handler. Mostly, this schedules other |
@@ -349,20 +371,6 @@ int parport_event(event_t event, int priority, | |||
349 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 371 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
350 | parport_config(link); | 372 | parport_config(link); |
351 | break; | 373 | break; |
352 | case CS_EVENT_PM_SUSPEND: | ||
353 | link->state |= DEV_SUSPEND; | ||
354 | /* Fall through... */ | ||
355 | case CS_EVENT_RESET_PHYSICAL: | ||
356 | if (link->state & DEV_CONFIG) | ||
357 | pcmcia_release_configuration(link->handle); | ||
358 | break; | ||
359 | case CS_EVENT_PM_RESUME: | ||
360 | link->state &= ~DEV_SUSPEND; | ||
361 | /* Fall through... */ | ||
362 | case CS_EVENT_CARD_RESET: | ||
363 | if (DEV_OK(link)) | ||
364 | pcmcia_request_configuration(link->handle, &link->conf); | ||
365 | break; | ||
366 | } | 374 | } |
367 | return 0; | 375 | return 0; |
368 | } /* parport_event */ | 376 | } /* parport_event */ |
@@ -383,7 +391,8 @@ static struct pcmcia_driver parport_cs_driver = { | |||
383 | .event = parport_event, | 391 | .event = parport_event, |
384 | .detach = parport_detach, | 392 | .detach = parport_detach, |
385 | .id_table = parport_ids, | 393 | .id_table = parport_ids, |
386 | 394 | .suspend = parport_suspend, | |
395 | .resume = parport_resume, | ||
387 | }; | 396 | }; |
388 | 397 | ||
389 | static int __init init_parport_cs(void) | 398 | static int __init init_parport_cs(void) |