Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3563393imm; Sun, 29 Jul 2018 22:34:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcsicnXG//KlGYbv/8cu3Bav82ucde1VORZUhmPulhHFFJQmQDegAZonQFhJl88MQo04441 X-Received: by 2002:a63:f414:: with SMTP id g20-v6mr14985113pgi.407.1532928894163; Sun, 29 Jul 2018 22:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532928894; cv=none; d=google.com; s=arc-20160816; b=lbKY5+eW/s1AxPGxioA2qA1PjNPVmua0b7Xl/7Mvc4lTk0qTTy2fhTSffKfs0depXQ V7AL9DwdwguRgh8dVA4hiTs3ETo2HdN+e4k/4FQs3yeYElta25r8NcSxiYwvkTggkUFp HI5BD+joEsHgTmRqoUt16Q3B5pyeJsUyvt8ILVcrECCCx5vp07fF7ENVi4/ufMAemyVh 2tAfWdXGlO67qFQ3zBZ6+j8sEpCBUTTVRaQEVS0AMDTMhgRv4SNWXcQodacVZ3OmdCDl Sme2uI1ErwH1YLZh/cVtzD16lYUzWirhIKBHASThIs57n+NHSmQrT1ynyM0AUwrWkok2 MKxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=TyOklSiMhxDuO0ZM6qM/nf/oBcN3ZzaC8D5hjuLRMcw=; b=NVUFzXYEmVBYd91t4tpbSoevuwkXCnXFWIEizWtSa9B7OrMviJBYr0/uR+MbJnHozq 2MLs2FOD5gi4WsN+3B3ALKsXXVpxcuQPLR/OMfWQ3q3bgWZfvHV2IpY8/oKCLTA9gmnn HS4lvA2Wv6iNqo6VSgJIsYTCgZ5nWfEnmuAlibUCUaOWuggMGqMu7/Mz7TfdA/sSJJn5 aAtUE+zYIugAZoIQCD9BLVCAYPdveDFOihxrlC0SrKfs/JI5JL8xmcMVoOvbBh4fn1qI PQp48DQ98pPRF0f234c8BnsCrqUuZHZ9ezHdjl9WlhbOJ5EA3jV4msBPqF9XOg+oWb6Y oNBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17-v6si9783296pge.99.2018.07.29.22.34.39; Sun, 29 Jul 2018 22:34:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726393AbeG3HHJ (ORCPT + 99 others); Mon, 30 Jul 2018 03:07:09 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33398 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbeG3HHI (ORCPT ); Mon, 30 Jul 2018 03:07:08 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 51E1F1684; Sun, 29 Jul 2018 22:33:53 -0700 (PDT) Received: from mail-it0-f46.google.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 30FA63FB21; Sun, 29 Jul 2018 22:33:53 -0700 (PDT) Received: by mail-it0-f46.google.com with SMTP id g141-v6so15184368ita.4; Sun, 29 Jul 2018 22:33:53 -0700 (PDT) X-Gm-Message-State: AOUpUlGb6yCLv7b1wjP7qFPWuCW/++xWGpEyoRX2NlhhVoxEF5YCIJ5w LO0otDABTkDToOVMifz/xA9l1Qj0r/4m3L9h+DA= X-Received: by 2002:a24:9686:: with SMTP id z128-v6mr12220073itd.58.1532928832346; Sun, 29 Jul 2018 22:33:52 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:88b8:0:0:0:0:0 with HTTP; Sun, 29 Jul 2018 22:33:51 -0700 (PDT) In-Reply-To: <153270946725.48062.11195853363758024681@swboyd.mtv.corp.google.com> References: <1532700112-11852-1-git-send-email-amit.kachhap@arm.com> <153270946725.48062.11195853363758024681@swboyd.mtv.corp.google.com> From: Amit Daniel Kachhap Date: Mon, 30 Jul 2018 11:03:51 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] clk: scmi: Fix the rounding of clock rate To: Stephen Boyd Cc: LAK , Sudeep Holla , Michael Turquette , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Jul 27, 2018 at 10:07 PM, Stephen Boyd wrote: > Quoting Amit Daniel Kachhap (2018-07-27 07:01:52) >> This fix rounds the clock rate properly by using quotient and not >> remainder in the calculation. This issue was found while testing HDMI >> in the Juno platform. >> >> Signed-off-by: Amit Daniel Kachhap > > Any Fixes: tag here? Yes, This patch is tested with Linux v4.18-rc6 tag. > >> --- >> drivers/clk/clk-scmi.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c >> index bb2a6f2..a985bf5 100644 >> --- a/drivers/clk/clk-scmi.c >> +++ b/drivers/clk/clk-scmi.c >> @@ -60,9 +59,9 @@ static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate, >> >> ftmp = rate - fmin; >> ftmp += clk->info->range.step_size - 1; /* to round up */ >> - step = do_div(ftmp, clk->info->range.step_size); >> + do_div(ftmp, clk->info->range.step_size); >> >> - return step * clk->info->range.step_size + fmin; >> + return ftmp * clk->info->range.step_size + fmin; > > Good catch. Thanks. > Regards, Amit