Re: [PATCH 11/15] serial: mxs-auart: Use clk_prepare_enable/clk_disable_unprepare

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 25, 2012 at 08:14:52PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> 
> Prepare the clock before enabling it.
> 
> Cc: Alan Cox <alan@xxxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: <linux-serial@xxxxxxxxxxxxxxx>
> Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> ---
>  drivers/tty/serial/mxs-auart.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
> index ec56d83..c109642 100644
> --- a/drivers/tty/serial/mxs-auart.c
> +++ b/drivers/tty/serial/mxs-auart.c
> @@ -552,7 +552,7 @@ auart_console_write(struct console *co, const char *str, unsigned int count)
>  	s = auart_port[co->index];
>  	port = &s->port;
>  
> -	clk_enable(s->clk);
> +	clk_prepare_enable(s->clk);
>  
>  	/* First save the CR then disable the interrupts */
>  	old_ctrl2 = readl(port->membase + AUART_CTRL2);
> @@ -578,7 +578,7 @@ auart_console_write(struct console *co, const char *str, unsigned int count)
>  	writel(old_ctrl0, port->membase + AUART_CTRL0);
>  	writel(old_ctrl2, port->membase + AUART_CTRL2);
>  
> -	clk_disable(s->clk);
> +	clk_disable_unprepare(s->clk);
>  }
>  
>  static void __init
> -- 
> 1.7.1
> 
No, clk_prepare() should not be called in auart_console_write() which
is an atomic context.  However it reminds me that auart_console_setup()
needs a fix as below.

Regards,
Shawn

--8<---

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index ec56d83..a3bb06b 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -638,18 +638,16 @@ auart_console_setup(struct console *co, char *options)
        if (!s)
                return -ENODEV;

-       clk_prepare_enable(s->clk);
+       clk_prepare(s->clk);
+       if (ret)
+               return ret;

        if (options)
                uart_parse_options(options, &baud, &parity, &bits, &flow);
        else
                auart_console_get_options(&s->port, &baud, &parity, &bits);

-       ret = uart_set_options(&s->port, co, baud, parity, bits, flow);
-
-       clk_disable_unprepare(s->clk);
-
-       return ret;
+       return uart_set_options(&s->port, co, baud, parity, bits, flow);
 }

 static struct console auart_console = {


--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux