From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A76BC433F5 for ; Tue, 15 Feb 2022 06:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234554AbiBOGfy (ORCPT ); Tue, 15 Feb 2022 01:35:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234536AbiBOGfw (ORCPT ); Tue, 15 Feb 2022 01:35:52 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DBD4B16C3; Mon, 14 Feb 2022 22:35:42 -0800 (PST) X-UUID: 46f8b5c8592542039d7347a8400efa6a-20220215 X-UUID: 46f8b5c8592542039d7347a8400efa6a-20220215 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1129853463; Tue, 15 Feb 2022 14:35:40 +0800 Received: from mtkexhb02.mediatek.inc (172.21.101.103) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 15 Feb 2022 14:35:39 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkexhb02.mediatek.inc (172.21.101.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 15 Feb 2022 14:35:39 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 15 Feb 2022 14:35:38 +0800 Message-ID: <7795e4f16aec237fb3b43533a369a21dfd0c0548.camel@mediatek.com> Subject: Re: [PATCH v3 15/31] clk: mediatek: Implement mtk_clk_unregister_fixed_clks() API From: Chun-Jie Chen To: Chen-Yu Tsai , Stephen Boyd , Michael Turquette , Matthias Brugger CC: AngeloGioacchino Del Regno , Miles Chen , , , , Date: Tue, 15 Feb 2022 14:35:39 +0800 In-Reply-To: <20220208124034.414635-16-wenst@chromium.org> References: <20220208124034.414635-1-wenst@chromium.org> <20220208124034.414635-16-wenst@chromium.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2022-02-08 at 20:40 +0800, Chen-Yu Tsai wrote: > mtk_clk_register_fixed_clks(), as the name suggests, is used to > register > a given list of fixed rate clks. However it is lacking a counterpart > unregister API. > > Implement said unregister API so that the various clock platform > drivers > can utilize it to do proper unregistration, cleanup and removal. > > In the header file, the register function's declaration is also > reformatted to fit code style guidelines. > > Signed-off-by: Chen-Yu Tsai > Reviewed-by: Miles Chen > Reviewed-by: AngeloGioacchino Del Regno < > angelogioacchino.delregno@collabora.com> Reviewed-by: Chun-Jie Chen > --- > drivers/clk/mediatek/clk-mtk.c | 20 ++++++++++++++++++++ > drivers/clk/mediatek/clk-mtk.h | 6 ++++-- > 2 files changed, 24 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/mediatek/clk-mtk.c > b/drivers/clk/mediatek/clk-mtk.c > index 0c5db3c71fdd..7c0d5706eed7 100644 > --- a/drivers/clk/mediatek/clk-mtk.c > +++ b/drivers/clk/mediatek/clk-mtk.c > @@ -80,6 +80,26 @@ void mtk_clk_register_fixed_clks(const struct > mtk_fixed_clk *clks, > } > EXPORT_SYMBOL_GPL(mtk_clk_register_fixed_clks); > > +void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, > int num, > + struct clk_onecell_data *clk_data) > +{ > + int i; > + > + if (!clk_data) > + return; > + > + for (i = num; i > 0; i--) { > + const struct mtk_fixed_clk *rc = &clks[i - 1]; > + > + if (IS_ERR_OR_NULL(clk_data->clks[rc->id])) > + continue; > + > + clk_unregister_fixed_rate(clk_data->clks[rc->id]); > + clk_data->clks[rc->id] = ERR_PTR(-ENOENT); > + } > +} > +EXPORT_SYMBOL_GPL(mtk_clk_unregister_fixed_clks); > + > void mtk_clk_register_factors(const struct mtk_fixed_factor *clks, > int num, struct clk_onecell_data *clk_data) > { > diff --git a/drivers/clk/mediatek/clk-mtk.h > b/drivers/clk/mediatek/clk-mtk.h > index 168220f85489..cc7f920eabb4 100644 > --- a/drivers/clk/mediatek/clk-mtk.h > +++ b/drivers/clk/mediatek/clk-mtk.h > @@ -34,8 +34,10 @@ struct mtk_fixed_clk { > .rate = _rate, \ > } > > -void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, > - int num, struct clk_onecell_data *clk_data); > +void mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, > int num, > + struct clk_onecell_data *clk_data); > +void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, > int num, > + struct clk_onecell_data *clk_data); > > struct mtk_fixed_factor { > int id;