diff options
author | Frank Blaschka <frank.blaschka@de.ibm.com> | 2009-06-16 04:30:31 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-16 04:31:13 -0400 |
commit | bbcfcdc8324e75532c4d2592a545a91fcb45f229 (patch) | |
tree | cf37e0d0da6e54d324fc65f1363508975132406d /drivers/s390/net/qeth_l3_main.c | |
parent | cbb2aec3e7271f4cefcba2942aecc658d5841307 (diff) |
[S390] pm: qeth driver power management callbacks
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/net/qeth_l3_main.c')
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 6f2386e9d6e..54872406864 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/net/qeth_l3_main.c | 2 | * drivers/s390/net/qeth_l3_main.c |
3 | * | 3 | * |
4 | * Copyright IBM Corp. 2007 | 4 | * Copyright IBM Corp. 2007, 2009 |
5 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com>, | 5 | * Author(s): Utz Bacher <utz.bacher@de.ibm.com>, |
6 | * Frank Pavlic <fpavlic@de.ibm.com>, | 6 | * Frank Pavlic <fpavlic@de.ibm.com>, |
7 | * Thomas Spatzier <tspat@de.ibm.com>, | 7 | * Thomas Spatzier <tspat@de.ibm.com>, |
@@ -3283,12 +3283,62 @@ static void qeth_l3_shutdown(struct ccwgroup_device *gdev) | |||
3283 | qeth_clear_qdio_buffers(card); | 3283 | qeth_clear_qdio_buffers(card); |
3284 | } | 3284 | } |
3285 | 3285 | ||
3286 | static int qeth_l3_pm_suspend(struct ccwgroup_device *gdev) | ||
3287 | { | ||
3288 | struct qeth_card *card = dev_get_drvdata(&gdev->dev); | ||
3289 | |||
3290 | if (card->dev) | ||
3291 | netif_device_detach(card->dev); | ||
3292 | qeth_set_allowed_threads(card, 0, 1); | ||
3293 | wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); | ||
3294 | if (gdev->state == CCWGROUP_OFFLINE) | ||
3295 | return 0; | ||
3296 | if (card->state == CARD_STATE_UP) { | ||
3297 | card->use_hard_stop = 1; | ||
3298 | __qeth_l3_set_offline(card->gdev, 1); | ||
3299 | } else | ||
3300 | __qeth_l3_set_offline(card->gdev, 0); | ||
3301 | return 0; | ||
3302 | } | ||
3303 | |||
3304 | static int qeth_l3_pm_resume(struct ccwgroup_device *gdev) | ||
3305 | { | ||
3306 | struct qeth_card *card = dev_get_drvdata(&gdev->dev); | ||
3307 | int rc = 0; | ||
3308 | |||
3309 | if (gdev->state == CCWGROUP_OFFLINE) | ||
3310 | goto out; | ||
3311 | |||
3312 | if (card->state == CARD_STATE_RECOVER) { | ||
3313 | rc = __qeth_l3_set_online(card->gdev, 1); | ||
3314 | if (rc) { | ||
3315 | if (card->dev) { | ||
3316 | rtnl_lock(); | ||
3317 | dev_close(card->dev); | ||
3318 | rtnl_unlock(); | ||
3319 | } | ||
3320 | } | ||
3321 | } else | ||
3322 | rc = __qeth_l3_set_online(card->gdev, 0); | ||
3323 | out: | ||
3324 | qeth_set_allowed_threads(card, 0xffffffff, 0); | ||
3325 | if (card->dev) | ||
3326 | netif_device_attach(card->dev); | ||
3327 | if (rc) | ||
3328 | dev_warn(&card->gdev->dev, "The qeth device driver " | ||
3329 | "failed to recover an error on the device\n"); | ||
3330 | return rc; | ||
3331 | } | ||
3332 | |||
3286 | struct ccwgroup_driver qeth_l3_ccwgroup_driver = { | 3333 | struct ccwgroup_driver qeth_l3_ccwgroup_driver = { |
3287 | .probe = qeth_l3_probe_device, | 3334 | .probe = qeth_l3_probe_device, |
3288 | .remove = qeth_l3_remove_device, | 3335 | .remove = qeth_l3_remove_device, |
3289 | .set_online = qeth_l3_set_online, | 3336 | .set_online = qeth_l3_set_online, |
3290 | .set_offline = qeth_l3_set_offline, | 3337 | .set_offline = qeth_l3_set_offline, |
3291 | .shutdown = qeth_l3_shutdown, | 3338 | .shutdown = qeth_l3_shutdown, |
3339 | .freeze = qeth_l3_pm_suspend, | ||
3340 | .thaw = qeth_l3_pm_resume, | ||
3341 | .restore = qeth_l3_pm_resume, | ||
3292 | }; | 3342 | }; |
3293 | EXPORT_SYMBOL_GPL(qeth_l3_ccwgroup_driver); | 3343 | EXPORT_SYMBOL_GPL(qeth_l3_ccwgroup_driver); |
3294 | 3344 | ||