From patchwork Tue Dec 10 13:37:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 3318251 Return-Path: X-Original-To: patchwork-linux-arm@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 39FB69F37C for ; Tue, 10 Dec 2013 13:40:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2525B2020E for ; Tue, 10 Dec 2013 13:40:33 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AAD220177 for ; Tue, 10 Dec 2013 13:40:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqNWr-0006Yf-67; Tue, 10 Dec 2013 13:39:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqNWZ-00087c-JR; Tue, 10 Dec 2013 13:38:55 +0000 Received: from mail-la0-f48.google.com ([209.85.215.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqNWA-00083T-W9 for linux-arm-kernel@lists.infradead.org; Tue, 10 Dec 2013 13:38:32 +0000 Received: by mail-la0-f48.google.com with SMTP id n7so2678377lam.35 for ; Tue, 10 Dec 2013 05:38:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0wPZwZprVS2zko4IC+cMIewjDmXfNf736nP1MyqDF8w=; b=ktdAG6rceesDza6IB3qeJCRtChFQMLdqFzkdha/YtCk1iObWtzEsQfXMH+Dh3+Q98k zD9twdVK4RSf/HZRqlhrhkDzIgnyr68oAnmDnPV1s/ZjpFM7q7wVn0gBgZWQMG3CVlIp 70gISH0Q/Nmr1Cnjg9NwnHenbavXzh1DdcGCkBY0cPCWNJTPrvnfiJn3T4C0lnwL5Gwu f+Nt4IDrT9aPvNVUJrpDn3QLYeG4SfPPXuNS1KnrpdxnrcTh1KuIW94PPU8iU6Y6u/pw PXHnLBXumTaLwbHN88BdXnn7wr33HWm1GJl2yVHpTrPTXcwlGs+//ToDfksS+hKM0KHl xe8g== X-Gm-Message-State: ALoCoQmaLl2AIpBHHliMt0gUN7fybIXGGAI57PzL4Odec8lhXrA2cVzT4tmb+eabGWYSqdp/DJJ4 X-Received: by 10.152.115.202 with SMTP id jq10mr4216675lab.69.1386682687769; Tue, 10 Dec 2013 05:38:07 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id di11sm21862187lac.0.2013.12.10.05.38.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 05:38:07 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Subject: [PATCH V2 3/3] PM / Sleep: Add macro to define common late/early system PM callbacks Date: Tue, 10 Dec 2013 14:37:42 +0100 Message-Id: <1386682662-17633-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386682662-17633-1-git-send-email-ulf.hansson@linaro.org> References: <1386682662-17633-1-git-send-email-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131210_083831_219312_20A516AE X-CRM114-Status: UNSURE ( 9.44 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) Cc: Ulf Hansson , Kevin Hilman , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Alan Stern , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 We use the same approach as for the existing SET_SYSTEM_SLEEP_PM_OPS, but for the late and early callbacks instead. The new SET_LATE_SYSTEM_SLEEP_PM_OPS, defined for CONFIG_PM_SLEEP, will point ->suspend_late, ->freeze_late and ->poweroff_late to the same function. Vice verse happens for ->resume_early, ->thaw_early and ->restore_early. Cc: Kevin Hilman Cc: Alan Stern Signed-off-by: Ulf Hansson --- include/linux/pm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/pm.h b/include/linux/pm.h index 7a830a7..8c6583a 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -311,6 +311,18 @@ struct dev_pm_ops { #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) #endif +#ifdef CONFIG_PM_SLEEP +#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ + .suspend_late = suspend_fn, \ + .resume_early = resume_fn, \ + .freeze_late = suspend_fn, \ + .thaw_early = resume_fn, \ + .poweroff_late = suspend_fn, \ + .restore_early = resume_fn, +#else +#define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) +#endif + #ifdef CONFIG_PM_RUNTIME #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ .runtime_suspend = suspend_fn, \