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: 3248701 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 422F9C045B for ; Wed, 27 Nov 2013 15:36:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B47C2039C for ; Wed, 27 Nov 2013 15:36:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DA1B72012C for ; Wed, 27 Nov 2013 15:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756774Ab3K0Pfd (ORCPT ); Wed, 27 Nov 2013 10:35:33 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:40544 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756743Ab3K0Pfc (ORCPT ); Wed, 27 Nov 2013 10:35:32 -0500 Received: by mail-la0-f46.google.com with SMTP id eh20so5266363lab.19 for ; Wed, 27 Nov 2013 07:35:31 -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=GiZJRtxtTmIdzEO+YQRbcY2nWsn2gYgWAq/o5K11nyE=; b=YKsL9zUxI1lmiD1sh6QB0rmsXWMgbWXJXqs2btbJJ/RankLXo4Te8D8Bf1DkXvRISN 6TOam5488K2xQ4cQd/Hw02AarLZ9talTlqK9cL5p59ORBAvwdtebyTISoCk2ziLRurrS Zi0oHYueuDqA26OP802OkT+Vrc9AFluy3KGWDO3hnL/p4tmnsXdUTGN5vrBxQMOaBAyu vLm24zncyS0MCgy8JnDziw03uKqCcqZknKlHryCLA5Gd90RtlDzgtZqwMBYJtHNagzhb 7/cQqnzo3QGMBIbtC0vXgnz++WKh0AAgol5k6dJEWleRXDx2K8fvEAxqt0ulAECRSE8B TyNg== X-Gm-Message-State: ALoCoQnQeSd6JFV0K/rvOTmrlOws61vWrTR9cAjSRTKTgvY628hnWy3ibnDccdP+SnGFWSXqQyzN 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 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 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.