From patchwork Fri Jul 26 21:07:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 2834404 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0197A9F243 for ; Fri, 26 Jul 2013 21:07:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1195420394 for ; Fri, 26 Jul 2013 21:07:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AC4320383 for ; Fri, 26 Jul 2013 21:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933188Ab3GZVHf (ORCPT ); Fri, 26 Jul 2013 17:07:35 -0400 Received: from qmta11.emeryville.ca.mail.comcast.net ([76.96.27.211]:35007 "EHLO qmta11.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933272Ab3GZVHc (ORCPT ); Fri, 26 Jul 2013 17:07:32 -0400 Received: from omta05.emeryville.ca.mail.comcast.net ([76.96.30.43]) by qmta11.emeryville.ca.mail.comcast.net with comcast id 58jj1m0060vp7WLAB97Xl2; Fri, 26 Jul 2013 21:07:31 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta05.emeryville.ca.mail.comcast.net with comcast id 597W1m00K0MU7Qa8R97Wjk; Fri, 26 Jul 2013 21:07:31 +0000 Received: from orthanc.internal (orthanc.internal [192.168.1.24]) by mail.gonehiking.org (Postfix) with ESMTP id 8EF7F80117; Fri, 26 Jul 2013 15:07:46 -0600 (MDT) From: Shuah Khan To: rafael.j.wysocki@intel.com, bhelgaas@google.com, fengguang.wu@intel.com Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, shuahkhan@gmail.com Subject: [PATCH v2] pnp: convert pnp driver bus legacy pm_ops to dev_pm_ops Date: Fri, 26 Jul 2013 15:07:26 -0600 Message-Id: <1374872846-29606-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=1374872851; bh=5JWVjOoKkqFyZsmZQKR5MIqGj0PF6uDBqqMKMxHSHNQ=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=f+uyuJLq3L4QrT2njj/ww5WUHM5kiyjQ3QtikOtcM1bXHGVadX5EM2wvZ4pmA3lvR ZkD9dQR8+C341z5AO2GVj/3+DpjGWnBD6oo40f+kFmvxd6aRFLJ7s13GIT4qOtVIdE dQERu2Lluv5ZPW6NxpF7kjyJwu8ZOd8/WgoqSMYX9DbHm6tp0Xs+FrxPv5spZACedO dZHXP2jUbiT9F6TwR9MezbqWl+ohVLhk3JK6oJHbJtHo5plp66SPi5ogvW0XxuzNeb oEDRRbnqBfRhMrN2LOZllMuXVNcOREeu3ctamyyxAheAMSb9aCXPQHXdnNDQOmF0hw WWv4sJBK7dtuA== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.2 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 --- Changes since v1: Fixed the following warning found in kbuild test robot drivers/pnp/driver.c:223:25: sparse: symbol 'pnp_bus_dev_pm_ops' was not declared. Should it be static? 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..a39ee38 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; } +static 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, };