From patchwork Wed Nov 27 15:34:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21815 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4B85D23FE8 for ; Wed, 27 Nov 2013 15:35:33 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf11401356qec.8 for ; Wed, 27 Nov 2013 07:35:33 -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=GiZJRtxtTmIdzEO+YQRbcY2nWsn2gYgWAq/o5K11nyE=; b=NOSt5aJDOyNWKSwBhDWspQA7yC0WS73OBDxNTl6PmnsmM0A8U4Os5gTE3UbaGJXvz2 e271xGqm0vu75Pw4M02cWPsXPqABV2KB54yXHQm0YaahaGQKy66Fdc+5LYXvqBQMzvNn fsw8rRDl5/sfzU2WLXOOqoX+Hx+xZxaI00ODwI9P6Vf/JzM4MFnGFVVq4GcuS0An3Bar heDeUkdbtoXXB09TmimWT/aXlnPw+XfRRq49+pN5/wOChzMWaZ0NC2SvAms0ds5AlWxF rmo7sYRceeRUI4jL+34kLl6MQk1YdGjtUkXJtMpiDmjCuD4sEY/V8xMKf3YXrn3pnwHk k+yA== X-Gm-Message-State: ALoCoQkFOzfMxpC4W4ojMY+oEwmdMzIrPUIBrF42iAkvASWdja1js75OZtMyQY3fViG75v7vB3w2 X-Received: by 10.52.227.99 with SMTP id rz3mr2580484vdc.0.1385566532813; Wed, 27 Nov 2013 07:35:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.70 with SMTP id s6ls1147472qen.34.gmail; Wed, 27 Nov 2013 07:35:32 -0800 (PST) X-Received: by 10.220.196.66 with SMTP id ef2mr35650247vcb.7.1385566532742; Wed, 27 Nov 2013 07:35:32 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id o7si21245498vcl.135.2013.11.27.07.35.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Nov 2013 07:35:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so5267164veb.15 for ; Wed, 27 Nov 2013 07:35:32 -0800 (PST) X-Received: by 10.52.28.243 with SMTP id e19mr753661vdh.36.1385566532667; Wed, 27 Nov 2013 07:35:32 -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 u4csp294111vcz; Wed, 27 Nov 2013 07:35:32 -0800 (PST) X-Received: by 10.152.28.230 with SMTP id e6mr24582865lah.3.1385566531556; Wed, 27 Nov 2013 07:35:31 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by mx.google.com with ESMTPS id yf5si11773364lab.77.2013.11.27.07.35.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Nov 2013 07:35:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.172 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id z5so5539817lbh.3 for ; Wed, 27 Nov 2013 07:35:31 -0800 (PST) X-Received: by 10.152.6.201 with SMTP id d9mr13320977laa.25.1385566530837; Wed, 27 Nov 2013 07:35:30 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id c15sm8352568lbq.11.2013.11.27.07.35.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Nov 2013 07:35:30 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ulf Hansson , Kevin Hilman , Alan Stern Subject: [PATCH 3/5] PM / Runtime: Add second macro for definition of runtime PM callbacks Date: Wed, 27 Nov 2013 16:34:58 +0100 Message-Id: <1385566500-7666-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1385566500-7666-1-git-send-email-ulf.hansson@linaro.org> References: <1385566500-7666-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.128.170 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 5bce0d4..529657c 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.