diff options
author | Klaus-Dieter Wacket <kdwacker@de.ibm.com> | 2009-06-16 04:30:30 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-16 04:31:12 -0400 |
commit | cbb2aec3e7271f4cefcba2942aecc658d5841307 (patch) | |
tree | 9ffa925bcaac1648b90c78b82564d694a27d15ad /drivers/s390/net | |
parent | 77812a27577dba6adb71b1de8ee690ced5002067 (diff) |
[S390] pm: lcs driver power management callbacks
Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r-- | drivers/s390/net/lcs.c | 74 |
1 files changed, 65 insertions, 9 deletions
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index a45bc24eb5f9..07a25c3f94b6 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -1,15 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/s390/net/lcs.c | ||
3 | * | ||
4 | * Linux for S/390 Lan Channel Station Network Driver | 2 | * Linux for S/390 Lan Channel Station Network Driver |
5 | * | 3 | * |
6 | * Copyright (C) 1999-2001 IBM Deutschland Entwicklung GmbH, | 4 | * Copyright IBM Corp. 1999, 2009 |
7 | * IBM Corporation | 5 | * Author(s): Original Code written by |
8 | * Author(s): Original Code written by | 6 | * DJ Barrow <djbarrow@de.ibm.com,barrow_dj@yahoo.com> |
9 | * DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) | 7 | * Rewritten by |
10 | * Rewritten by | 8 | * Frank Pavlic <fpavlic@de.ibm.com> and |
11 | * Frank Pavlic (fpavlic@de.ibm.com) and | 9 | * Martin Schwidefsky <schwidefsky@de.ibm.com> |
12 | * Martin Schwidefsky <schwidefsky@de.ibm.com> | ||
13 | * | 10 | * |
14 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
@@ -2313,6 +2310,60 @@ lcs_remove_device(struct ccwgroup_device *ccwgdev) | |||
2313 | put_device(&ccwgdev->dev); | 2310 | put_device(&ccwgdev->dev); |
2314 | } | 2311 | } |
2315 | 2312 | ||
2313 | static int lcs_pm_suspend(struct lcs_card *card) | ||
2314 | { | ||
2315 | if (card->dev) | ||
2316 | netif_device_detach(card->dev); | ||
2317 | lcs_set_allowed_threads(card, 0); | ||
2318 | lcs_wait_for_threads(card, 0xffffffff); | ||
2319 | if (card->state != DEV_STATE_DOWN) | ||
2320 | __lcs_shutdown_device(card->gdev, 1); | ||
2321 | return 0; | ||
2322 | } | ||
2323 | |||
2324 | static int lcs_pm_resume(struct lcs_card *card) | ||
2325 | { | ||
2326 | int rc = 0; | ||
2327 | |||
2328 | if (card->state == DEV_STATE_RECOVER) | ||
2329 | rc = lcs_new_device(card->gdev); | ||
2330 | if (card->dev) | ||
2331 | netif_device_attach(card->dev); | ||
2332 | if (rc) { | ||
2333 | dev_warn(&card->gdev->dev, "The lcs device driver " | ||
2334 | "failed to recover the device\n"); | ||
2335 | } | ||
2336 | return rc; | ||
2337 | } | ||
2338 | |||
2339 | static int lcs_prepare(struct ccwgroup_device *gdev) | ||
2340 | { | ||
2341 | return 0; | ||
2342 | } | ||
2343 | |||
2344 | static void lcs_complete(struct ccwgroup_device *gdev) | ||
2345 | { | ||
2346 | return; | ||
2347 | } | ||
2348 | |||
2349 | static int lcs_freeze(struct ccwgroup_device *gdev) | ||
2350 | { | ||
2351 | struct lcs_card *card = dev_get_drvdata(&gdev->dev); | ||
2352 | return lcs_pm_suspend(card); | ||
2353 | } | ||
2354 | |||
2355 | static int lcs_thaw(struct ccwgroup_device *gdev) | ||
2356 | { | ||
2357 | struct lcs_card *card = dev_get_drvdata(&gdev->dev); | ||
2358 | return lcs_pm_resume(card); | ||
2359 | } | ||
2360 | |||
2361 | static int lcs_restore(struct ccwgroup_device *gdev) | ||
2362 | { | ||
2363 | struct lcs_card *card = dev_get_drvdata(&gdev->dev); | ||
2364 | return lcs_pm_resume(card); | ||
2365 | } | ||
2366 | |||
2316 | /** | 2367 | /** |
2317 | * LCS ccwgroup driver registration | 2368 | * LCS ccwgroup driver registration |
2318 | */ | 2369 | */ |
@@ -2325,6 +2376,11 @@ static struct ccwgroup_driver lcs_group_driver = { | |||
2325 | .remove = lcs_remove_device, | 2376 | .remove = lcs_remove_device, |
2326 | .set_online = lcs_new_device, | 2377 | .set_online = lcs_new_device, |
2327 | .set_offline = lcs_shutdown_device, | 2378 | .set_offline = lcs_shutdown_device, |
2379 | .prepare = lcs_prepare, | ||
2380 | .complete = lcs_complete, | ||
2381 | .freeze = lcs_freeze, | ||
2382 | .thaw = lcs_thaw, | ||
2383 | .restore = lcs_restore, | ||
2328 | }; | 2384 | }; |
2329 | 2385 | ||
2330 | /** | 2386 | /** |