From patchwork Sun Dec 19 19:08:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 76151 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wy0-f184.google.com (mail-wy0-f184.google.com [74.125.82.184]) by ozlabs.org (Postfix) with ESMTP id EB9B3B7080 for ; Mon, 20 Dec 2010 06:08:35 +1100 (EST) Received: by wyb39 with SMTP id 39sf1932057wyb.11 for ; Sun, 19 Dec 2010 11:08:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:mime-version:x-beenthere:received :received:received:received:received-spf:received:received:received :from:to:cc:cc:cc:cc:subject:message-id:date:x-cloudmark-analysis :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=4l1HqIcpmTEabCQycvzf7vPRIRKdkIwsJNhu8ePCe/s=; b=pDpHl7Ib7W+JX3uhzxOq6H/4SKGXSmWbSxVeRonVmGDIkx98w/sCvCBfIwtvl6mi3/ r1h6UylgeDXwEn3dWVm/JlzsNN2vnHlA65jHKv26Qrtr9uX+IUmB20TikQWTLjc77Pw9 yc2mq8yb9X8rKCNgHH0czA4a7U5R8WzvGjARM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:message-id :date:x-cloudmark-analysis:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=D0b0aiRAW8S9qhiGR1cU8cm+yzYbzlMwfpvFom4w9Xb9KC61SOBdmQVCzL33tM0UNY 1i4hNjeMeeoSPcjo90AXKWE4eHAfDkqU3Q2GOv6TTEmGwU9Bve1jL4QJMwZExiuClmqK +xpR0COmoNHTtJP50bZQfqp3UdOPrCwGUdSxM= Received: by 10.216.169.19 with SMTP id m19mr401608wel.7.1292785712746; Sun, 19 Dec 2010 11:08:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.216.62.75 with SMTP id x53ls2755315wec.3.p; Sun, 19 Dec 2010 11:08:32 -0800 (PST) Received: by 10.216.80.144 with SMTP id k16mr224586wee.1.1292785711974; Sun, 19 Dec 2010 11:08:31 -0800 (PST) Received: by 10.216.80.144 with SMTP id k16mr224585wee.1.1292785711931; Sun, 19 Dec 2010 11:08:31 -0800 (PST) Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by gmr-mx.google.com with ESMTP id v38si297534wei.15.2010.12.19.11.08.31; Sun, 19 Dec 2010 11:08:31 -0800 (PST) Received-SPF: neutral (google.com: 81.103.221.48 is neither permitted nor denied by best guess record for domain of dsd@laptop.org) client-ip=81.103.221.48; Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20101219190831.IFIY19887.mtaout02-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com>; Sun, 19 Dec 2010 19:08:31 +0000 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20101219190830.UGQZ20122.aamtaout01-winn.ispmail.ntl.com@zog.reactivated.net>; Sun, 19 Dec 2010 19:08:30 +0000 Received: by zog.reactivated.net (Postfix, from userid 1000) id A6C189D401C; Sun, 19 Dec 2010 19:08:28 +0000 (GMT) From: Daniel Drake To: a.zummo@towertech.it Cc: rtc-linux@googlegroups.com Cc: linux-kernel@vger.kernel.org Cc: pgf@laptop.org Cc: rjw@sisk.pl Subject: [rtc-linux] [PATCH v3] rtc-cmos: fix suspend/resume Message-Id: <20101219190828.A6C189D401C@zog.reactivated.net> Date: Sun, 19 Dec 2010 19:08:28 +0000 (GMT) X-Cloudmark-Analysis: v=1.1 cv=JvdXmxIgLJv2/GthKqHpGJEEHukvLcvELVXUanXFreg= c=1 sm=0 a=3ls3dc8-EF8A:10 a=Op-mwl0xAAAA:8 a=PtJcH0kQz5UYZKdmrUkA:9 a=8VAztMvWwEF8_RtukfsA:7 a=JGgORgc_T3jlxQFO1Vl_JUNFI5kA:4 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Original-Sender: dsd@laptop.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 81.103.221.48 is neither permitted nor denied by best guess record for domain of dsd@laptop.org) smtp.mail=dsd@laptop.org Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , From: Paul Fox rtc-cmos was setting suspend/resume hooks at the device_driver level. However, the platform bus code (drivers/base/platform.c) only looks for resume hooks at the dev_pm_ops level, or within the platform_driver. Switch rtc_cmos to use dev_pm_ops so that suspend/resume code is executed again. Signed-off-by: Paul Fox Signed-off-by: Daniel Drake Acked-by: Rafael J. Wysocki --- drivers/rtc/rtc-cmos.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) v2: incorporate feedback from Rafael J. Wysocki, fix tabs, make a bit more consistent with typical SIMPLE_DEV_PM_OPS users. v3: remove const keyword already set by macro, thanks to Rafael diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 5856167..dd8242d 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -36,6 +36,7 @@ #include #include #include +#include /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ #include @@ -850,7 +851,7 @@ static void __exit cmos_do_remove(struct device *dev) #ifdef CONFIG_PM -static int cmos_suspend(struct device *dev, pm_message_t mesg) +static int cmos_suspend(struct device *dev) { struct cmos_rtc *cmos = dev_get_drvdata(dev); unsigned char tmp; @@ -898,7 +899,7 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg) */ static inline int cmos_poweroff(struct device *dev) { - return cmos_suspend(dev, PMSG_HIBERNATE); + return cmos_suspend(dev); } static int cmos_resume(struct device *dev) @@ -945,9 +946,9 @@ static int cmos_resume(struct device *dev) return 0; } +static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume); + #else -#define cmos_suspend NULL -#define cmos_resume NULL static inline int cmos_poweroff(struct device *dev) { @@ -1077,7 +1078,7 @@ static void __exit cmos_pnp_remove(struct pnp_dev *pnp) static int cmos_pnp_suspend(struct pnp_dev *pnp, pm_message_t mesg) { - return cmos_suspend(&pnp->dev, mesg); + return cmos_suspend(&pnp->dev); } static int cmos_pnp_resume(struct pnp_dev *pnp) @@ -1157,8 +1158,9 @@ static struct platform_driver cmos_platform_driver = { .shutdown = cmos_platform_shutdown, .driver = { .name = (char *) driver_name, - .suspend = cmos_suspend, - .resume = cmos_resume, +#ifdef CONFIG_PM + .pm = &cmos_pm_ops, +#endif } };