linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present
@ 2010-05-23  4:42 Pinkava J.
  2010-05-23  9:19 ` Sergei Shtylyov
  2010-05-23 13:18 ` Pinkava J.
  0 siblings, 2 replies; 6+ messages in thread
From: Pinkava J. @ 2010-05-23  4:42 UTC (permalink / raw)
  To: linux-arm-kernel

When saving GPIOs during suspend/resume we need skip missing GPIO banks, not
trying get corresponding chip again and again in infinite loop.

Signed-off-by: Jiri Pinkava <jiri.pinkava@vscht.cz>
---
 arch/arm/plat-samsung/pm-gpio.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index d50ab9d..7df03f8 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -331,8 +331,10 @@ void s3c_pm_save_gpios(void)

 	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
 		ourchip = s3c_gpiolib_getchip(gpio_nr);
-		if (!ourchip)
+		if (!ourchip) {
+			gpio_nr++;
 			continue;
+		}

 		s3c_pm_save_gpio(ourchip);

@@ -369,8 +371,10 @@ void s3c_pm_restore_gpios(void)

 	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
 		ourchip = s3c_gpiolib_getchip(gpio_nr);
-		if (!ourchip)
+		if (!ourchip) {
+			gpio_nr++;
 			continue;
+		}

 		s3c_pm_resume_gpio(ourchip);

-- 
1.7.1

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

