Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5447351pxb; Wed, 26 Jan 2022 12:11:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+DLaw9rKv3yCxQCSVmswFUuWCn+TvjYiqZhQAqgfTZkYkIh0ZT9/IUTUD16L/6QP+UpKy X-Received: by 2002:a17:90b:4d8a:: with SMTP id oj10mr10330611pjb.201.1643227862657; Wed, 26 Jan 2022 12:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643227862; cv=none; d=google.com; s=arc-20160816; b=DPHNgCevSiq+yf7Kre2xnBFgt4zh8qZdnfpR4TyurHhvgt/SyOTY3DNIYuA6QGj2Ym NgUhvQ3wHzkALN0eaUHGnuMZoWJea5oTtkSo9djx2kCYNxub2KOqr84XdhBAv4z+2Cc4 NoMnSVDx/mjOBJ7sr33mojhsINVROkaClb1MtUGROytYl/H22PqdbTndUOTupmoJlqiJ zTGmbqmW59elUtFpHL4JlJcDLK+NO9bcCY22j7GuyQdDpoMNZbmw8fZZsj2lGyp+Rgfq 2DfomVfpoKwkta2XGlp4eyT1FX0mwWDR9XUezN8OX1OaL9Yt1K+/gzgb+MeM2aXxdtyj w20Q== 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=0BanIxvlUYA1SwU3WwE2a7SGXelCnV6CSWVXQFc55mA=; b=iqDE63FJDRxcsubOdJakTTEnCR+9ToR1TLQhR1cm6NbvnGHbLCrj0Yev+ZE40OjYNP jNg/FqoiVFDWITs/xP63VBY3MDq9i6X8PRKqDysCx4eHcRr0NhK3JA9ivLHAONFojLgi YG7qdYpBuHX5vDLvnshP93ETT9UbSs/wiHsQVEL0ouO9W0yqOS5WWWRInBi2OwcrEql2 ddq4lXlrnvsgpT4p3cYgrNnXrtT7SRjXYsQ0NtZrEPQ6WvloU26C/AYwf+I3n/gMB+ty nB7otMmNjZIEuKLBreqxEFl77X2g4X5KX6I0gKllPFFL/X8jRwkHCOLMOXp+C31r23dk inGQ== 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 bf17si115067pgb.10.2022.01.26.12.10.50; Wed, 26 Jan 2022 12:11:02 -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 S237373AbiAZG5B (ORCPT + 99 others); Wed, 26 Jan 2022 01:57:01 -0500 Received: from mailgw01.mediatek.com ([60.244.123.138]:51494 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S237299AbiAZG47 (ORCPT ); Wed, 26 Jan 2022 01:56:59 -0500 X-UUID: 170623d6002f4a4b8a7a774e26ed8423-20220126 X-UUID: 170623d6002f4a4b8a7a774e26ed8423-20220126 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 1320218509; Wed, 26 Jan 2022 14:56:55 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Wed, 26 Jan 2022 14:56:54 +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:56:54 +0800 From: Miles Chen To: CC: , , , , , , , Subject: Re: [PATCH 16/31] clk: mediatek: Implement mtk_clk_unregister_factors() API Date: Wed, 26 Jan 2022 14:56:54 +0800 Message-ID: <20220126065654.23309-1-miles.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220122091731.283592-17-wenst@chromium.org> References: <20220122091731.283592-17-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_factors(), as the name suggests, is used to register > a given list of fixed factor 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 7c0d5706eed7..b267b2f04b84 100644 > --- a/drivers/clk/mediatek/clk-mtk.c > +++ b/drivers/clk/mediatek/clk-mtk.c > @@ -126,6 +126,26 @@ void mtk_clk_register_factors(const struct mtk_fixed_factor *clks, > } > EXPORT_SYMBOL_GPL(mtk_clk_register_factors); > > +void mtk_clk_unregister_factors(const struct mtk_fixed_factor *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_factor *ff = &clks[i - 1]; > + > + if (IS_ERR_OR_NULL(clk_data->clks[ff->id])) > + continue; > + > + clk_unregister_fixed_factor(clk_data->clks[ff->id]); > + clk_data->clks[ff->id] = ERR_PTR(-ENOENT); > + } > +} > +EXPORT_SYMBOL_GPL(mtk_clk_unregister_factors); > + > struct clk *mtk_clk_register_composite(const struct mtk_composite *mc, > void __iomem *base, spinlock_t *lock) > { > diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h > index cc7f920eabb4..4db1a97c1250 100644 > --- a/drivers/clk/mediatek/clk-mtk.h > +++ b/drivers/clk/mediatek/clk-mtk.h > @@ -55,8 +55,10 @@ struct mtk_fixed_factor { > .div = _div, \ > } > > -void mtk_clk_register_factors(const struct mtk_fixed_factor *clks, > - int num, struct clk_onecell_data *clk_data); > +void mtk_clk_register_factors(const struct mtk_fixed_factor *clks, int num, > + struct clk_onecell_data *clk_data); > +void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num, > + struct clk_onecell_data *clk_data); > > struct mtk_composite { > int id; > -- > 2.35.0.rc0.227.g00780c9af4-goog