Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp125006ima; Fri, 1 Feb 2019 00:22:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IZmGNn3uSjPoAl3XKwHdeUXWjwSC4iH+5CS+hBx7yyevXdojkz9UbBg7PyvuPZzEWXEPvjk X-Received: by 2002:a63:6984:: with SMTP id e126mr1277097pgc.143.1549009368548; Fri, 01 Feb 2019 00:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549009368; cv=none; d=google.com; s=arc-20160816; b=jxKTT/F8Df/YhKdF5Z6ARiV+5njaNbgUgkJlOsqI4zBUq657qNAvBlBwkdxi3MZmKj vJJM9mXcOd5+UGeaYA0ve1lcB6o2IYLtjV4NVNxua7XvaILFyNmIQr/t9zxfH3dJvdXq Yv2QT3spM1hcFktiIQBvRFu9tD3tOPFxgBuTbDrQwVE/HH5TbQrbCIvdR9KWT6r6H5pb zDcVMauMSznR1ZqgzQhIk/ldQSwtxeGJQ5wxtFKFq5zI6A0fnD43zAVSUiJVPXJAKR80 yHoWcDKXNyu+3jeqS4cVLsf+/SA6m0XZXqm3wQ3TCitTmkrypZMenzH9Mnk4sZwuI49H iVBA== 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:date:cc:to:from:subject:message-id; bh=2syy7CB19BISsjdCLE0F1dZM85PCf6Fq6bIZb9l5gkI=; b=JC6siWWSZTmHsTpevX+0HBtajh95Zw+1lNPC+hlJizZgFGm/STMag/aUd75onTN5uc 1aQ2h6FqUxikgkjfY/2QzHfQndDkbb9qo9O5cGGQswwJ4+GnDezfa3jX9MUH5DWrcUOs 0yh0J7o7AnsKyKbnhmVeevRm0GNCmuehJW2cRrg1EPilYzsqkTh9U21OXH8ZpDlEvpwq pgrAY65J/eJIPFamVX8wfBBYBWy13i2wT9Re+etZEKgq/vu26Dq9oTI9Fhb07i2lPXWi WSLNWmbwwryZnzEUBO/4kdYBEuAP4K5nNsZQ+wi7KIztXBeNz4Z9HBMGxHXjjfeSCI5b 9udg== 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 g1si7170227pld.197.2019.02.01.00.22.33; Fri, 01 Feb 2019 00:22:48 -0800 (PST) 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 S1728792AbfBAIWU (ORCPT + 99 others); Fri, 1 Feb 2019 03:22:20 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:7537 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726665AbfBAIWU (ORCPT ); Fri, 1 Feb 2019 03:22:20 -0500 X-UUID: 6bdfe649cd45443c85f1fb455085a07e-20190201 X-UUID: 6bdfe649cd45443c85f1fb455085a07e-20190201 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 559663866; Fri, 01 Feb 2019 16:22:14 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs03n1.mediatek.inc (172.21.101.181) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Feb 2019 16:22:13 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Fri, 1 Feb 2019 16:22:13 +0800 Message-ID: <1549009333.22634.2.camel@mtksdaap41> Subject: Re: [PATCH v3 03/12] clk: mediatek: add configurable pcwibits and fmin to mtk_pll_data From: Weiyi Lu To: Stephen Boyd CC: Matthias Brugger , Nicolas Boichat , Rob Herring , Stephen Boyd , James Liao , Fan Chen , , , , , , , Owen Chen Date: Fri, 1 Feb 2019 16:22:13 +0800 In-Reply-To: <154482494548.19322.11090762587126084086@swboyd.mtv.corp.google.com> References: <20181210073240.32278-1-weiyi.lu@mediatek.com> <20181210073240.32278-5-weiyi.lu@mediatek.com> <154482494548.19322.11090762587126084086@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-12-14 at 14:02 -0800, Stephen Boyd wrote: > Quoting Weiyi Lu (2018-12-09 23:32:31) > > diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c > > index f0ff5f535c7e..81400601f107 100644 > > --- a/drivers/clk/mediatek/clk-pll.c > > +++ b/drivers/clk/mediatek/clk-pll.c > > @@ -69,11 +71,13 @@ static unsigned long __mtk_pll_recalc_rate(struct mtk_clk_pll *pll, u32 fin, > > { > > int pcwbits = pll->data->pcwbits; > > int pcwfbits; > > + int ibits; > > u64 vco; > > u8 c = 0; > > > > /* The fractional part of the PLL divider. */ > > - pcwfbits = pcwbits > INTEGER_BITS ? pcwbits - INTEGER_BITS : 0; > > + ibits = pll->data->pcwibits ? pll->data->pcwibits : INTEGER_BITS; > > + pcwfbits = pcwbits > ibits ? pcwbits - ibits : 0; > > This is practically unreadable. It should be changed to an if statement. > OK, will be fixed in next version. > > > > vco = (u64)fin * pcw; > > > > @@ -167,9 +171,10 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw, > > static void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv, > > u32 freq, u32 fin) > > { > > - unsigned long fmin = 1000 * MHZ; > > + unsigned long fmin = pll->data->fmin ? pll->data->fmin : (1000 * MHZ); > > const struct mtk_pll_div_table *div_table = pll->data->div_table; > > u64 _pcw; > > + int ibits; > > u32 val; > > > > if (freq > pll->data->fmax) > > @@ -193,7 +198,8 @@ static void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv, > > } > > > > /* _pcw = freq * postdiv / fin * 2^pcwfbits */ > > - _pcw = ((u64)freq << val) << (pll->data->pcwbits - INTEGER_BITS); > > + ibits = pll->data->pcwibits ? pll->data->pcwibits : INTEGER_BITS; > > + _pcw = ((u64)freq << val) << (pll->data->pcwbits - ibits); > > Similar comment. Readability is low here. I thought these two lines here are clean enough. Just simple conditional assignment and shift operation. I'd like to not to change it. >