aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/amba-pl010.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2012-08-26 12:01:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-05 15:33:39 -0400
commit1c4c4394a6040b7bd2154e848cd9ab536b6ab0dd (patch)
tree644464982ee17d37976a97b51c6c5ff33d26414f /drivers/tty/serial/amba-pl010.c
parente372dc6c62bf0246a07f3291a26c562cc8659fbd (diff)
drivers/tty/serial/amba-pl0{10,11}.c: use clk_prepare_enable and clk_disable_unprepare
Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and clk_enable, and clk_disable and clk_unprepare. The9 make the code more concise, and ensure that clk_unprepare is called when clk_enable fails. A simplified version of the semantic patch that introduces calls to these functions is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression e; @@ - clk_prepare(e); - clk_enable(e); + clk_prepare_enable(e); @@ expression e; @@ - clk_disable(e); - clk_unprepare(e); + clk_disable_unprepare(e); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/amba-pl010.c')
-rw-r--r--drivers/tty/serial/amba-pl010.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c
index 0d91a540bf11..22317dd16474 100644
--- a/drivers/tty/serial/amba-pl010.c
+++ b/drivers/tty/serial/amba-pl010.c
@@ -312,16 +312,12 @@ static int pl010_startup(struct uart_port *port)
312 struct uart_amba_port *uap = (struct uart_amba_port *)port; 312 struct uart_amba_port *uap = (struct uart_amba_port *)port;
313 int retval; 313 int retval;
314 314
315 retval = clk_prepare(uap->clk);
316 if (retval)
317 goto out;
318
319 /* 315 /*
320 * Try to enable the clock producer. 316 * Try to enable the clock producer.
321 */ 317 */
322 retval = clk_enable(uap->clk); 318 retval = clk_prepare_enable(uap->clk);
323 if (retval) 319 if (retval)
324 goto clk_unprep; 320 goto out;
325 321
326 uap->port.uartclk = clk_get_rate(uap->clk); 322 uap->port.uartclk = clk_get_rate(uap->clk);
327 323
@@ -346,9 +342,7 @@ static int pl010_startup(struct uart_port *port)
346 return 0; 342 return 0;
347 343
348 clk_dis: 344 clk_dis:
349 clk_disable(uap->clk); 345 clk_disable_unprepare(uap->clk);
350 clk_unprep:
351 clk_unprepare(uap->clk);
352 out: 346 out:
353 return retval; 347 return retval;
354} 348}
@@ -375,8 +369,7 @@ static void pl010_shutdown(struct uart_port *port)
375 /* 369 /*
376 * Shut down the clock producer 370 * Shut down the clock producer
377 */ 371 */
378 clk_disable(uap->clk); 372 clk_disable_unprepare(uap->clk);
379 clk_unprepare(uap->clk);
380} 373}
381 374
382static void 375static void