From patchwork Wed Nov 5 23:11:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 5238511 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 8521F9F295 for ; Wed, 5 Nov 2014 23:11:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85340200F0 for ; Wed, 5 Nov 2014 23:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 801C8200C1 for ; Wed, 5 Nov 2014 23:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750984AbaKEXL1 (ORCPT ); Wed, 5 Nov 2014 18:11:27 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:39672 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750834AbaKEXL0 (ORCPT ); Wed, 5 Nov 2014 18:11:26 -0500 Received: by mail-pa0-f47.google.com with SMTP id kx10so1734808pab.34 for ; Wed, 05 Nov 2014 15:11:26 -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=XQ9Nt9YM1u0h9CtVdZTyBjSaGotSWJ/wSkybn1N2odI=; b=CxcYUUuuVaa5mc0CpAbd35JkejSoHHcsxTX9s71PrpObZtaxZQ3L/DNHoljNH5nkVe VVSVmsjbqWp0CviVbrtW2xILw0xDzYm+E7zvjXs+dxAFYhEfPLURA93F30SMw8UIDt+9 Wp/iOVQe5eN4CM000OomM7iapzx57WGdZY9XP7AZC0vR35hemCye6LDplkR6KjRu5j2H cAiRleLoK4EMj5cIvzHgBGX3CY1jGfpztPa28+S/XZPuBPULzXR5HnEvWUiRC15Wisoy PXNLDW9aW7QcvsTxJ4IvePsCtSYQ789NKwwW5OI4i2OqHEIgrCIYTPVsD9x0AimIeUU8 B0AA== X-Gm-Message-State: ALoCoQmsxGWz01UP4/86hkfiJST1uv5g+SUuKUQQiM8REM9T4FAkN5Ra/lqMwxZHXCm4rqMUrn2C X-Received: by 10.68.215.100 with SMTP id oh4mr357267pbc.11.1415229086411; Wed, 05 Nov 2014 15:11:26 -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 lm3sm4169184pab.34.2014.11.05.15.11.24 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:11:25 -0800 (PST) From: Kevin Hilman To: "Rafael J. Wysocki" Cc: Dmitry Torokhov , Ulf Hansson , Len Brown , Pavel Machek , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Geert Uytterhoeven , Alan Stern , Greg Kroah-Hartman , Tomasz Figa , Simon Horman , Magnus Damm , Ben Dooks , Kukjin Kim , Philipp Zabel , Mark Brown , Wolfram Sang , Russell King , Jack Dai , Jinkun Hong , Aaron Lu , Sylwester Nawrocki Subject: Re: [PATCH] PM / Domains: Change prototype for the ->attach_dev() callback References: <1414670569-3002-1-git-send-email-ulf.hansson@linaro.org> <20141105013353.GA19238@dtor-ws> <7h7fz92rqk.fsf@deeprootsystems.com> <3267963.fqUYb7m9Rv@vostro.rjw.lan> Date: Wed, 05 Nov 2014 15:11:23 -0800 In-Reply-To: <3267963.fqUYb7m9Rv@vostro.rjw.lan> (Rafael J. Wysocki's message of "Thu, 06 Nov 2014 00:21:01 +0100") Message-ID: <7hsihx1bvo.fsf@deeprootsystems.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 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 "Rafael J. Wysocki" writes: > On Wednesday, November 05, 2014 02:43:31 PM Kevin Hilman wrote: >> 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. > > The subject and changelog need to be updated too IMO. > Right. Here you go. Kevin ----- >8 ------ From c18a6bf3121979c4102ba4f7edb3ac41e3921fc6 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 and detach callbacks Convert the prototypes to return an int in order to support error handling in these callbacks. Also, as suggested by Dmitry Torokhov, pass the domain pointer for use inside the callbacks, and so that they match the existing power_on/power_off callbacks which currently take the domain pointer. Acked-by: 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: Geert Uytterhoeven --- 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)