From patchwork Mon Feb 10 16:12:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 3620451 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 91F699F382 for ; Mon, 10 Feb 2014 16:19:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54ECE20148 for ; Mon, 10 Feb 2014 16:19:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EF332010F for ; Mon, 10 Feb 2014 16:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752672AbaBJQS5 (ORCPT ); Mon, 10 Feb 2014 11:18:57 -0500 Received: from qmta12.emeryville.ca.mail.comcast.net ([76.96.27.227]:43129 "EHLO qmta12.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752190AbaBJQSu (ORCPT ); Mon, 10 Feb 2014 11:18:50 -0500 Received: from omta21.emeryville.ca.mail.comcast.net ([76.96.30.88]) by qmta12.emeryville.ca.mail.comcast.net with comcast id Qg3d1n0031u4NiL01gCj0d; Mon, 10 Feb 2014 16:12:43 +0000 Received: from mail.gonehiking.org ([50.134.149.16]) by omta21.emeryville.ca.mail.comcast.net with comcast id QgCi1n0020MU7Qa8hgCipz; Mon, 10 Feb 2014 16:12:43 +0000 Received: from lorien.sisa.samsung.com (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id AC87841103; Mon, 10 Feb 2014 09:12:41 -0700 (MST) From: Shuah Khan To: rjw@rjwysocki.net, benh@kernel.crashing.org Cc: Shuah Khan , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, shuahkhan@gmail.com Subject: [RFT][PATCH 04/12] drivers/macintosh/adb: change platform power management to use dev_pm_ops Date: Mon, 10 Feb 2014 09:12:27 -0700 Message-Id: <9637dc390002d58de22b21c8ae4aeaf60dfb72df.1392040067.git.shuah.kh@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1392048763; bh=8Pyore1OGpu+ZT9bmfwz6KN9lLVVJW31pGjcnBSDPl4=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=VQAYJji5cLKqmvWgdl6lDwtf7AVQLBli8TBLEOkFeHsyY8rTgwALZDK5I/hmIR1J4 StrCeUi0seRm5rPSOiwbLrgDa4dbYGauMFzbtC1hPzkf+qBeLvLddR1gqd5RRVHqPO +hjnI156oHQXBfGwYevTxeLUao712OvEYvr+5NOPxn1yMC6VcnL3nVEtyNG9LLSuMO VjhQP7W08NIYexbbnYMmhSvcYlGRG4RzeCDrp5gSCtMOjL468FsEMajEbhV8292HZ9 8xtFbeCICj7lTcoDK1OfSDp+VTAfcGa9PiRnLhgSLgvDJUif/GlB3Iv4w7SrfGIZVW TRNk6NkXmtrhw== 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 adb platform 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/macintosh/adb.c | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 04a5049..df6b201 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -263,7 +263,7 @@ adb_reset_bus(void) /* * notify clients before sleep */ -static int adb_suspend(struct platform_device *dev, pm_message_t state) +static int __adb_suspend(struct platform_device *dev, pm_message_t state) { adb_got_sleep = 1; /* We need to get a lock on the probe thread */ @@ -276,10 +276,25 @@ static int adb_suspend(struct platform_device *dev, pm_message_t state) return 0; } +static int adb_suspend(struct device *dev) +{ + return __adb_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int adb_freeze(struct device *dev) +{ + return __adb_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int adb_poweroff(struct device *dev) +{ + return __adb_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + /* * reset bus after sleep */ -static int adb_resume(struct platform_device *dev) +static int __adb_resume(struct platform_device *dev) { adb_got_sleep = 0; up(&adb_probe_mutex); @@ -287,6 +302,11 @@ static int adb_resume(struct platform_device *dev) return 0; } + +static int adb_resume(struct device *dev) +{ + return __adb_resume(to_platform_device(dev)); +} #endif /* CONFIG_PM */ static int __init adb_init(void) @@ -831,14 +851,25 @@ static const struct file_operations adb_fops = { .release = adb_release, }; +#ifdef CONFIG_PM +static const struct dev_pm_ops adb_dev_pm_ops = { + .suspend = adb_suspend, + .resume = adb_resume, + /* Hibernate hooks */ + .freeze = adb_freeze, + .thaw = adb_resume, + .poweroff = adb_poweroff, + .restore = adb_resume, +}; +#endif + static struct platform_driver adb_pfdrv = { .driver = { .name = "adb", - }, #ifdef CONFIG_PM - .suspend = adb_suspend, - .resume = adb_resume, + .pm = &adb_dev_pm_ops, #endif + }, }; static struct platform_device adb_pfdev = {