public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH PM-20081106] OMAP: PM: Few fixes to uart clock handling
@ 2008-11-19  9:54 Jouni Hogander
  2008-11-19 17:54 ` Kevin Hilman
  2008-11-19 19:41 ` Kevin Hilman
  0 siblings, 2 replies; 3+ messages in thread
From: Jouni Hogander @ 2008-11-19  9:54 UTC (permalink / raw)
  To: linux-omap

Omap3_can_sleep is not inside part of idle loop which is protected
with irg disable. If some irq handler is trying dump out something
after omap3_can_sleep and before irqs are disabled. It causes oops
because uart clocks are disabled.

Remove also some unused extra code from omap_uart_can_sleep

Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
---
 arch/arm/mach-omap2/serial.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index ef30d8d..b06b797 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -314,21 +314,13 @@ void omap_uart_check_wakeup(void)
 int omap_uart_can_sleep(void)
 {
 	struct omap_uart_state *uart;
-	int can_sleep = 1;
 
 	list_for_each_entry(uart, &uart_list, node) {
-		if (!uart->clocked)
+		if (!uart->clocked || !uart->can_sleep)
 			continue;
 
-		if (!uart->can_sleep) {
-			can_sleep = 0;
-			continue;
-		}
-
 		/* This UART can now safely sleep. */
 		omap_uart_allow_sleep(uart);
-		if (clocks_off_while_idle)
-			omap_uart_disable_clocks(uart);
 	}
 
 	return 1;
@@ -435,7 +427,6 @@ static void omap_uart_pm(struct uart_port *port,
 		break;
 	case 3: /* suspend */
 		omap_uart_allow_sleep(uart);
-		omap_uart_disable_clocks(uart);
 		break;
 	}
 }
-- 
1.6.0.1


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

* Re: [PATCH PM-20081106] OMAP: PM: Few fixes to uart clock handling
  2008-11-19  9:54 [PATCH PM-20081106] OMAP: PM: Few fixes to uart clock handling Jouni Hogander
@ 2008-11-19 17:54 ` Kevin Hilman
  2008-11-19 19:41 ` Kevin Hilman
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Hilman @ 2008-11-19 17:54 UTC (permalink / raw)
  To: Jouni Hogander; +Cc: linux-omap

Jouni Hogander <jouni.hogander@nokia.com> writes:

> Omap3_can_sleep is not inside part of idle loop which is protected
> with irg disable. If some irq handler is trying dump out something
> after omap3_can_sleep and before irqs are disabled. It causes oops
> because uart clocks are disabled.
>
> Remove also some unused extra code from omap_uart_can_sleep
>
> Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
> ---
>  arch/arm/mach-omap2/serial.c |   11 +----------
>  1 files changed, 1 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
> index ef30d8d..b06b797 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -314,21 +314,13 @@ void omap_uart_check_wakeup(void)
>  int omap_uart_can_sleep(void)
>  {
>  	struct omap_uart_state *uart;
> -	int can_sleep = 1;
>  
>  	list_for_each_entry(uart, &uart_list, node) {
> -		if (!uart->clocked)
> +		if (!uart->clocked || !uart->can_sleep)
>  			continue;
>  
> -		if (!uart->can_sleep) {
> -			can_sleep = 0;
> -			continue;
> -		}
> -

I don't think this part is quite right.  I think this block should
stay, and the function should 'return can_sleep' instead of return 1;

I'll fix that, and incorporate your other changes here into
pm-20081118.

Kevin

>  		/* This UART can now safely sleep. */
>  		omap_uart_allow_sleep(uart);
> -		if (clocks_off_while_idle)
> -			omap_uart_disable_clocks(uart);
>  	}
>  
>  	return 1;
> @@ -435,7 +427,6 @@ static void omap_uart_pm(struct uart_port *port,
>  		break;
>  	case 3: /* suspend */
>  		omap_uart_allow_sleep(uart);
> -		omap_uart_disable_clocks(uart);
>  		break;
>  	}
>  }
> -- 
> 1.6.0.1
>
> --
> 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] 3+ messages in thread

* Re: [PATCH PM-20081106] OMAP: PM: Few fixes to uart clock handling
  2008-11-19  9:54 [PATCH PM-20081106] OMAP: PM: Few fixes to uart clock handling Jouni Hogander
  2008-11-19 17:54 ` Kevin Hilman
@ 2008-11-19 19:41 ` Kevin Hilman
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Hilman @ 2008-11-19 19:41 UTC (permalink / raw)
  To: Jouni Hogander; +Cc: linux-omap

Jouni Hogander <jouni.hogander@nokia.com> writes:

> Omap3_can_sleep is not inside part of idle loop which is protected
> with irg disable. If some irq handler is trying dump out something
> after omap3_can_sleep and before irqs are disabled. It causes oops
> because uart clocks are disabled.
>
> Remove also some unused extra code from omap_uart_can_sleep
>
> Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
> ---
>  arch/arm/mach-omap2/serial.c |   11 +----------
>  1 files changed, 1 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
> index ef30d8d..b06b797 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -314,21 +314,13 @@ void omap_uart_check_wakeup(void)
>  int omap_uart_can_sleep(void)
>  {
>  	struct omap_uart_state *uart;
> -	int can_sleep = 1;
>  
>  	list_for_each_entry(uart, &uart_list, node) {
> -		if (!uart->clocked)
> +		if (!uart->clocked || !uart->can_sleep)
>  			continue;
>  
> -		if (!uart->can_sleep) {
> -			can_sleep = 0;
> -			continue;
> -		}
> -
>  		/* This UART can now safely sleep. */
>  		omap_uart_allow_sleep(uart);
> -		if (clocks_off_while_idle)
> -			omap_uart_disable_clocks(uart);

If we remove this disable, then the fclks will have to be masked/ignored
in omap3_fclks_active() too.  This is what I was trying to avoid.

However, based on the potential race with ISRs you described, I think
this is the best option.

Kevin

>  	}
>  
>  	return 1;
> @@ -435,7 +427,6 @@ static void omap_uart_pm(struct uart_port *port,
>  		break;
>  	case 3: /* suspend */
>  		omap_uart_allow_sleep(uart);
> -		omap_uart_disable_clocks(uart);
>  		break;
>  	}
>  }
> -- 
> 1.6.0.1
>
> --
> 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] 3+ messages in thread

end of thread, other threads:[~2008-11-19 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-19  9:54 [PATCH PM-20081106] OMAP: PM: Few fixes to uart clock handling Jouni Hogander
2008-11-19 17:54 ` Kevin Hilman
2008-11-19 19:41 ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox