Thread (2 messages) 2 messages, 2 authors, 2012-06-11

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

From: Shawn Guo <hidden>
Date: 2012-06-11 02:15:36
Subsystem: the rest, tty layer and serial drivers · Maintainers: Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

On Fri, May 25, 2012 at 08:14:52PM -0300, Fabio Estevam wrote:
quoted hunk ↗ jump to hunk
From: Fabio Estevam <redacted>

Prepare the clock before enabling it.

Cc: Alan Cox <redacted>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <redacted>
Signed-off-by: Fabio Estevam <redacted>
---
 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 = {

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help