From patchwork Tue Jul 14 12:48:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 11662817 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 34FF3618 for ; Tue, 14 Jul 2020 12:49:45 +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 0ED042242C for ; Tue, 14 Jul 2020 12:49:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="to9Fd4IY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0ED042242C 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=to9Fd4IYucE18E2I6aaYa8Fx5 EU76kxyap9yIxzzdKmAmRfEX2VuMsou3HocfVj/l4AGHAtHNWkA8F+CAVXLOP143C7n7dWxa4Tb09 PxrsEy+HRC7Sp6gACiOb9izj1yKW5409ucjtuKMfniX77elTjphzktkKLc034h9aC/zn+/UAe8NcM WA5nCZscQWXaTWXH5/89fDliVhWvDZxYm6hugTJlkF7LzcrSp3uAQkcQjQmfK3niHG8XrycHeVj/a PcWSeCcd2MuybZjNd3VFuaVI3YRb92bK6W+LK05uQl24t4RBrdBnV73Yndg81bVjBWkzbXHP/5yr/ fnDwcKk6A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvKMD-0005re-5D; Tue, 14 Jul 2020 12:48:25 +0000 Received: from mx.chip.baikal.ru ([94.125.187.42] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvKM2-0005nb-8Z for linux-arm-kernel@lists.infradead.org; Tue, 14 Jul 2020 12:48:15 +0000 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 894A3803202D; Tue, 14 Jul 2020 12:48:13 +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 QahHFbfq1Bc7; Tue, 14 Jul 2020 15:48:12 +0300 (MSK) From: Serge Semin To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Subject: [PATCH v8 3/4] serial: 8250_dw: Pass the same rate to the clk round and set rate methods Date: Tue, 14 Jul 2020 15:48:06 +0300 Message-ID: <20200714124808.21493-4-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200714124808.21493-1-Sergey.Semin@baikalelectronics.ru> References: <20200714124808.21493-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-20200714_084814_526008_E852DBA3 X-CRM114-Status: UNSURE ( 8.35 ) 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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: Thomas Bogendoerfer , linux-kernel@vger.kernel.org, Russell King , Maxime Ripard , Alexey Malahov , Serge Semin , Pavel Parkhomenko , linux-serial@vger.kernel.org, Serge Semin , linux-mips@vger.kernel.org, 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; }