Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2507262pxb; Sun, 23 Jan 2022 06:57:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCT8v6PnUw1YP+aoLAqaO9Md9B5W+9sUIb0QUif09wK8qWYXvenPwhjPj0MrNrCxfZ67sQ X-Received: by 2002:a63:b04d:: with SMTP id z13mr8944962pgo.91.1642949826743; Sun, 23 Jan 2022 06:57:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642949826; cv=none; d=google.com; s=arc-20160816; b=tkU1pCSd8/Fl+2dHNs3xipJHfEYjvpyM1MLO5pBIyEaQ5fZd6O+0uvqxIfNBiIk/LE yZhQRXMvRlsoZksWZfZ8lRBbCN1Uo2nAScMcJLTF1dKQgZfb53f/EbtoDW9AyGoqLqLp CRJrISHjIuNcCwqh0ych7zn6kFTB610HVipDndM1jtcAsPysxHzDkNJoHVQpGHRew0ed Zmq5TQKJG2jCOIzqywFhJl9RNpptzlGCX6OB9vQrThVPTEj8YF5LMuTJ2PjN3tAc2p+U a91akbLTXXMjhXmjeVcIxtGWiofHqQ8ZuMddJxaYMBYdfaKbvPMACXjGqYSYTb8Wb4Ud 75AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OL43s5I7LNHYgmLD2gKEH5DLtt+mhRAmKo34NJ8rtwE=; b=LIqYaoXBjmOKaXnyrhy7x4MBTsX32T8PSc369iVtqylWZeT1vz1jhZgXsJxObE3uM/ rrYQm4WbW0CBZjaZ2awH/eD9iFc2K7scg0IuWvoqNRWBH6ezT/Rl72t5PDSnE3p10osp qD9HmVPtKIiJwkS7E9fvye0cIWImgTAn2dAegmvgCfyAKJ8gOgZrb4zZ7smEgiONiLbY /Moos131N8ImpiVRCcsFxdEqVHSMpzK8BNMyuo0cdBynLiWB/CEtuslRJ3pLbhUvGLoG ViSEL5L/igUK99vKy8uAUUwgco4t9Xz5dYEr9ibc7zRCu7lupwc0RsLgm4BsTE1bfopB Q4XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ggo0kYpw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w16si12665168plg.444.2022.01.23.06.56.55; Sun, 23 Jan 2022 06:57:06 -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; dkim=pass header.i=@chromium.org header.s=google header.b=Ggo0kYpw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234102AbiAVJTN (ORCPT + 99 others); Sat, 22 Jan 2022 04:19:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234136AbiAVJSe (ORCPT ); Sat, 22 Jan 2022 04:18:34 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1068C061756 for ; Sat, 22 Jan 2022 01:18:22 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id pf13so11361403pjb.0 for ; Sat, 22 Jan 2022 01:18:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OL43s5I7LNHYgmLD2gKEH5DLtt+mhRAmKo34NJ8rtwE=; b=Ggo0kYpwoWnwSolmdIbTiIGBqEoKYbbJGe28yVsffQtRCfNStfbzu7ufp6Frh7kLje tP7/f8uW+0pNL+bOuvU/y84/uITpHYEb4voWNxDpRawsGCYd/r3YXYAKeQhm0MdB4Mlt UhRx3i9YIEqpmxfnvwv7tKZDw0i0XRfWQqIWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OL43s5I7LNHYgmLD2gKEH5DLtt+mhRAmKo34NJ8rtwE=; b=B+r73/D7DuEWE3PX30aQqyg2p4U84V5bjNkE84XWgqtZ1RHURU9vF8O1+uMYAMwdd2 0t7G40SXks4DD85KnJF53lIbqo4iiHN/FmJxoHAFEo5G5RtpcaU+tMHkY37000q+1/hj rnu4/MI9a4VpKubNr/iIurF7oJtqMujcGx3wBJNvPBxxZZ3chslVysqmrWbURWydayCN +wpYD/ohtBSadnLgx5o8LlN9y+AAC7j+K4N40RMMNjFXbwJVORYNMNhDSVLaElrQKxWs X9wFlltBtCsbwoB4a2GCFRMLu8PWZe85bbfAxsF0uvRFmD5zTVuejZfq2V9QcJp3T9ji 598g== X-Gm-Message-State: AOAM533EOMn+xslxPgKCasS2fjIYpWOLt/w7XJoxoweot7HOnv1Uf6NO xCGNBRvnNXI1rxkJdmmfG/90AQ== X-Received: by 2002:a17:903:32c6:b0:14b:3f5b:e9c6 with SMTP id i6-20020a17090332c600b0014b3f5be9c6mr89273plr.136.1642843102481; Sat, 22 Jan 2022 01:18:22 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:349f:9373:45d9:eb26]) by smtp.gmail.com with ESMTPSA id s1sm1608100pjn.42.2022.01.22.01.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jan 2022 01:18:22 -0800 (PST) From: Chen-Yu Tsai To: Stephen Boyd , Michael Turquette , Matthias Brugger Cc: Chen-Yu Tsai , Chun-Jie Chen , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/31] clk: mediatek: Implement mtk_clk_unregister_divider_clks() API Date: Sat, 22 Jan 2022 17:17:17 +0800 Message-Id: <20220122091731.283592-18-wenst@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220122091731.283592-1-wenst@chromium.org> References: <20220122091731.283592-1-wenst@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mtk_clk_register_divider_clks(), as the name suggests, is used to register a given list of divider 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 --- drivers/clk/mediatek/clk-mtk.c | 19 +++++++++++++++++++ drivers/clk/mediatek/clk-mtk.h | 8 +++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index b267b2f04b84..3a6dfe445e63 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -286,6 +286,25 @@ void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, } } +void mtk_clk_unregister_dividers(const struct mtk_clk_divider *mcds, int num, + struct clk_onecell_data *clk_data) +{ + int i; + + if (!clk_data) + return; + + for (i = num; i > 0; i--) { + const struct mtk_clk_divider *mcd = &mcds[i - 1]; + + if (IS_ERR_OR_NULL(clk_data->clks[mcd->id])) + continue; + + clk_unregister_divider(clk_data->clks[mcd->id]); + clk_data->clks[mcd->id] = ERR_PTR(-ENOENT); + } +} + int mtk_clk_simple_probe(struct platform_device *pdev) { const struct mtk_clk_desc *mcd; diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h index 4db1a97c1250..e3ae22fb0334 100644 --- a/drivers/clk/mediatek/clk-mtk.h +++ b/drivers/clk/mediatek/clk-mtk.h @@ -176,9 +176,11 @@ struct mtk_clk_divider { .div_width = _width, \ } -void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, - int num, void __iomem *base, spinlock_t *lock, - struct clk_onecell_data *clk_data); +void mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, int num, + void __iomem *base, spinlock_t *lock, + struct clk_onecell_data *clk_data); +void mtk_clk_unregister_dividers(const struct mtk_clk_divider *mcds, int num, + struct clk_onecell_data *clk_data); struct clk_onecell_data *mtk_alloc_clk_data(unsigned int clk_num); void mtk_free_clk_data(struct clk_onecell_data *clk_data); -- 2.35.0.rc0.227.g00780c9af4-goog