linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids
@ 2011-06-05 13:31 Janusz Krzysztofik
  2011-06-06 17:47 ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Janusz Krzysztofik @ 2011-06-05 13:31 UTC (permalink / raw)
  To: linux-pm
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-kernel, linux-omap

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 <jkrzyszt@tis.icnet.pl>
---
 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);
 		}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids
  2011-06-05 13:31 [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids Janusz Krzysztofik
@ 2011-06-06 17:47 ` Rafael J. Wysocki
  2011-06-06 19:18   ` Janusz Krzysztofik
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2011-06-06 17:47 UTC (permalink / raw)
  To: Janusz Krzysztofik
  Cc: linux-pm, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-kernel, linux-omap

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 <jkrzyszt@tis.icnet.pl>
> ---
>  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.

Thanks,
Rafael

---
 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);
 		}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids
  2011-06-06 17:47 ` Rafael J. Wysocki
@ 2011-06-06 19:18   ` Janusz Krzysztofik
  2011-06-07 19:29     ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Janusz Krzysztofik @ 2011-06-06 19:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-pm, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-kernel, linux-omap

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 <jkrzyszt@tis.icnet.pl>
> > ---
> > 
> >  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.

Thanks,
Janusz


> Thanks,
> Rafael
> 
> ---
>  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);
>  		}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids
  2011-06-06 19:18   ` Janusz Krzysztofik
@ 2011-06-07 19:29     ` Rafael J. Wysocki
  2011-06-07 21:24       ` Janusz Krzysztofik
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2011-06-07 19:29 UTC (permalink / raw)
  To: Janusz Krzysztofik
  Cc: linux-pm, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-kernel, linux-omap

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 <jkrzyszt@tis.icnet.pl>
> > > ---
> > > 
> > >  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 <rjw@sisk.pl>
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 <jkrzyszt@tis.icnet.pl>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 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);
 		}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids
  2011-06-07 19:29     ` Rafael J. Wysocki
@ 2011-06-07 21:24       ` Janusz Krzysztofik
  2011-06-07 21:35         ` Rafael J. Wysocki
  2011-06-07 22:27         ` Janusz Krzysztofik
  0 siblings, 2 replies; 7+ messages in thread
From: Janusz Krzysztofik @ 2011-06-07 21:24 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-pm, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-kernel, linux-omap

On Tue 07 Jun 2011 at 21:29:25 Rafael J. Wysocki wrote:
> 
> OK, below is an "official" version.  Can you please double check if
> it fixes the problem for you?

Hi,
I've tested it successfully, but only the CONFIG_PM_RUNTIME=y case, not 
the other because of still another McBSP issue, I believe, described 
elswhere.

Thanks,
Janusz


> 
> Rafael
> 
> ---
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 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 <jkrzyszt@tis.icnet.pl>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
>  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);
>  		}
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap"
> in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids
  2011-06-07 21:24       ` Janusz Krzysztofik
@ 2011-06-07 21:35         ` Rafael J. Wysocki
  2011-06-07 22:27         ` Janusz Krzysztofik
  1 sibling, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2011-06-07 21:35 UTC (permalink / raw)
  To: Janusz Krzysztofik
  Cc: linux-pm, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-kernel, linux-omap

On Tuesday, June 07, 2011, Janusz Krzysztofik wrote:
> On Tue 07 Jun 2011 at 21:29:25 Rafael J. Wysocki wrote:
> > 
> > OK, below is an "official" version.  Can you please double check if
> > it fixes the problem for you?
> 
> Hi,
> I've tested it successfully, but only the CONFIG_PM_RUNTIME=y case, not 
> the other because of still another McBSP issue, I believe, described 
> elswhere.

OK, thanks!

If the other case turns out to cause more problems, they'll need separate
fixes anyway.

Rafael

 
> > ---
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > 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 <jkrzyszt@tis.icnet.pl>
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > ---
> >  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);
> >  		}
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-omap"
> > in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids
  2011-06-07 21:24       ` Janusz Krzysztofik
  2011-06-07 21:35         ` Rafael J. Wysocki
@ 2011-06-07 22:27         ` Janusz Krzysztofik
  1 sibling, 0 replies; 7+ messages in thread
From: Janusz Krzysztofik @ 2011-06-07 22:27 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-pm, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	linux-kernel, linux-omap

On Tue 07 Jun 2011 at 23:24:53 Janusz Krzysztofik wrote:
> On Tue 07 Jun 2011 at 21:29:25 Rafael J. Wysocki wrote:
> > OK, below is an "official" version.  Can you please double check if
> > it fixes the problem for you?
> 
> Hi,
> I've tested it successfully, but only the CONFIG_PM_RUNTIME=y case,
> not the other because of still another McBSP issue, I believe,
> described elswhere.

With a patch from Kevin, I was able to test the !PM_RUNTIME case 
successfully as well.

Thanks,
Janusz

> Thanks,
> Janusz
> 
> > Rafael
> > 
> > ---
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> > 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 <jkrzyszt@tis.icnet.pl>
> > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > ---
> > 
> >  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);
> >  		
> >  		}
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-omap" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-07 22:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05 13:31 [PATCH 3.0-rc1] PM / runtime: fix broken iteration over clock ids Janusz Krzysztofik
2011-06-06 17:47 ` Rafael J. Wysocki
2011-06-06 19:18   ` Janusz Krzysztofik
2011-06-07 19:29     ` Rafael J. Wysocki
2011-06-07 21:24       ` Janusz Krzysztofik
2011-06-07 21:35         ` Rafael J. Wysocki
2011-06-07 22:27         ` Janusz Krzysztofik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).