From patchwork Thu Jul 23 00:33:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 11679369 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA42E13B6 for ; Thu, 23 Jul 2020 00:35:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 929F520656 for ; Thu, 23 Jul 2020 00:35:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="x9xJaqxu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 929F520656 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NUma5YDaAVVg25aKpiU0ShZPJqYHpd9d6L6sELa4Ab4=; b=x9xJaqxusIV4qF2l0dH+u2XFf YMIUelOEJGNCxRqz4FhhqgmhilPFlx7BA/Yes1r/o7rXyOToDQ15rTuFl++6oAHuMktwrkNl2Hq0M W5bNsGY6o0YEt9svl0ZiYpSG4FnbNDqJV/MV56rYGG4AgCol4NLFOyHltzuZ1KP+1+AvmhMOEsBwA VtKy9RXKWgtEwZzuPlefIvp18K1WWhG+jy1figFEz30ipOyQL57sYGOBBuU9WJ4sXEp/k/bPPbDL0 7u02QJqJH0VbCm8N0bLwYZlAMJhFhPqfPJrNj+G6xOLKp//hxziONtfvkRx+aQTlKwL6MdLWeCRua nMdX+i+vA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyPBe-0003YL-28; Thu, 23 Jul 2020 00:34:14 +0000 Received: from mx.baikalchip.com ([94.125.187.42] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyPBZ-0003W2-2y for linux-arm-kernel@lists.infradead.org; Thu, 23 Jul 2020 00:34:10 +0000 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id D7DB680045E5; Thu, 23 Jul 2020 00:34:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BfoAzdl2_QzI; Thu, 23 Jul 2020 03:34:01 +0300 (MSK) From: Serge Semin To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Subject: [PATCH v9 3/4] serial: 8250_dw: Pass the same rate to the clk round and set rate methods Date: Thu, 23 Jul 2020 03:33:56 +0300 Message-ID: <20200723003357.26897-4-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200723003357.26897-1-Sergey.Semin@baikalelectronics.ru> References: <20200723003357.26897-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200722_203409_386754_04DAF6E6 X-CRM114-Status: UNSURE ( 8.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Russell King , Maxime Ripard , Alexey Malahov , Serge Semin , Andy Shevchenko , Pavel Parkhomenko , linux-serial@vger.kernel.org, Serge Semin , Will Deacon , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Indeed according to the clk API if clk_round_rate() has successfully accepted a rate, then in order setup the clock with value returned by the clk_round_rate() the clk_set_rate() method must be called with the original rate value. Suggested-by: Russell King Signed-off-by: Serge Semin --- Changelog v8: - This is a new patch created by the Russell King suggestion. --- drivers/tty/serial/8250/8250_dw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 12866083731d..c1511f9244bb 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -275,15 +275,15 @@ dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old) static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, struct ktermios *old) { - unsigned int baud = tty_termios_baud_rate(termios); + unsigned long newrate = tty_termios_baud_rate(termios) * 16; struct dw8250_data *d = to_dw8250_data(p->private_data); long rate; int ret; clk_disable_unprepare(d->clk); - rate = clk_round_rate(d->clk, baud * 16); + rate = clk_round_rate(d->clk, newrate); if (rate > 0) { - ret = clk_set_rate(d->clk, rate); + ret = clk_set_rate(d->clk, newrate); if (!ret) p->uartclk = rate; }