* [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present
  2010-05-23  4:42 [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present Pinkava J.
@ 2010-05-23  9:19 ` Sergei Shtylyov
  2010-05-23 12:34   ` Pinkava J.
  2010-05-24  3:32   ` Ben Dooks
  2010-05-23 13:18 ` Pinkava J.
  1 sibling, 2 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2010-05-23  9:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

Pinkava J. wrote:

> When saving GPIOs during suspend/resume we need skip missing GPIO banks, not
> trying get corresponding chip again and again in infinite loop.

    I didn't see any infinite loops there -- *continue* itself leads to 
incrementing 'gpio_nr', no?

> Signed-off-by: Jiri Pinkava <jiri.pinkava@vscht.cz>
> ---
>  arch/arm/plat-samsung/pm-gpio.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
> index d50ab9d..7df03f8 100644
> --- a/arch/arm/plat-samsung/pm-gpio.c
> +++ b/arch/arm/plat-samsung/pm-gpio.c
> @@ -331,8 +331,10 @@ void s3c_pm_save_gpios(void)
> 
>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
> -		if (!ourchip)
> +		if (!ourchip) {
> +			gpio_nr++;
>  			continue;
> +		}
> 
>  		s3c_pm_save_gpio(ourchip);
> 
> @@ -369,8 +371,10 @@ void s3c_pm_restore_gpios(void)
> 
>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
> -		if (!ourchip)
> +		if (!ourchip) {
> +			gpio_nr++;
>  			continue;
> +		}
> 
>  		s3c_pm_resume_gpio(ourchip);

WBR, Sergei

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

* [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present
  2010-05-23  9:19 ` Sergei Shtylyov
@ 2010-05-23 12:34   ` Pinkava J.
  2010-05-24  7:57     ` Sergei Shtylyov
  2010-05-24  3:32   ` Ben Dooks
  1 sibling, 1 reply; 6+ messages in thread
From: Pinkava J. @ 2010-05-23 12:34 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 23.5.2010 11:19, Sergei Shtylyov napsal(a):
> Hello.
> 
> Pinkava J. wrote:
> 
>> When saving GPIOs during suspend/resume we need skip missing GPIO banks, not
>> trying get corresponding chip again and again in infinite loop.
> 
>     I didn't see any infinite loops there -- *continue* itself leads to 
> incrementing 'gpio_nr', no?

No, it would have to be:

for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) {
...

try create simple test program for your self

/* test.c */
main()
{
	int x;
	for(x = 0; x < 10; /* x++ */ )
	{
		printf("x  = %d", x);
	}
}

Compile usign:

gcc test.c

Run

./a.out

> 
>> Signed-off-by: Jiri Pinkava <jiri.pinkava@vscht.cz>
>> ---
>>  arch/arm/plat-samsung/pm-gpio.c |    8 ++++++--
>>  1 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
>> index d50ab9d..7df03f8 100644
>> --- a/arch/arm/plat-samsung/pm-gpio.c
>> +++ b/arch/arm/plat-samsung/pm-gpio.c
>> @@ -331,8 +331,10 @@ void s3c_pm_save_gpios(void)
>>
>>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
>> -		if (!ourchip)
>> +		if (!ourchip) {
>> +			gpio_nr++;
>>  			continue;
>> +		}
>>
>>  		s3c_pm_save_gpio(ourchip);
>>
>> @@ -369,8 +371,10 @@ void s3c_pm_restore_gpios(void)
>>
>>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
>> -		if (!ourchip)
>> +		if (!ourchip) {
>> +			gpio_nr++;
>>  			continue;
>> +		}
>>
>>  		s3c_pm_resume_gpio(ourchip);
> 
> WBR, Sergei

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

* [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present
  2010-05-23  4:42 [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present Pinkava J.
  2010-05-23  9:19 ` Sergei Shtylyov
@ 2010-05-23 13:18 ` Pinkava J.
  1 sibling, 0 replies; 6+ messages in thread
From: Pinkava J. @ 2010-05-23 13:18 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 23.5.2010 06:42, Pinkava J. napsal(a):
> When saving GPIOs during suspend/resume we need skip missing GPIO banks, not
> trying get corresponding chip again and again in infinite loop.
> 
> Signed-off-by: Jiri Pinkava <jiri.pinkava@vscht.cz>
> ---
>  arch/arm/plat-samsung/pm-gpio.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
> index d50ab9d..7df03f8 100644
> --- a/arch/arm/plat-samsung/pm-gpio.c
> +++ b/arch/arm/plat-samsung/pm-gpio.c
> @@ -331,8 +331,10 @@ void s3c_pm_save_gpios(void)
> 
>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
Note that there is in for-linus/samsung4 working version usign

 	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) {

but into linus kernel was introduced a bug by last commit.

>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
> -		if (!ourchip)
> +		if (!ourchip) {
> +			gpio_nr++;
>  			continue;
> +		}
> 
>  		s3c_pm_save_gpio(ourchip);
> 
> @@ -369,8 +371,10 @@ void s3c_pm_restore_gpios(void)
> 
>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
> -		if (!ourchip)
> +		if (!ourchip) {
> +			gpio_nr++;
>  			continue;
> +		}
> 
>  		s3c_pm_resume_gpio(ourchip);
> 

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

* [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present
  2010-05-23  9:19 ` Sergei Shtylyov
  2010-05-23 12:34   ` Pinkava J.
@ 2010-05-24  3:32   ` Ben Dooks
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Dooks @ 2010-05-24  3:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, May 23, 2010 at 01:19:07PM +0400, Sergei Shtylyov wrote:
> Hello.
>
> Pinkava J. wrote:
>
>> When saving GPIOs during suspend/resume we need skip missing GPIO banks, not
>> trying get corresponding chip again and again in infinite loop.
>
>    I didn't see any infinite loops there -- *continue* itself leads to  
> incrementing 'gpio_nr', no?

no, I made a bit of a mess playing with this patch, so this should fix
it (now applied).

Really I could do with a list of all registered s3c_gpio_chips to allow
for a more efficient implementation, but it is a bit late for that for
this merge window.

>> Signed-off-by: Jiri Pinkava <jiri.pinkava@vscht.cz>
>> ---
>>  arch/arm/plat-samsung/pm-gpio.c |    8 ++++++--
>>  1 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
>> index d50ab9d..7df03f8 100644
>> --- a/arch/arm/plat-samsung/pm-gpio.c
>> +++ b/arch/arm/plat-samsung/pm-gpio.c
>> @@ -331,8 +331,10 @@ void s3c_pm_save_gpios(void)
>>
>>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
>> -		if (!ourchip)
>> +		if (!ourchip) {
>> +			gpio_nr++;
>>  			continue;
>> +		}
>>
>>  		s3c_pm_save_gpio(ourchip);
>>
>> @@ -369,8 +371,10 @@ void s3c_pm_restore_gpios(void)
>>
>>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
>> -		if (!ourchip)
>> +		if (!ourchip) {
>> +			gpio_nr++;
>>  			continue;
>> +		}
>>
>>  		s3c_pm_resume_gpio(ourchip);
>
> WBR, Sergei
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

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

* [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present
  2010-05-23 12:34   ` Pinkava J.
@ 2010-05-24  7:57     ` Sergei Shtylyov
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2010-05-24  7:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

Pinkava J. wrote:

>>> When saving GPIOs during suspend/resume we need skip missing GPIO banks, not
>>> trying get corresponding chip again and again in infinite loop.
>>     I didn't see any infinite loops there -- *continue* itself leads to 
>> incrementing 'gpio_nr', no?

> No, it would have to be:

> for (gpio_nr = 0; gpio_nr < S3C_GPIO_END; gpio_nr++) {
> ...

> try create simple test program for your self

> /* test.c */
> main()
> {
> 	int x;
> 	for(x = 0; x < 10; /* x++ */ )
> 	{
> 		printf("x  = %d", x);
> 	}
> }

> Compile usign:

> gcc test.c

> Run

 > ./a.out

    Ah, I missed the empty 3rd expression in *for*, sorry. :-<
Strange loop though...

>>> Signed-off-by: Jiri Pinkava <jiri.pinkava@vscht.cz>
>>> ---
>>>  arch/arm/plat-samsung/pm-gpio.c |    8 ++++++--
>>>  1 files changed, 6 insertions(+), 2 deletions(-)

>>> diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
>>> index d50ab9d..7df03f8 100644
>>> --- a/arch/arm/plat-samsung/pm-gpio.c
>>> +++ b/arch/arm/plat-samsung/pm-gpio.c
>>> @@ -331,8 +331,10 @@ void s3c_pm_save_gpios(void)
>>>
>>>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>>>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
>>> -		if (!ourchip)
>>> +		if (!ourchip) {
>>> +			gpio_nr++;
>>>  			continue;
>>> +		}
>>>
>>>  		s3c_pm_save_gpio(ourchip);
>>>
>>> @@ -369,8 +371,10 @@ void s3c_pm_restore_gpios(void)
>>>
>>>  	for (gpio_nr = 0; gpio_nr < S3C_GPIO_END;) {
>>>  		ourchip = s3c_gpiolib_getchip(gpio_nr);
>>> -		if (!ourchip)
>>> +		if (!ourchip) {
>>> +			gpio_nr++;
>>>  			continue;
>>> +		}
>>>
>>>  		s3c_pm_resume_gpio(ourchip);

WBR, Sergei

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

end of thread, other threads:[~2010-05-24  7:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-23  4:42 [PATCH] s3c24xx fix: freeze during suspend/resume on s3c24xx if some GPIO banks not present Pinkava J.
2010-05-23  9:19 ` Sergei Shtylyov
2010-05-23 12:34   ` Pinkava J.
2010-05-24  7:57     ` Sergei Shtylyov
2010-05-24  3:32   ` Ben Dooks
2010-05-23 13:18 ` Pinkava J.

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).