From patchwork Thu Jul 11 23:33:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 2826684 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 EB2EEC0AB2 for ; Thu, 11 Jul 2013 23:33:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94A8E201BE for ; Thu, 11 Jul 2013 23:33:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1ACC020165 for ; Thu, 11 Jul 2013 23:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756101Ab3GKXdr (ORCPT ); Thu, 11 Jul 2013 19:33:47 -0400 Received: from qmta12.emeryville.ca.mail.comcast.net ([76.96.27.227]:50693 "EHLO qmta12.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754983Ab3GKXdq (ORCPT ); Thu, 11 Jul 2013 19:33:46 -0400 Received: from omta23.emeryville.ca.mail.comcast.net ([76.96.30.90]) by qmta12.emeryville.ca.mail.comcast.net with comcast id z8y11l0061wfjNs01BZlQu; Thu, 11 Jul 2013 23:33:45 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta23.emeryville.ca.mail.comcast.net with comcast id zBZk1l00F0MU7Qa8jBZkgT; Thu, 11 Jul 2013 23:33:45 +0000 Received: from orthanc.internal (orthanc.internal [192.168.1.24]) by mail.gonehiking.org (Postfix) with ESMTP id 158CB80050; Thu, 11 Jul 2013 17:34:06 -0600 (MDT) From: Shuah Khan To: rafael.j.wysocki@intel.com, bhelgaas@google.com Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, shuahkhan@gmail.com Subject: [PATCH] pnp: convert pnp driver bus legacy pm_ops to dev_pm_ops Date: Thu, 11 Jul 2013 17:33:38 -0600 Message-Id: <1373585618-3741-1-git-send-email-shuah.kh@samsung.com> X-Mailer: git-send-email 1.7.10.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1373585625; bh=YlM3/4pg/oEKj4zNbcAQODcq5jScTNpX3FYFKcgQjzI=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=Z9rVin/GscjFnJew6iXaCT0c+6+HXiE0L70bZMS2cJbe0ZgqcYQvMHWxDUJuBGWTP gkAcXhKRJqgG9s6r9ANrp+3+iH2mHlG8Yh8XIZk/6daO8UN2US00KRDLPteRPNKgI5 Of5Nt3KOVF67yGR2g5wtssTnqQHoizbxsZ/zQ7+jMFoRTdzLASP3r15oICnldxRWUc xU1ViOEkGULcAgKY5WVzcF8/n8YYmllX+OOsvDjrcunOM1/B/D0+UYSMAxlmIFaXjX 1FqsX9NGV1HfnUylOplluOiBpBntObo73/gtNDoeZcHdu9hO+13ju6pgAUL2IyOtaw 5s65pGIXj3WrA== 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.1 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 Convert drivers/pnp/driver.c bus legacy pm_ops to dev_pm_ops using existing suspend and resume routines. Added freeze interface to handle PM_EVENT_FREEZE correctly with dev_pm_ops. pm_op() looks for freeze interface when the event is PM_EVENT_FREEZE. Signed-off-by: Shuah Khan --- drivers/pnp/driver.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index c3f9e89..0c89dfa 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c @@ -154,7 +154,7 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv) return 1; } -static int pnp_bus_suspend(struct device *dev, pm_message_t state) +static int __pnp_bus_suspend(struct device *dev, pm_message_t state) { struct pnp_dev *pnp_dev = to_pnp_dev(dev); struct pnp_driver *pnp_drv = pnp_dev->driver; @@ -187,6 +187,16 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state) return 0; } +static int pnp_bus_suspend(struct device *dev) +{ + return __pnp_bus_suspend(dev, PMSG_SUSPEND); +} + +static int pnp_bus_freeze(struct device *dev) +{ + return __pnp_bus_suspend(dev, PMSG_FREEZE); +} + static int pnp_bus_resume(struct device *dev) { struct pnp_dev *pnp_dev = to_pnp_dev(dev); @@ -223,14 +233,19 @@ static int pnp_bus_resume(struct device *dev) return 0; } +const struct dev_pm_ops pnp_bus_dev_pm_ops = { + .suspend = pnp_bus_suspend, + .freeze = pnp_bus_freeze, + .resume = pnp_bus_resume, +}; + struct bus_type pnp_bus_type = { .name = "pnp", .match = pnp_bus_match, .probe = pnp_device_probe, .remove = pnp_device_remove, .shutdown = pnp_device_shutdown, - .suspend = pnp_bus_suspend, - .resume = pnp_bus_resume, + .pm = &pnp_bus_dev_pm_ops, .dev_attrs = pnp_interface_attrs, };