From patchwork Tue Nov 26 11:04:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 3238751 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 C8BE4C045B for ; Tue, 26 Nov 2013 11:05:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 931F9203AE for ; Tue, 26 Nov 2013 11:05:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 373F5203C4 for ; Tue, 26 Nov 2013 11:05:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756513Ab3KZLFA (ORCPT ); Tue, 26 Nov 2013 06:05:00 -0500 Received: from mail-la0-f52.google.com ([209.85.215.52]:60165 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755499Ab3KZLE6 (ORCPT ); Tue, 26 Nov 2013 06:04:58 -0500 Received: by mail-la0-f52.google.com with SMTP id y1so2259773lam.11 for ; Tue, 26 Nov 2013 03:04:57 -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=ZPbbjHyKnqjD2w+0zDfjIXThsRIcsWtXa9PyT0gVXKc2HoteGDD2robTF3j8WCXfJo 3N6TjLmHt6KXvwfB27jYoQ3e59coSjvUoq7GOFcbejtLkE5MVQVJP05fDhgt3zKFJlTf 5fC7sA+TnecbKrzq/7qUN4Qqp0QXw0Z1B7DD26SPgpCilUyWn6ebT0mzZI+WB6IHRAXl k07vFboehMLnYf18QBE8XiZ48XPlgdQy9uSnRCWH1EbcxBbR+mdIAH0kWssan7XtN7Rj hTzooF06XzJQfz3Xn/UhE9d/NasYjm24IbT7sFtecozqeCs6edHJGu4YM+ZJ+TwGTGmW qm+Q== X-Gm-Message-State: ALoCoQlPWY5+DNzPAYSppgaOSvHSqs3DTUMHLsDJjgylTrY0FlkZ6U5+H4bdfpaqx8qsOLXb2DI4 X-Received: by 10.152.87.105 with SMTP id w9mr5062127laz.27.1385463897595; Tue, 26 Nov 2013 03:04:57 -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 bo10sm9566938lbb.16.2013.11.26.03.04.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 03:04:56 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, Ulf Hansson , Kevin Hilman , Alan Stern Subject: [PATCH 2/2] PM / Sleep: Add macro to define common late/early system PM callbacks Date: Tue, 26 Nov 2013 12:04:46 +0100 Message-Id: <1385463886-9335-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1385463886-9335-1-git-send-email-ulf.hansson@linaro.org> References: <1385463886-9335-1-git-send-email-ulf.hansson@linaro.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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, \