Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5446893pxb; Wed, 26 Jan 2022 12:10:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzG00JSUeWnq/lBB6HLVI8YJFikCvFrSyZlHy1V+2y/Ap44vYZrt9voxLa6rciXQYLP3cp X-Received: by 2002:a65:5c84:: with SMTP id a4mr409076pgt.258.1643227826368; Wed, 26 Jan 2022 12:10:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643227826; cv=none; d=google.com; s=arc-20160816; b=dOISh2gHET5TwhtV3OtbHqC0XsOqMYWRI00l6oHc8p/zECOCwz0S//zKOMMb72TcNF N8RBMxdCLdjBSBvem1xdCKTty+FGr3vHkyU0TPTy4Yo33CZe0lFXZLeBIzZ3uK1r5o98 Z3W1XijOanbpmLzZbK+3SdX4vSU48VVzNFCKVgKPC4lWvJhoyY0jpYQ2s3VchBCXILHB gdgyJJgMU5uaGokNz1yX5sQBUxA2Yjqcx3hxG1pnf3oDVuHeRFqxVoD/wnlha3K1qvkX gOeXp1sat0VTEx4j5luHyqxkpiux7FwJwrCFv8sm27aGiC6Jd1jH1RDT08bAwb1pmU/O ToAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=DtOi4MeKm1KkpmAA1J/mf5N56AvD/PIKcqr9GTFdT2U=; b=y9eeVtw5xkG3amWZKcB33D6FrRultNX73bRlRfeQs0VTwq/qGASCf2MH8Ton8d61TJ uJgCxPg5mp6srfBylsJU0W5HGlA4ZEHTULV+Dq/gMr6+UUQuWDA1PHAFuBDp9KYNK3K7 BeIRAZI2s4h0/hKUIlNvh57h1HlRfW2mkdvwsg04Fg5cDRe8iH8uL1kw3Wj/4xtrXdMl bn6AGvoOpW02ME9uxDq9Me+kYEPutP2iIyj7VnDFV06GSp4IRuRcGgFW0uyqNR4KsjRL hZMN4y6Rbb7JQjSg7paq/fLNUHDU9P8kI/XemIeQeUFZWid0LunFLsoRaiUGoAh8e+1t V62Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g186si187589pgc.790.2022.01.26.12.10.14; Wed, 26 Jan 2022 12:10:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237214AbiAZGzg (ORCPT + 99 others); Wed, 26 Jan 2022 01:55:36 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:34732 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S237124AbiAZGzf (ORCPT ); Wed, 26 Jan 2022 01:55:35 -0500 X-UUID: b18902c3acc94a128f67bbf855fd1510-20220126 X-UUID: b18902c3acc94a128f67bbf855fd1510-20220126 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 788781598; Wed, 26 Jan 2022 14:55:33 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 26 Jan 2022 14:55:32 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 26 Jan 2022 14:55:32 +0800 From: Miles Chen To: CC: , , , , , , , Subject: Re: [PATCH 15/31] clk: mediatek: Implement mtk_clk_unregister_fixed_clks() API Date: Wed, 26 Jan 2022 14:55:32 +0800 Message-ID: <20220126065532.22463-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220122091731.283592-16-wenst@chromium.org> References: <20220122091731.283592-16-wenst@chromium.org> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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 > --- > 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; > -- > 2.35.0.rc0.227.g00780c9af4-goog