From patchwork Tue Jun 7 19:29:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 859152 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p57JUHda017070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 7 Jun 2011 19:30:38 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p57JSpQS004168; Tue, 7 Jun 2011 12:28:52 -0700 Received: from ogre.sisk.pl (ogre.sisk.pl [217.79.144.158]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p57JSmrp004153 for ; Tue, 7 Jun 2011 12:28:49 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id CB0EE1B0C39; Tue, 7 Jun 2011 21:12:44 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26383-03; Tue, 7 Jun 2011 21:12:26 +0200 (CEST) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 7DB7F1ACC53; Tue, 7 Jun 2011 21:12:26 +0200 (CEST) From: "Rafael J. Wysocki" To: Janusz Krzysztofik Date: Tue, 7 Jun 2011 21:29:25 +0200 User-Agent: KMail/1.13.6 (Linux/2.6.39+; KDE/4.6.0; x86_64; ; ) References: <201106051531.32878.jkrzyszt@tis.icnet.pl> <201106061947.36238.rjw@sisk.pl> <201106062118.18734.jkrzyszt@tis.icnet.pl> In-Reply-To: <201106062118.18734.jkrzyszt@tis.icnet.pl> MIME-Version: 1.0 Message-Id: <201106072129.26063.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-3.936 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: Len Brown , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-pm@lists.linux-foundation.org, "linux-omap@vger.kernel.org" Subject: Re: [linux-pm] [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 07 Jun 2011 19:30:38 +0000 (UTC) On Monday, June 06, 2011, Janusz Krzysztofik wrote: > On Mon 06 Jun 2011 at 19:47:36 Rafael J. Wysocki wrote: > > Hi, > > > > On Sunday, June 05, 2011, Janusz Krzysztofik wrote: > > > In its current form, pm_runtime_clk_notify() iterates through sub- > > > strings of pm_clk_notifier_block.con_ids[0] rather than consecutive > > > pm_clk_notifier_block.con_ids[] elements. As a noticeable result, > > > McBSP1 port no longer worked for me on updated > > > arch/arm/mach-omap1/pm_bus.c (commit > > > 600b776eb39a13a28b090ba9efceb0c69d4508aa, "OMAP1 / PM: Use generic > > > clock manipulation routines for runtime PM"), not being able to > > > activate "fck" when required. > > > > > > Tested on Amstrad Delta. > > > > > > Signed-off-by: Janusz Krzysztofik > > > --- > > > > > > drivers/base/power/clock_ops.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > --- git/drivers/base/power/clock_ops.c.orig 2011-05-30 > > > 22:16:35.000000000 +0200 +++ > > > git/drivers/base/power/clock_ops.c 2011-06-05 15:19:55.000000000 > > > +0200 @@ -291,7 +291,7 @@ static int pm_runtime_clk_notify(struct > > > > > > { > > > > > > struct pm_clk_notifier_block *clknb; > > > struct device *dev = data; > > > > > > - char *con_id; > > > + char **con_id; > > > > > > int error; > > > > > > dev_dbg(dev, "%s() %ld\n", __func__, action); > > > > > > @@ -309,8 +309,8 @@ static int pm_runtime_clk_notify(struct > > > > > > dev->pwr_domain = clknb->pwr_domain; > > > if (clknb->con_ids[0]) { > > > > > > - for (con_id = clknb->con_ids[0]; *con_id; con_id++) > > > - pm_runtime_clk_add(dev, con_id); > > > + for (con_id = &clknb->con_ids[0]; *con_id; con_id++) > > > + pm_runtime_clk_add(dev, *con_id); > > > > > > } else { > > > > > > pm_runtime_clk_add(dev, NULL); > > > > > > } > > > > First off, sorry for the breakage. Second, while the patch is > > correct in the part is covered, it is incomplete (it also should > > cover the !CONFIG_PM_RUNTIME case. So, I think the appended patch > > would be better. > > That's right, please take it over. OK, below is an "official" version. Can you please double check if it fixes the problem for you? Rafael --- From: Rafael J. Wysocki Subject: PM / Runtime: Fix loops in pm_runtime_clk_notify() The loops over connection ID strings in pm_runtime_clk_notify() should actually iterate over the strings and not over the elements of the first of them, so make those loops behave as appropriate. This fixes a regression introduced by commit 600b776eb39a13a28b090 (OMAP1 / PM: Use generic clock manipulation routines for runtime PM). Reported-by: Janusz Krzysztofik Signed-off-by: Rafael J. Wysocki --- drivers/base/power/clock_ops.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) Index: linux-2.6/drivers/base/power/clock_ops.c =================================================================== --- linux-2.6.orig/drivers/base/power/clock_ops.c +++ linux-2.6/drivers/base/power/clock_ops.c @@ -291,7 +291,7 @@ static int pm_runtime_clk_notify(struct { struct pm_clk_notifier_block *clknb; struct device *dev = data; - char *con_id; + char **con_id; int error; dev_dbg(dev, "%s() %ld\n", __func__, action); @@ -309,8 +309,8 @@ static int pm_runtime_clk_notify(struct dev->pwr_domain = clknb->pwr_domain; if (clknb->con_ids[0]) { - for (con_id = clknb->con_ids[0]; *con_id; con_id++) - pm_runtime_clk_add(dev, con_id); + for (con_id = clknb->con_ids; *con_id; con_id++) + pm_runtime_clk_add(dev, *con_id); } else { pm_runtime_clk_add(dev, NULL); } @@ -380,7 +380,7 @@ static int pm_runtime_clk_notify(struct { struct pm_clk_notifier_block *clknb; struct device *dev = data; - char *con_id; + char **con_id; dev_dbg(dev, "%s() %ld\n", __func__, action); @@ -389,16 +389,16 @@ static int pm_runtime_clk_notify(struct switch (action) { case BUS_NOTIFY_ADD_DEVICE: if (clknb->con_ids[0]) { - for (con_id = clknb->con_ids[0]; *con_id; con_id++) - enable_clock(dev, con_id); + for (con_id = clknb->con_ids; *con_id; con_id++) + enable_clock(dev, *con_id); } else { enable_clock(dev, NULL); } break; case BUS_NOTIFY_DEL_DEVICE: if (clknb->con_ids[0]) { - for (con_id = clknb->con_ids[0]; *con_id; con_id++) - disable_clock(dev, con_id); + for (con_id = clknb->con_ids; *con_id; con_id++) + disable_clock(dev, *con_id); } else { disable_clock(dev, NULL); }