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: 21776 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CD40E202E0 for ; Tue, 26 Nov 2013 11:05:00 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id 6sf12709780qea.1 for ; Tue, 26 Nov 2013 03:04:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=0wPZwZprVS2zko4IC+cMIewjDmXfNf736nP1MyqDF8w=; b=jI2DBWIrowO6g2KDIjH7D04o1xTkoIVZYbsBgZT1vcvzYY8vRzUayfpxlR2fIDyMz9 bns4vZvzBqjgMzpra+akkhAKteh6Y0sOvudruI8sdixM/M03Zt7ftUd+OnHIcscrE7Nq c050Q2nBAoSTG3c/o93DmGry1HmdW6BA+XUR+cJzGpwzdjt+CnugguljOLgbaGancXsO KFQeoQ4bdn39b8KNCy+UWhqbjaCDDg/PgjJzfQ99j3PGVOYbKbh0dDnjBvK7AeoRyYKz VsKMHwz9bBS62X59L0YLzsE6Z3H1gcAKmGxxNl9Juzw1kRRE3kki8CYKUlQIfw3cTFyG P6uw== X-Gm-Message-State: ALoCoQkVPcilRACAno+cZDgMRiEFtH/ruwmckmCbIUiTR5gsj8VdbjaLuB23bsfekHY2qb/0eijK X-Received: by 10.236.180.2 with SMTP id i2mr14037896yhm.4.1385463899438; Tue, 26 Nov 2013 03:04:59 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.176 with SMTP id z16ls2528654qeb.16.gmail; Tue, 26 Nov 2013 03:04:59 -0800 (PST) X-Received: by 10.58.168.205 with SMTP id zy13mr9742871veb.19.1385463899355; Tue, 26 Nov 2013 03:04:59 -0800 (PST) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id pu5si19340067veb.135.2013.11.26.03.04.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 03:04:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id lc6so3788502vcb.13 for ; Tue, 26 Nov 2013 03:04:59 -0800 (PST) X-Received: by 10.52.116.74 with SMTP id ju10mr25104599vdb.20.1385463899265; Tue, 26 Nov 2013 03:04:59 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp203602vcz; Tue, 26 Nov 2013 03:04:58 -0800 (PST) X-Received: by 10.152.28.230 with SMTP id e6mr20314867lah.3.1385463898288; Tue, 26 Nov 2013 03:04:58 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com [209.85.215.47]) by mx.google.com with ESMTPS id du3si8410381lbc.1.2013.11.26.03.04.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 03:04:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.47 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id ep20so4033226lab.20 for ; Tue, 26 Nov 2013 03:04:57 -0800 (PST) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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, \