From patchwork Wed Nov 5 22:43:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 5238481 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 5A3F49F472 for ; Wed, 5 Nov 2014 22:46:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63EBB2012E for ; Wed, 5 Nov 2014 22:46:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 6ABA720109 for ; Wed, 5 Nov 2014 22:46:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xm9J5-0002cb-6T; Wed, 05 Nov 2014 22:44:03 +0000 Received: from mail-pa0-f48.google.com ([209.85.220.48]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xm9J1-0002ZD-BS for linux-arm-kernel@lists.infradead.org; Wed, 05 Nov 2014 22:43:59 +0000 Received: by mail-pa0-f48.google.com with SMTP id ey11so1673800pad.35 for ; Wed, 05 Nov 2014 14:43:36 -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:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=eIkuQUaHy//rTlPpQibK4J7BWaA73GuGUHuIZNgE0ko=; b=P6twJkeTPgC7FphChVAS8oyE0y1Wo2NJIypo3Mv45BWLtGla2SUo3v1EuZ/tpH6obT obIGKVwPz57bVmsAM4NBjd2o1EGvrfrIGFqV0sG7FshHOAuI7vBgtEgKlCd9nXXwBHsV TYwCSXNiNkRiNK34mzG4jsRm/giyBDtrRejoc27E5K85KCVRmudZVPQYRiwv2aUhSYBq 7AUmPReER4gdfy55sXmMZvoRhMMTHMMrbIMdzvV1SK0sHt4KDJf1C2o2JfrcFEWIugdK UawXHr9WqY4f2xWh4L2v5PNxQNi+ymdOmZEgqTxEy2fBRVHSxW0MYCgxuyOOJQaO/a8U g8Qg== X-Gm-Message-State: ALoCoQmjXy/A7WBAgO0DC0naUbSiJo0YyCfmtqNa540gPDkmoXmMbnTreboBbMzvOQdRBZ7hrW+s X-Received: by 10.66.220.3 with SMTP id ps3mr478930pac.8.1415227415896; Wed, 05 Nov 2014 14:43:35 -0800 (PST) Received: from localhost (c-67-183-17-239.hsd1.wa.comcast.net. [67.183.17.239]) by mx.google.com with ESMTPSA id kk7sm4141893pab.31.2014.11.05.14.43.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 05 Nov 2014 14:43:34 -0800 (PST) From: Kevin Hilman To: Dmitry Torokhov Subject: Re: [PATCH] PM / Domains: Change prototype for the ->attach_dev() callback References: <1414670569-3002-1-git-send-email-ulf.hansson@linaro.org> <3981560.mBph1QJkfl@vostro.rjw.lan> <7h4mul9ttl.fsf@deeprootsystems.com> <20141105013353.GA19238@dtor-ws> Date: Wed, 05 Nov 2014 14:43:31 -0800 In-Reply-To: <20141105013353.GA19238@dtor-ws> (Dmitry Torokhov's message of "Tue, 4 Nov 2014 17:33:53 -0800") Message-ID: <7h7fz92rqk.fsf@deeprootsystems.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141105_144359_419884_A9E1D30B X-CRM114-Status: GOOD ( 20.73 ) X-Spam-Score: -0.7 (/) Cc: Ulf Hansson , Philipp Zabel , Geert Uytterhoeven , Wolfram Sang , Tomasz Figa , Pavel Machek , Kukjin Kim , Sylwester Nawrocki , linux-samsung-soc@vger.kernel.org, Russell King , Magnus Damm , Alan Stern , Jack Dai , Len Brown , linux-pm@vger.kernel.org, Jinkun Hong , Mark Brown , Ben Dooks , linux-arm-kernel@lists.infradead.org, Aaron Lu , Greg Kroah-Hartman , "Rafael J. Wysocki" , Simon Horman X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Dmitry Torokhov writes: > On Thu, Oct 30, 2014 at 01:38:30PM -0700, Kevin Hilman wrote: >> "Rafael J. Wysocki" writes: >> >> > On Thursday, October 30, 2014 01:02:49 PM Ulf Hansson wrote: >> >> Convert the prototype to return and int. This is just an initial step, >> >> needed to support error handling. >> >> >> >> Signed-off-by: Ulf Hansson >> >> Acked-by: Kevin Hilman >> >> >> >> >> This patch is intended as fix for 3.18 rc[n]. Why? >> >> >> >> There are other SOC specific patches around that adds genpd support and which >> >> implements the ->attach_dev() callback. To prevent having an "atomic" patch >> >> during the next release cycle, let's change the prototype now instead. >> >> >> >> Further patches will add the actual error handling in genpd and these can then >> >> be reviewed and tested thoroughly. >> > >> > So we have no users of ->attach_dev at the moment, right? >> >> Not in mainline, but there are a couple getting ready to hit -next, so >> we wanted to fix this before they arrive so that adding the error >> handling will be easier. > > BTW, while we are at it, can we also pass the domain itself to > attach_dev() and detach_dev()? If anything it helps with debugging (you > can print domain name from the callbacks). Agreed, and it makes it match the other callbacks (power_off, power_on) which currently take struct generic_pm_domain *domain. Updated version of $SUBJECT patch below. Kevin ----- >8 ------ From 353a62ffae2f9228142c8a2093108f9eda8dc6b4 Mon Sep 17 00:00:00 2001 From: Ulf Hansson Date: Thu, 30 Oct 2014 13:02:49 +0100 Subject: [PATCH] PM / Domains: Change prototype for the ->attach_dev() callback Convert the prototype to return and int. This is just an initial step, needed to support error handling. Cc: Dmitry Torokhov [khilman: added domain as parameter to callbacks, as suggested by Dmitry] Signed-off-by: Ulf Hansson Signed-off-by: Kevin Hilman Acked-by: Dmitry Torokhov --- drivers/base/power/domain.c | 4 ++-- include/linux/pm_domain.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 40bc2f4072cc..b520687046d4 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1437,7 +1437,7 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, spin_unlock_irq(&dev->power.lock); if (genpd->attach_dev) - genpd->attach_dev(dev); + genpd->attach_dev(genpd, dev); mutex_lock(&gpd_data->lock); gpd_data->base.dev = dev; @@ -1499,7 +1499,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, genpd->max_off_time_changed = true; if (genpd->detach_dev) - genpd->detach_dev(dev); + genpd->detach_dev(genpd, dev); spin_lock_irq(&dev->power.lock); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 73e938b7e937..b3ed7766a291 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -72,8 +72,10 @@ struct generic_pm_domain { bool max_off_time_changed; bool cached_power_down_ok; struct gpd_cpuidle_data *cpuidle_data; - void (*attach_dev)(struct device *dev); - void (*detach_dev)(struct device *dev); + int (*attach_dev)(struct generic_pm_domain *domain, + struct device *dev); + void (*detach_dev)(struct generic_pm_domain *domain, + struct device *dev); }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)