From patchwork Tue Aug 11 17:21:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 6993981 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 021B4C05AC for ; Tue, 11 Aug 2015 17:24:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D78E2066B for ; Tue, 11 Aug 2015 17:24:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4354A205B7 for ; Tue, 11 Aug 2015 17:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752854AbbHKRYb (ORCPT ); Tue, 11 Aug 2015 13:24:31 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:33592 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755504AbbHKRVd (ORCPT ); Tue, 11 Aug 2015 13:21:33 -0400 Received: by pabyb7 with SMTP id yb7so134384839pab.0; Tue, 11 Aug 2015 10:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mSRcb0v5VmKwHmfeuGZZd+99LkF0W+Z5fUkOY+5CFl0=; b=LOBsFa8HPDgbZX65L7k6uxodJ/tShwmT06Fxs3G/wL/OL4mf3Du4x3juO2nwxRhLEp MHQaRmBWO1BPly+rvyYxADFja3SyfE7ee1eTKZGs/DtS049eX6+i5PpzsyIdDgOIJnJP 3EAUkeXsg/Srzr+1YJLJkDgNC2jEM2+WTdMOEJ0hCatZMhvp5QhHCTyCtFj1iyYSs3Yz IPs49RmR99U9RGIImNaV4jFHysyHhNuSWoH6NpUuLH0WrpD3yPTiW2l20pHUNv9Fa18c hCJlyPlXk214aeY2REBj2jD8+AgKTJFP5snNAspeBVkTVBJimZZrgdU9d5KkaTPWXqLz ISnA== X-Received: by 10.66.141.109 with SMTP id rn13mr57718027pab.127.1439313693405; Tue, 11 Aug 2015 10:21:33 -0700 (PDT) Received: from localhost (amazon.gigabitethernet4-0-6.asr1.snv2.gblx.net. [64.211.110.86]) by smtp.gmail.com with ESMTPSA id r9sm3358038pds.83.2015.08.11.10.21.32 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 11 Aug 2015 10:21:32 -0700 (PDT) From: Eduardo Valentin To: Greg Kroah-Hartman , Jiri Slaby , Fabio Estevam Cc: Sascha Hauer , Linux PM , linux-serial@vger.kernel.org, LKML , Eduardo Valentin Subject: [PATCHv3 1/8] serial: imx: remove unbalanced clk_prepare Date: Tue, 11 Aug 2015 10:21:20 -0700 Message-Id: <1439313687-28502-2-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439313687-28502-1-git-send-email-edubezval@gmail.com> References: <1439313687-28502-1-git-send-email-edubezval@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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 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;