From patchwork Tue Nov 26 11:04:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21775 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34EB5202E0 for ; Tue, 26 Nov 2013 11:04:56 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id id10sf12138069vcb.0 for ; Tue, 26 Nov 2013 03:04:55 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=VfCcjo2xN1Dn0Zs95PI1ssQC2xdvTHOduUvkyR/X+OE=; b=imqgcPD9K8uG0BsJigSEhgS5PbBN99QHOrKOJL6kYVdYXSOCHsfuJZMm/eaEsjGs37 XVAsGVQMq7VpWSfAWhGB9e4PXw2YBH+13RJLYj3Bhns+sq2z/YRxGV1XDf7Z2dD73Bq3 G41fKl1WT1rbsHPM88EjZCRuEIGgS7JWnJjwTJkBrCBdmdOp6dTHcl3cImQxvzvWdGN1 WWoREJjhjTcjN9F3PJ96L56Z1wEgJzxz2LKY0dICtMyONpfbD0dLnTN3JzvXhcIhbgqD W6AsUbz/PzkKojWt/qN1KHzWkgXyHKoZzi0gV+OTnV1D35r6FBcftUNDEeRpuikPzpdS jQvw== X-Gm-Message-State: ALoCoQkFl7R4jWxl7im97qjxW8C24Go7Cl7wo7CEzu7nY6dY7fUKgLUhabAJDok0psSGjOBWBn/S X-Received: by 10.236.209.134 with SMTP id s6mr14058778yho.40.1385463895497; Tue, 26 Nov 2013 03:04:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.233 with SMTP id l9ls2514427qej.79.gmail; Tue, 26 Nov 2013 03:04:55 -0800 (PST) X-Received: by 10.58.11.73 with SMTP id o9mr29766443veb.8.1385463895424; Tue, 26 Nov 2013 03:04:55 -0800 (PST) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id gw7si19368768veb.38.2013.11.26.03.04.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 03:04:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.52; Received: by mail-vb0-f52.google.com with SMTP id f13so3621646vbg.25 for ; Tue, 26 Nov 2013 03:04:55 -0800 (PST) X-Received: by 10.52.113.194 with SMTP id ja2mr359893vdb.61.1385463895290; Tue, 26 Nov 2013 03:04:55 -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 u4csp203599vcz; Tue, 26 Nov 2013 03:04:54 -0800 (PST) X-Received: by 10.152.1.197 with SMTP id 5mr15873735lao.0.1385463894296; Tue, 26 Nov 2013 03:04:54 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) by mx.google.com with ESMTPS id d9si4993678lad.0.2013.11.26.03.04.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 03:04:54 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.45 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id eh20so4159536lab.32 for ; Tue, 26 Nov 2013 03:04:53 -0800 (PST) X-Received: by 10.152.20.6 with SMTP id j6mr25332484lae.8.1385463893538; Tue, 26 Nov 2013 03:04:53 -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.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Nov 2013 03:04:52 -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 1/2] PM / Runtime: Add second macro for definition of runtime PM callbacks Date: Tue, 26 Nov 2013 12:04:45 +0100 Message-Id: <1385463886-9335-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 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.212.52 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: , It is allowed and will in many cases make sense to have the runtime PM callbacks to be defined for CONFIG_PM instead of CONFIG_PM_RUNTIME. Since the PM core disables runtime PM during system suspend, before the .suspend_late callbacks are invoked, drivers could at this point directly invoke it's runtime PM callbacks or even walk through it's bus or power domain, to put it's device into low power state. Use the new macro SET_PM_RUNTIME_PM_OPS in cases were the above makes sense. Make sure the callbacks are encapsulated within CONFIG_PM instead of CONFIG_PM_RUNTIME. Do note that the old macro SET_RUNTIME_PM_OPS, which is being quite widely used right now, requires the callbacks to be defined for CONFIG_PM_RUNTIME. In many cases it will certainly be convenient to convert to the new macro above, but still some cases are optimal for only CONFIG_PM_RUNTIME. Cc: Kevin Hilman Cc: Alan Stern Signed-off-by: Ulf Hansson --- include/linux/pm.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/pm.h b/include/linux/pm.h index a224c7f..7a830a7 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -320,6 +320,15 @@ struct dev_pm_ops { #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) #endif +#ifdef CONFIG_PM +#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ + .runtime_suspend = suspend_fn, \ + .runtime_resume = resume_fn, \ + .runtime_idle = idle_fn, +#else +#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) +#endif + /* * Use this if you want to use the same suspend and resume callbacks for suspend * to RAM and hibernation.