From patchwork Tue Dec 10 13:37:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 22209 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E3EAE23908 for ; Tue, 10 Dec 2013 13:38:08 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id lx4sf18799510iec.10 for ; Tue, 10 Dec 2013 05:38:08 -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=yyxGfAquu1ALCKqffiMGaA3IA18R3LJ6OyO+2exos/M=; b=Y5CulPCY5RAtUFbK998sbtGmsK18KyRS5dZWJQ6a3cjdzKHcVuUq+3It/Izwx5gHLH mxNZgBLX+BHOTQHzQUVtd9c4ITI6nfT+XydbUT5VCfESxasX3t6lS1FE5H+bVmv4aRB9 IL9cMJJGIbqiv84MlKD4PPQPeoCjXdH2QDcgtdwM3JpIR7Eee2iMLd1yPw6KgHKdN9my 8lePkik2SmihPgR2agD3PeGUKaU9uldDdjiiGs6ERi3IxXaoJN+WZqMYqw1o7FBLfjRg aqliEXQA/qEuzMgBEghlIGJle+iBPa/8tYNJFEB57gxs9brJ0tsKyrfDnzojs1OV6J2g 4lcA== X-Gm-Message-State: ALoCoQm6BXmVWWiwuoBqouTijR6/f9JsDj+lLpj0Cg/w28Cuaqx0Dwynw9hp04Fq1xd1g5cNgNsK X-Received: by 10.182.19.164 with SMTP id g4mr8430369obe.21.1386682688381; Tue, 10 Dec 2013 05:38:08 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.38.36 with SMTP id d4ls2398925qek.7.gmail; Tue, 10 Dec 2013 05:38:08 -0800 (PST) X-Received: by 10.58.11.73 with SMTP id o9mr13718230veb.8.1386682686777; Tue, 10 Dec 2013 05:38:06 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id a6si5143395vdp.52.2013.12.10.05.38.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 05:38:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id q12so526593vbe.6 for ; Tue, 10 Dec 2013 05:38:06 -0800 (PST) X-Received: by 10.221.39.195 with SMTP id tn3mr13688520vcb.2.1386682685194; Tue, 10 Dec 2013 05:38:05 -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 u4csp188568vcz; Tue, 10 Dec 2013 05:38:04 -0800 (PST) X-Received: by 10.153.7.106 with SMTP id db10mr8282083lad.9.1386682683873; Tue, 10 Dec 2013 05:38:03 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx.google.com with ESMTPS id y7si5466473lal.134.2013.12.10.05.38.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 05:38:03 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.48 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id n7so2655658lam.21 for ; Tue, 10 Dec 2013 05:38:03 -0800 (PST) X-Received: by 10.152.225.161 with SMTP id rl1mr8119748lac.5.1386682683167; Tue, 10 Dec 2013 05:38:03 -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 di11sm21862187lac.0.2013.12.10.05.37.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 05:38:02 -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 V2 1/3] PM / Runtime: Add second macro for definition of runtime PM callbacks Date: Tue, 10 Dec 2013 14:37:40 +0100 Message-Id: <1386682662-17633-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386682662-17633-1-git-send-email-ulf.hansson@linaro.org> References: <1386682662-17633-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.212.47 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: , By having the runtime PM callbacks implemented for CONFIG_PM, these becomes available in all combinations of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME. The benefit using this, is that we don't need to implement the wrapper functions which handles runtime PM resourses, typically called from both runtime PM and system PM callbacks. Instead the runtime PM callbacks can be invoked directly from system PM callbacks, which is useful for some drivers, subsystems and power domains. 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 that will have to be distinguished in case by case. 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.