Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6891032ybe; Wed, 18 Sep 2019 10:42:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+vaXFjA2b0d3kHZruTXHEeVoYwBxSNisu/h6zKITBd8ixDOM9GNtC3iafM5A6VAe/X3z2 X-Received: by 2002:a17:906:6848:: with SMTP id a8mr10868450ejs.104.1568828552382; Wed, 18 Sep 2019 10:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568828552; cv=none; d=google.com; s=arc-20160816; b=QKtATq+1bNr7W8sg9i8o7AIuPGgxrBQmbNdb234ctU+6152m3mH7UIUkvEsVeUhFZU w5gcPNsqVfGbtEMRfJkfCEkVCa/T0hXuPuKnPqM6vQ5F1I6sbRxRw19BilBWn/XlchKO oxqDAFF3DXagMbOrIuzsjphHgk+7xhnHHzYbqMBdJIIoKb641IvErBQVgTqtir7ogYUw hC36EZRazWejNFZknqcBafr+lqOsugXf1Z3MNpQT+b8JtpNN9/vKpnkuKcmNfxRXAvIr jaGO43GB3Y5IVtu8z0IQ/ImnGxyv77sGgwlM4Czj6VBcBNOSuZFCiNkbl1ToQwIIl/5G QVrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:subject:from :to:cc:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=Y6VCTkzpc4YvUZOchLNCD5fkrGmeF/aU2IFgzXLzSX0=; b=HXRexWnz43sY836ltkp+JUZ7ibny4SJbvj7URe4OkXw/i/qwc2n7PlHgyGCaIPfgfl 9cvcRjv/VjfyMkLMd3JHvVxJZMhBo0Ci4r9AHEoQaucTPfvczDUYB4aulTEEi+8bNc4w Tgdgr2rS05hP7SuGFJMy0YHJ7LYRfKny3m/MrWObKLMuejDgVcnOmE0Ywv+C365JJf+j U82rBK9MJVErteWF/SGaMmrPqM19Yg6BomU0It/fJMElXB6QKmKERptW2y3lQgc7wizR YfxwIVPCnnBR5gtOCG1c/v0UTVWRrJWrNaVZaEFhxC/jRt3vRugRCf4NzB40s6EfFZb2 SYxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1PMW3AoO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4si3709714edy.388.2019.09.18.10.42.08; Wed, 18 Sep 2019 10:42:32 -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; dkim=pass header.i=@kernel.org header.s=default header.b=1PMW3AoO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730650AbfIRRAx (ORCPT + 99 others); Wed, 18 Sep 2019 13:00:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:57974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727821AbfIRRAw (ORCPT ); Wed, 18 Sep 2019 13:00:52 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2AEAF21848; Wed, 18 Sep 2019 17:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568826051; bh=+VV0O6MMtZyWgdqUHiASXwOLRO7jkiwEUpT92RQzt4g=; h=In-Reply-To:References:Cc:To:From:Subject:Date:From; b=1PMW3AoOt/ymX/M1dp08qnsJqv3s/b+YM+GZZMumAjq6O6h/eRnWn0TVcvCuvXQKE GIKROoeOINGme7kF9BlLqLmQZ9g5x2+dkI8RtpxuRROFwu0Wrr+xqeVmy4v3YdzPcZ 2KPRvNqzdwk1QRrlVeSzfqA2zLlNFPqxw2kBVMPk= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20190829105919.44363-1-wen.he_1@nxp.com> <20190829105919.44363-2-wen.he_1@nxp.com> <20190916202637.B5F542067B@mail.kernel.org> Cc: Leo Li , "liviu.dudau@arm.com" To: "devicetree@vger.kernel.org" , "linux-clk@vger.kernel.org" , "linux-devel@linux.nxdi.nxp.com" , "linux-kernel@vger.kernel.org" , Mark Rutland , Michael Turquette , Rob Herring , Wen He From: Stephen Boyd Subject: RE: [EXT] Re: [v4 2/2] clk: ls1028a: Add clock driver for Display output interface User-Agent: alot/0.8.1 Date: Wed, 18 Sep 2019 10:00:50 -0700 Message-Id: <20190918170051.2AEAF21848@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Wen He (2019-09-18 02:20:26) > > -----Original Message----- > > From: Stephen Boyd > > Quoting Wen He (2019-08-29 03:59:19) > > > diff --git a/drivers/clk/clk-plldig.c b/drivers/clk/clk-plldig.c new > > > file mode 100644 index 000000000000..d3239bcf59de > > > --- /dev/null > > > +++ b/drivers/clk/clk-plldig.c > > > @@ -0,0 +1,298 @@ [...] >=20 > >=20 > > > + > > > +/* Maximum of the divider */ > > > +#define MAX_RFDPHI1 63 > > > + > > > +/* Best value of multiplication factor divider */ > > > +#define PLLDIG_DEFAULE_MULT 44 > > > + > > > +/* > > > + * Clock configuration relationship between the PHI1 > > > +frequency(fpll_phi) and > > > + * the output frequency of the PLL is determined by the PLLDV, > > > +according to > > > + * the following equation: > > > + * fpll_phi =3D (pll_ref * mfd) / div_rfdphi1 */ struct > > > +plldig_phi1_param { > > > + unsigned long rate; > > > + unsigned int rfdphi1; > > > + unsigned int mfd; > > > +}; > > > + > > > +enum plldig_phi1_freq_range { > > > + PHI1_MIN =3D 27000000U, > > > + PHI1_MAX =3D 600000000U > > > +}; > >=20 > > Please just inline these values in the one place they're used. > >=20 > > > + > > > +struct clk_plldig { > > > + struct clk_hw hw; > > > + void __iomem *regs; > > > + struct device *dev; > >=20 > > Please remove this, it is unused. >=20 > It is used for probe. Use a local variable and don't store it away forever in the struct. > >=20 > > > + > > > + val =3D readl(data->regs + PLLDIG_REG_PLLDV); > > > + val =3D phi1_param.mfd; > > > + rfdphi1 =3D phi1_param.rfdphi1; > > > + val |=3D rfdphi1; > > > + > > > + writel(val, data->regs + PLLDIG_REG_PLLDV); > > > + > > > + /* delay 200us make sure that old lock state is cleared */ > > > + udelay(200); > > > + > > > + /* Wait until PLL is locked or timeout (maximum 1000 usecs) */ > > > + ret =3D readl_poll_timeout_atomic(data->regs + PLLDIG_REG_PLL= SR, > > cond, > > > + cond & PLLDIG_LOCK_MASK, > > 0, > > > + USEC_PER_MSEC); > > > + > > > + return ret; > >=20 > > Just return readl_poll_timeout_atomic(...) here. >=20 > Maybe use below code will to best describes. >=20 > If (ret) > return -ETIMEOUT; >=20 > return 0; No, just return readl_poll_timeout_atomic().