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: 3318171 Return-Path: X-Original-To: patchwork-linux-pm@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 2825A9F37C for ; Tue, 10 Dec 2013 13:38:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10AE520378 for ; Tue, 10 Dec 2013 13:38:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FA2C20177 for ; Tue, 10 Dec 2013 13:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753386Ab3LJNiG (ORCPT ); Tue, 10 Dec 2013 08:38:06 -0500 Received: from mail-la0-f48.google.com ([209.85.215.48]:41737 "EHLO mail-la0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751905Ab3LJNiE (ORCPT ); Tue, 10 Dec 2013 08:38:04 -0500 Received: by mail-la0-f48.google.com with SMTP id n7so2655652lam.21 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=AQp4ONu425Pp4cZn++pHskWxff8imZb8yNVVNveEdMTR7o0vRTMi7V3gmaikzRuNOs kZ32J6EhDEhzTnOLpsHlaHI6rftG524chwMrTcNbBUeYXE/iQL6k74Ty0hwkWUf/ZRzC 5O7W/+C3rIL9P7nJ1vnkQd8mbDCgAA46ENGKqfc7/3qTraGBmfsJjsXCEyXhpmZgHrJ+ 5dB2luI6Vx6UaYp1bKb59mdjc5gWXNh+eA6PSm9YGhc1rIGeZhMoDt3HPmcYNK+EVAtA 5UURag4o8LLb0hNeThuovgl6hjiJM0c1LeNgglugdC7q2gcNolnW4UTWbajgdCYnfP9h FjXg== X-Gm-Message-State: ALoCoQm0j8vnisYuz5asHLgMZhuJEQWDtwiM4ZV2oY97WisFL5Cp3SVDYShQgzH5vXNdG0Qu+6Hv 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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.