From patchwork Mon Feb 10 16:15:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620491 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7C881BF418 for ; Mon, 10 Feb 2014 16:19:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF8F6201D3 for ; Mon, 10 Feb 2014 16:19:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48D1920148 for ; Mon, 10 Feb 2014 16:19:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752148AbaBJQTf (ORCPT ); Mon, 10 Feb 2014 11:19:35 -0500 Received: from qmta07.emeryville.ca.mail.comcast.net ([76.96.30.64]:58703 "EHLO qmta07.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbaBJQTf (ORCPT ); Mon, 10 Feb 2014 11:19:35 -0500 Received: from omta10.emeryville.ca.mail.comcast.net ([76.96.30.28]) by qmta07.emeryville.ca.mail.comcast.net with comcast id Qel81n0040cQ2SLA7gFW9n; Mon, 10 Feb 2014 16:15:30 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta10.emeryville.ca.mail.comcast.net with comcast id QgFV1n00H0MU7Qa8WgFV7e; Mon, 10 Feb 2014 16:15:30 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 258C84024C; Mon, 10 Feb 2014 09:15:29 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, gregkh@linuxfoundation.org Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pcmcia@lists.infradead.org, shuahkhan@gmail.com Subject: [RFT][PATCH 11/12] drivers/pcmcia: change ds driver power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:15:21 -0700 Message-Id: <4159bb4e4aa13212b1eac2be7e911ed18451ec9c.1392040068.git.shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392048930; bh=NBwDc8bAMDbBJF1Jkw4/JnYfwxA/DQ0H86kJHkhUj4w=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=QW+pP6jrTAHcYUQFmESnol28h0p/C7mK1NSymE5mdVRbNNq+zEo0oJKWndoPeBMWA HDBR9TqHnrObitKQcXy+5CKTKeYg0O70xABnRiQEOus/SJGUnt4z76F1/Gd2uLebhr 62s4aoLpaC6W4SzUCvmw3kiIH2pwclbM4G0UWsr4TOF0dgIivkgqQskb/OzMKysuue sqA1VXz8y/omguXM6KFLE5WuyghMHqLgRStLHh3sHr7lrVnxdLzlRocAazqsPuv26Z FyjsMtMDdGVXnjRCCvfR7y9iw5TxBAIrMN+j+5ruDUD9FD51TispDAK54lWm/vP4RQ jqsKcyB5N/hnw== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change ds driver to register pm ops using dev_pm_ops instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces by passing in the right pm state. Signed-off-by: Shuah Khan --- drivers/pcmcia/ds.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 757119b..2979323 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -962,7 +962,10 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env) /************************ runtime PM support ***************************/ -static int pcmcia_dev_suspend(struct device *dev, pm_message_t state); +static int __pcmcia_dev_suspend(struct device *dev, pm_message_t state); +static int pcmcia_dev_suspend(struct device *dev); +static int pcmcia_dev_poweroff(struct device *dev); +static int pcmcia_dev_freeze(struct device *dev); static int pcmcia_dev_resume(struct device *dev); static int runtime_suspend(struct device *dev) @@ -970,7 +973,7 @@ static int runtime_suspend(struct device *dev) int rc; device_lock(dev); - rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); + rc = __pcmcia_dev_suspend(dev, PMSG_SUSPEND); device_unlock(dev); return rc; } @@ -1120,7 +1123,22 @@ ATTRIBUTE_GROUPS(pcmcia_dev); /* PM support, also needed for reset */ -static int pcmcia_dev_suspend(struct device *dev, pm_message_t state) +static int pcmcia_dev_suspend(struct device *dev) +{ + return __pcmcia_dev_suspend(dev, PMSG_SUSPEND); +} + +static int pcmcia_dev_poweroff(struct device *dev) +{ + return __pcmcia_dev_suspend(dev, PMSG_HIBERNATE); +} + +static int pcmcia_dev_freeze(struct device *dev) +{ + return __pcmcia_dev_suspend(dev, PMSG_FREEZE); +} + +static int __pcmcia_dev_suspend(struct device *dev, pm_message_t state) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); struct pcmcia_driver *p_drv = NULL; @@ -1397,6 +1415,15 @@ static struct class_interface pcmcia_bus_interface __refdata = { .remove_dev = &pcmcia_bus_remove_socket, }; +static const struct dev_pm_ops pcmcia_bus_dev_pm_ops = { + .suspend = pcmcia_dev_suspend, + .resume = pcmcia_dev_resume, + /* Hibernate callbacks */ + .freeze = pcmcia_dev_freeze, + .thaw = pcmcia_dev_resume, + .poweroff = pcmcia_dev_poweroff, + .restore = pcmcia_dev_resume, +}; struct bus_type pcmcia_bus_type = { .name = "pcmcia", @@ -1405,8 +1432,7 @@ struct bus_type pcmcia_bus_type = { .dev_groups = pcmcia_dev_groups, .probe = pcmcia_device_probe, .remove = pcmcia_device_remove, - .suspend = pcmcia_dev_suspend, - .resume = pcmcia_dev_resume, + .pm = &pcmcia_bus_dev_pm_ops, };