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: 3318231 Return-Path: X-Original-To: patchwork-linux-arm@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 D40039F37C for ; Tue, 10 Dec 2013 13:39:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41AD92020E for ; Tue, 10 Dec 2013 13:39:11 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD73E20177 for ; Tue, 10 Dec 2013 13:39:09 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqNWM-0006In-Qp; Tue, 10 Dec 2013 13:38:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqNWG-00086Z-Nz; Tue, 10 Dec 2013 13:38:36 +0000 Received: from mail-la0-f43.google.com ([209.85.215.43]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqNW5-000836-ER for linux-arm-kernel@lists.infradead.org; Tue, 10 Dec 2013 13:38:27 +0000 Received: by mail-la0-f43.google.com with SMTP id n7so2681436lam.2 for ; Tue, 10 Dec 2013 05:38:03 -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=yyxGfAquu1ALCKqffiMGaA3IA18R3LJ6OyO+2exos/M=; b=ZdMEGMsglG+K51H5bwLhD2VPQCqRS5sKI/0rQqCQp3G4As0beJnyQ+eRLTOZ1PVB74 2DSvgIQClJN0X2sYQSjAfMPHKLy/hIcJd7tqMaab1PHnkS2zmyyg8JMDquDyrmN5NCov zWHgkDtpHs+IKPiM4ETyHyjoG8WSEHjwAFk7KhcmtXaVZFUsnVe1sL9DxDos6sqc1bqU wrk6ohl7R9PJ8F4Gr75Wvw0PXlDgJCEeNNgcVXs+OoJ7BeWWjIn6Bjz1rFjZlcxqRTHf M0Eo2dkiirm/OWmTTotoClnCP3QkbID4yqiKv0moBNp6nCJ1LpL8DIuQRgQ77DMp+ufh A3Wg== X-Gm-Message-State: ALoCoQnyjzViMAKjWekHNVaACNxYZT+NpcS5qXEAswpUeSbHLXKRY7rb3ViXp6fWlDlYvLCl1Vxd 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131210_083825_699320_D1BAC73E X-CRM114-Status: GOOD ( 12.66 ) X-Spam-Score: -2.6 (--) Cc: Ulf Hansson , Kevin Hilman , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Alan Stern , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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.