Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933177AbbHISTU (ORCPT ); Sun, 9 Aug 2015 14:19:20 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:33884 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933143AbbHISTQ (ORCPT ); Sun, 9 Aug 2015 14:19:16 -0400 From: Eduardo Valentin To: Greg Kroah-Hartman , Jiri Slaby , Fabio Stevam Cc: Linux PM , Eduardo Valentin , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] serial: imx: remove unbalanced clk_prepare Date: Sun, 9 Aug 2015 11:19:02 -0700 Message-Id: <1439144349-10494-2-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439144349-10494-1-git-send-email-edubezval@gmail.com> References: <1439144349-10494-1-git-send-email-edubezval@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2602 Lines: 82 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 Stevam Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: linux-serial@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin --- 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 54fdc78..b53455d 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1624,12 +1624,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; } @@ -1668,8 +1668,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); } /* @@ -1770,15 +1770,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/