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: 3238761 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 D81BF9F3A0 for ; Tue, 26 Nov 2013 11:05:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4552203C4 for ; Tue, 26 Nov 2013 11:05:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C7F9203DC for ; Tue, 26 Nov 2013 11:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755499Ab3KZLFA (ORCPT ); Tue, 26 Nov 2013 06:05:00 -0500 Received: from mail-la0-f53.google.com ([209.85.215.53]:40080 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756511Ab3KZLE7 (ORCPT ); Tue, 26 Nov 2013 06:04:59 -0500 Received: by mail-la0-f53.google.com with SMTP id ea20so4169372lab.12 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=cZgGCpvTjb27MoJlOtCjRoj2RcWRaE72kEm3oIKJpb27ybmVAqswlhOYgWtlvgM+tw 2WlyIDYLktD35uE0TT0swPAkAxzuN2sFfcU2+3Cujzcd3Nub2MTORGESpiQwHANt5z0F 5lhIEQaD3jI6P5I8lxzTDWMIfBEiUFyylJKIan5UYKUmUT2rf1f4sL96AMTMWPT+SFDW iqhfXhuy7mtVq8A8C/RvC9olu1qrFQ546qA7Wow6ciCrETW7vvokeU/kOK/0q5sGpnPc qgKRCxEZJ862qQafoxbTnpBuKT7O9vd8sFZ4Nsbmm5SsaFAVjVTbQF8kBhOKRSXTicOH Vn/A== X-Gm-Message-State: ALoCoQmGeMJUo3aVl3VCRtqNWXbXbqO3zcohY+vmvTcnZyz9tuG4YgT4FUikEtN7keALa91XfsDB 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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, \