diff options
Diffstat (limited to 'drivers/pnp/card.c')
-rw-r--r-- | drivers/pnp/card.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index bd7c966ea2d7..0ecbe4edbec1 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c | |||
@@ -69,6 +69,7 @@ static int card_probe(struct pnp_card * card, struct pnp_card_driver * drv) | |||
69 | return 0; | 69 | return 0; |
70 | clink->card = card; | 70 | clink->card = card; |
71 | clink->driver = drv; | 71 | clink->driver = drv; |
72 | clink->pm_state = PMSG_ON; | ||
72 | if (drv->probe) { | 73 | if (drv->probe) { |
73 | if (drv->probe(clink, id)>=0) | 74 | if (drv->probe(clink, id)>=0) |
74 | return 1; | 75 | return 1; |
@@ -333,6 +334,28 @@ void pnp_release_card_device(struct pnp_dev * dev) | |||
333 | up_write(&dev->dev.bus->subsys.rwsem); | 334 | up_write(&dev->dev.bus->subsys.rwsem); |
334 | } | 335 | } |
335 | 336 | ||
337 | /* | ||
338 | * suspend/resume callbacks | ||
339 | */ | ||
340 | static int card_suspend(struct pnp_dev *dev, pm_message_t state) | ||
341 | { | ||
342 | struct pnp_card_link *link = dev->card_link; | ||
343 | if (link->pm_state.event == state.event) | ||
344 | return 0; | ||
345 | link->pm_state = state; | ||
346 | return link->driver->suspend(link, state); | ||
347 | } | ||
348 | |||
349 | static int card_resume(struct pnp_dev *dev) | ||
350 | { | ||
351 | struct pnp_card_link *link = dev->card_link; | ||
352 | if (link->pm_state.event == PM_EVENT_ON) | ||
353 | return 0; | ||
354 | link->pm_state = PMSG_ON; | ||
355 | link->driver->resume(link); | ||
356 | return 0; | ||
357 | } | ||
358 | |||
336 | /** | 359 | /** |
337 | * pnp_register_card_driver - registers a PnP card driver with the PnP Layer | 360 | * pnp_register_card_driver - registers a PnP card driver with the PnP Layer |
338 | * @drv: pointer to the driver to register | 361 | * @drv: pointer to the driver to register |
@@ -348,6 +371,8 @@ int pnp_register_card_driver(struct pnp_card_driver * drv) | |||
348 | drv->link.flags = drv->flags; | 371 | drv->link.flags = drv->flags; |
349 | drv->link.probe = NULL; | 372 | drv->link.probe = NULL; |
350 | drv->link.remove = &card_remove_first; | 373 | drv->link.remove = &card_remove_first; |
374 | drv->link.suspend = drv->suspend ? card_suspend : NULL; | ||
375 | drv->link.resume = drv->resume ? card_resume : NULL; | ||
351 | 376 | ||
352 | spin_lock(&pnp_lock); | 377 | spin_lock(&pnp_lock); |
353 | list_add_tail(&drv->global_list, &pnp_card_drivers); | 378 | list_add_tail(&drv->global_list, &pnp_card_drivers); |