Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932081AbZFDQ1k (ORCPT ); Thu, 4 Jun 2009 12:27:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757341AbZFDQT7 (ORCPT ); Thu, 4 Jun 2009 12:19:59 -0400 Received: from mtagate5.de.ibm.com ([195.212.29.154]:48895 "EHLO mtagate5.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757366AbZFDQTq (ORCPT ); Thu, 4 Jun 2009 12:19:46 -0400 Message-Id: <20090604161903.277373455@de.ibm.com> References: <20090604161847.513682672@de.ibm.com> User-Agent: quilt/0.46-1 Date: Thu, 04 Jun 2009 18:19:03 +0200 From: Martin Schwidefsky To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-pm@lists.linux-foundation.org Cc: Heiko Carstens , Klaus-Dieter Wacker , Martin Schwidefsky Subject: [patch 16/38] pm: lcs driver power management callbacks Content-Disposition: inline; filename=pm_lcs.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3306 Lines: 119 From: Klaus-Dieter Wacket Signed-off-by: Klaus-Dieter Wacker Signed-off-by: Martin Schwidefsky --- drivers/s390/net/lcs.c | 74 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 9 deletions(-) Index: linux-2.6/drivers/s390/net/lcs.c =================================================================== --- linux-2.6.orig/drivers/s390/net/lcs.c +++ linux-2.6/drivers/s390/net/lcs.c @@ -1,15 +1,12 @@ /* - * linux/drivers/s390/net/lcs.c - * * Linux for S/390 Lan Channel Station Network Driver * - * Copyright (C) 1999-2001 IBM Deutschland Entwicklung GmbH, - * IBM Corporation - * Author(s): Original Code written by - * DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) - * Rewritten by - * Frank Pavlic (fpavlic@de.ibm.com) and - * Martin Schwidefsky + * Copyright IBM Corp. 1999, 2009 + * Author(s): Original Code written by + * DJ Barrow + * Rewritten by + * Frank Pavlic and + * Martin Schwidefsky * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2313,6 +2310,60 @@ lcs_remove_device(struct ccwgroup_device put_device(&ccwgdev->dev); } +static int lcs_pm_suspend(struct lcs_card *card) +{ + if (card->dev) + netif_device_detach(card->dev); + lcs_set_allowed_threads(card, 0); + lcs_wait_for_threads(card, 0xffffffff); + if (card->state != DEV_STATE_DOWN) + __lcs_shutdown_device(card->gdev, 1); + return 0; +} + +static int lcs_pm_resume(struct lcs_card *card) +{ + int rc = 0; + + if (card->state == DEV_STATE_RECOVER) + rc = lcs_new_device(card->gdev); + if (card->dev) + netif_device_attach(card->dev); + if (rc) { + dev_warn(&card->gdev->dev, "The lcs device driver " + "failed to recover the device\n"); + } + return rc; +} + +static int lcs_prepare(struct ccwgroup_device *gdev) +{ + return 0; +} + +static void lcs_complete(struct ccwgroup_device *gdev) +{ + return; +} + +static int lcs_freeze(struct ccwgroup_device *gdev) +{ + struct lcs_card *card = dev_get_drvdata(&gdev->dev); + return lcs_pm_suspend(card); +} + +static int lcs_thaw(struct ccwgroup_device *gdev) +{ + struct lcs_card *card = dev_get_drvdata(&gdev->dev); + return lcs_pm_resume(card); +} + +static int lcs_restore(struct ccwgroup_device *gdev) +{ + struct lcs_card *card = dev_get_drvdata(&gdev->dev); + return lcs_pm_resume(card); +} + /** * LCS ccwgroup driver registration */ @@ -2325,6 +2376,11 @@ static struct ccwgroup_driver lcs_group_ .remove = lcs_remove_device, .set_online = lcs_new_device, .set_offline = lcs_shutdown_device, + .prepare = lcs_prepare, + .complete = lcs_complete, + .freeze = lcs_freeze, + .thaw = lcs_thaw, + .restore = lcs_restore, }; /** -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/