Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp972515ybl; Sun, 1 Dec 2019 17:19:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxwqWUEquniWUdhOzATCW4C73kZYgJRdZTm936py6JNNaAfLp6yV8B2ZXf9dg8UFbsf/pg/ X-Received: by 2002:a50:f38e:: with SMTP id g14mr9613521edm.168.1575249582893; Sun, 01 Dec 2019 17:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575249582; cv=none; d=google.com; s=arc-20160816; b=dCwzKuJ1dcmtS/XpbVD1ysVvdo/2Th38s3C+GxEBZuj5suS7Lhp4bY9YdxvyPIjvrV xsGGI3MrS+oO938i/oLAmDNRPheWh1O+uQ33vBRLvkcMYyhFyJMX+51zz9U6mA8jKf7g 1dEcQToKyz/xYp2wSLB9u9U5hShV9YD9hHzYr7cXznjzJ8HvS+M4/shDu4JVCtPHlE9L zKZfkkL8euJkbrC+APDml/v8fKSg59kypcLaSUQed7d8R0+uf847vqUJAmrTlkvHAGnL DDdUWgqR+zP6TioUae9iN9sNI1oYkayzSdJZzf96kqs5tVn1me0l/k6gI+4dFjYhfzlT iXEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hWZ6hux5DKRuoxCpg8ae+d2EVd3Sv9uHyued2lP5mxc=; b=HfkN/Ys9E1D26o3jBkU9mEAtCHLJEKItDuZSiUQlXxJ7KqbBI23JaTp62Rufx4Fu5O I09MdndePDHlggxmJt+k0PexDKX7QaWJh4ZN/ZfJ4IrIFnGI5TbNxfmcKs1owLWoij0I B5DjF9rjVzSyM88qzpE/LBn26IPql964N3cwtQx9ahvYh/bC3rdLJKop7mAwknoD0AWl 9KAHwUIAg96/JYnY2lWIYxUy/zCrY44BeGRumRtCWUCBnALUfA4i46FnTjQJu7+qHPoi +AywJTddSsEF5IRCJMtgeN65nZAI8I22FHEp/QM54cQ5TsSGMX/sHXePppMM3YylcH/l KH7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dBh24tZK; 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 a14si20013478edn.303.2019.12.01.17.19.06; Sun, 01 Dec 2019 17:19:42 -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; dkim=pass header.i=@kernel.org header.s=default header.b=dBh24tZK; 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 S1727313AbfLBBRs (ORCPT + 99 others); Sun, 1 Dec 2019 20:17:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:43834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727266AbfLBBRs (ORCPT ); Sun, 1 Dec 2019 20:17:48 -0500 Received: from dragon (li2093-158.members.linode.com [172.105.159.158]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5F972146E; Mon, 2 Dec 2019 01:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575249467; bh=r++ufhdV5NVlSi05PmMJPmTLWPGMRkuNwvrCIPM7vWw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dBh24tZKD/7zjoNqX/NGFOhKLsn/+CaaH6xJ3LPngO06Ux87Flqd/FQZcn/gD86TC PXD0O7Ra/Us4zbtu5wLWVxbed0ogucnybU2uYKmfnrm2+MhEXa2aLS8IBync2gsJdP Jo+cRbi2jWVEXggGXxMViRUsGUUwX3ebLPAmux4k= Date: Mon, 2 Dec 2019 09:17:24 +0800 From: Shawn Guo To: Peng Fan Cc: "mturquette@baylibre.com" , "sboyd@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , Abel Vesa , "kernel@pengutronix.de" , dl-linux-imx , Anson Huang , Jacky Bai , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Leonard Crestez Subject: Re: [PATCH 1/7] clk: imx: clk-pll14xx: Switch to clk_hw based API Message-ID: <20191202011721.GA17574@dragon> References: <1572356175-24950-1-git-send-email-peng.fan@nxp.com> <1572356175-24950-2-git-send-email-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1572356175-24950-2-git-send-email-peng.fan@nxp.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 29, 2019 at 01:40:54PM +0000, Peng Fan wrote: > From: Peng Fan > > Switch the imx_clk_pll14xx function to clk_hw based API, rename > accordingly and add a macro for clk based legacy. This allows us to > move closer to a clear split between consumer and provider clk APIs. > > Signed-off-by: Peng Fan > --- > drivers/clk/imx/clk-pll14xx.c | 22 +++++++++++++--------- > drivers/clk/imx/clk.h | 8 ++++++-- > 2 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c > index 5c458199060a..fa76e04251c4 100644 > --- a/drivers/clk/imx/clk-pll14xx.c > +++ b/drivers/clk/imx/clk-pll14xx.c > @@ -369,13 +369,14 @@ static const struct clk_ops clk_pll1443x_ops = { > .set_rate = clk_pll1443x_set_rate, > }; > > -struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, > - void __iomem *base, > - const struct imx_pll14xx_clk *pll_clk) > +struct clk_hw *imx_clk_hw_pll14xx(const char *name, const char *parent_name, > + void __iomem *base, > + const struct imx_pll14xx_clk *pll_clk) > { > struct clk_pll14xx *pll; > - struct clk *clk; > + struct clk_hw *hw; > struct clk_init_data init; > + int ret; > u32 val; > > pll = kzalloc(sizeof(*pll), GFP_KERNEL); > @@ -412,12 +413,15 @@ struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, > val &= ~BYPASS_MASK; > writel_relaxed(val, pll->base + GNRL_CTL); > > - clk = clk_register(NULL, &pll->hw); > - if (IS_ERR(clk)) { > - pr_err("%s: failed to register pll %s %lu\n", > - __func__, name, PTR_ERR(clk)); > + hw = &pll->hw; > + > + ret = clk_hw_register(NULL, hw); > + if (ret) { > + pr_err("%s: failed to register pll %s %d\n", > + __func__, name, ret); > kfree(pll); > + return ERR_PTR(ret); > } > > - return clk; > + return hw; > } > diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h > index bc5bb6ac8636..5038622f1a72 100644 > --- a/drivers/clk/imx/clk.h > +++ b/drivers/clk/imx/clk.h > @@ -97,8 +97,12 @@ extern struct imx_pll14xx_clk imx_1443x_pll; > #define imx_clk_mux(name, reg, shift, width, parents, num_parents) \ > imx_clk_hw_mux(name, reg, shift, width, parents, num_parents)->clk > > -struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, > - void __iomem *base, const struct imx_pll14xx_clk *pll_clk); > +#define imx_clk_pll14xx(name, parent_name, base, pll_clk) \ > + imx_clk_hw_pll14xx(name, parent_name, base, pll_clk)->clk > + I would suggest to use an inline function for this, which will be more readable and complying to kernel coding style. Shawn > +struct clk_hw *imx_clk_hw_pll14xx(const char *name, const char *parent_name, > + void __iomem *base, > + const struct imx_pll14xx_clk *pll_clk); > > struct clk *imx_clk_pllv1(enum imx_pllv1_type type, const char *name, > const char *parent, void __iomem *base); > -- > 2.16.4 >