Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp929870ybh; Wed, 22 Jul 2020 17:36:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoIodEimIl8PCrgENiCnuxBIFpuysOWKJ//cOlI+FD4KZ41Z5Uvjy/FctQcS/Qpp02nBn+ X-Received: by 2002:a17:906:7253:: with SMTP id n19mr2060572ejk.387.1595464608523; Wed, 22 Jul 2020 17:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595464608; cv=none; d=google.com; s=arc-20160816; b=tRtpjTWu0KHw4R/H8EkNom1avOP+VO5EmaAHgSwJyWcPQdhsJaP0Dd7z1jh8grIzNF sMMJJZ6ZEPFek8HYFz6YO03Q5lS3KX8kkUFWBLxR21FDd6e8MI2Iy+XrAl7ndN4NuAOY C3mCdVP6tzOrtEfOLLnvS8ZP3sSLCnn0RBDh3u9S2o1K31MwXH8XP/5Sme0hNS5nAsNG 2xKdExdxVF5FRmgoyB7lUkEqAelcCjudpZxMMdgjtaqWtWqN6wbg22VdsmD676W2/VsY 94E9YsBxuDg8zIZ6lPjFhJXE0aWI4MJaaJrqx9La+Xox6Tg78G3vcI65GYQQobzvKaio sWVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=11yEVRUyzPgWt3W5uH08AOHBVyAC9OX+1pbB1UCEey8=; b=tAfp56majrxBsmsAE7zMbJF4Lmg7xGYhi4WnYIh71QWBRPDj9DH6ViLeOgKE/n/rdG /ADbjhxqRQzP4qxlKBjWAmqZI4cW4MUBtbqBEQViAl5K11Svu3hBLrZhY3b+jYd2DuY9 kNxGbNRbCfwjES4fPg8KM0RuvxzMsS6XSsWV/QVP9WH3UIkutIRn4Izwx1SL0X4ohEMe 0ZPjwL5pAzx8jiSYDS15SgPwBief1SK9JHpSlUIxyzqrvEkHzawE4gul3uGyvN/e7QIs Z8NjwLEHU8sU75tvWaELW9LJVZRl/nqSajqXshGate9YNaSlV8vpY0Fj6ebf2aDb6u9S KUpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h16si1006996ejx.446.2020.07.22.17.36.25; Wed, 22 Jul 2020 17:36:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733196AbgGWAeJ (ORCPT + 99 others); Wed, 22 Jul 2020 20:34:09 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:60762 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726685AbgGWAeI (ORCPT ); Wed, 22 Jul 2020 20:34:08 -0400 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 CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Andy Shevchenko , Maxime Ripard , Will Deacon , Russell King , , , 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; } -- 2.26.2