Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204680

[PATCHv2 1/8] serial: imx: remove unbalanced clk_prepare

From Eduardo Valentin <edubezval@gmail.com>
Newsgroups linux.kernel
Subject [PATCHv2 1/8] serial: imx: remove unbalanced clk_prepare
Date 2015-08-11 03:40 +0200
Message-ID <pW6HM-75p-19@gated-at.bofh.it> (permalink)
References <pW6HL-75p-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The current code attempts to prepare clk_per and clk_ipg
before using the device. However, the result is an extra
prepare call on each clock. Here is the output of uart
clocks (only uart enabled and used as console):

$  grep uart /sys/kernel/debug/clk/clk_summary
 uart_serial           1            2    80000000          0 0
       uart           1            2    66000000          0 0

This patch balances the calls of prepares. The result is:

$  grep uart /sys/kernel/debug/clk/clk_summary
 uart_serial           1            1    80000000          0 0
       uart           1            1    66000000          0 0

Cc: Fabio Estevam <festevam@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/tty/serial/imx.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 9a248eb..b27c232 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1630,12 +1630,12 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
 	int locked = 1;
 	int retval;
 
-	retval = clk_enable(sport->clk_per);
+	retval = clk_prepare_enable(sport->clk_per);
 	if (retval)
 		return;
-	retval = clk_enable(sport->clk_ipg);
+	retval = clk_prepare_enable(sport->clk_ipg);
 	if (retval) {
-		clk_disable(sport->clk_per);
+		clk_disable_unprepare(sport->clk_per);
 		return;
 	}
 
@@ -1674,8 +1674,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count)
 	if (locked)
 		spin_unlock_irqrestore(&sport->port.lock, flags);
 
-	clk_disable(sport->clk_ipg);
-	clk_disable(sport->clk_per);
+	clk_disable_unprepare(sport->clk_ipg);
+	clk_disable_unprepare(sport->clk_per);
 }
 
 /*
@@ -1776,15 +1776,7 @@ imx_console_setup(struct console *co, char *options)
 
 	retval = uart_set_options(&sport->port, co, baud, parity, bits, flow);
 
-	clk_disable(sport->clk_ipg);
-	if (retval) {
-		clk_unprepare(sport->clk_ipg);
-		goto error_console;
-	}
-
-	retval = clk_prepare(sport->clk_per);
-	if (retval)
-		clk_disable_unprepare(sport->clk_ipg);
+	clk_disable_unprepare(sport->clk_ipg);
 
 error_console:
 	return retval;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/8] serial: imx: rework pm support and add runtime pm Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200
  [PATCHv2 2/8] serial: imx: introduce serial_imx_enable_wakeup() Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200
  [PATCHv2 6/8] serial: imx: add runtime pm support Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200
    Re: [PATCHv2 6/8] serial: imx: add runtime pm support Fabio Estevam <festevam@gmail.com> - 2015-08-11 05:10 +0200
      Re: [PATCHv2 6/8] serial: imx: add runtime pm support Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 19:00 +0200
    Re: [PATCHv2 6/8] serial: imx: add runtime pm support Kevin Hilman <khilman@kernel.org> - 2015-08-12 21:40 +0200
  [PATCHv2 8/8] serial: imx: use SET_*SYSTEM_PM_OPS helper functions Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200
  [PATCHv2 1/8] serial: imx: remove unbalanced clk_prepare Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200
  [PATCHv2 7/8] serial: imx: add pm_qos request Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200
  [PATCHv2 4/8] serial: imx: save and restore context in the suspend path Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200
  [PATCHv2 5/8] serial: imx: add a flag to indicate we are in the suspend path Eduardo Valentin <edubezval@gmail.com> - 2015-08-11 03:40 +0200

csiph-web