From nobody Thu Nov 14 20:05:45 2024 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 7F29CC43217 for ; Tue, 8 Feb 2022 13:22:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356428AbiBHNVH (ORCPT ); Tue, 8 Feb 2022 08:21:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358371AbiBHMlW (ORCPT ); Tue, 8 Feb 2022 07:41:22 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05089C03FECA for ; Tue, 8 Feb 2022 04:41:22 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id z17so3740951plb.9 for ; Tue, 08 Feb 2022 04:41:21 -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=hPoHx0MxVy2mprDlmk7WfXEAU5PM2SDXULV3Mk0XUS0=; b=OfHhLbHzk0vts8tueG1EzqqelkQHhva27fwdv4krb3Fqvz8/E1nF+x19VySsFkliJS QWpDJWRJFXUmL6Vs+5UTz8L/HVVxgqR7JTPnT6sc5tF+oL15DU1X5WddfafuoaVI61Bn UoAL6xF9lxyN/QfNm6ivb7WFoGU109XuRiHx4= 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=hPoHx0MxVy2mprDlmk7WfXEAU5PM2SDXULV3Mk0XUS0=; b=bV+OKXnMlKuOlP51LHwLydLhDz7cRCZOcvEtiKLz6W37eCkl/j4aFIDAOw7rsahb6n pltucuVoGrhQ+Ab7tNop9B6FPjU7kVGRc0Q6b/ErsVZ25D4QqYxHMrzslHorFmuA4tsB yUhMS/RBspg1ObWilthHrdsF7sshle9gAwS3T7lvx94UqEp2VdPQOyUdH++Zw3J2LekQ GHkZOe3Un5XgpzlfvrBoOi1ALo6kKiCKklr+b0/BiDQ9QhkhCFD5SqCK+oQBm4CMsSVl 5FTvgdDzMK0xB1/CIDB2Wwz0VXkbSeEdsbj69f3WDdGUYbPwQRovI70Fsm9Kxp+Xlqvd pI1w== X-Gm-Message-State: AOAM533jw/hWxZ70x6VLKaieq8/DsiEMNjLkc9+3IR+NTlLocAy0UPvB +8xwZ6vmNHkxUC1AT6Sm50xtcQ== X-Google-Smtp-Source: ABdhPJymp3eMV72+HQHSFM6knL5LU/F4l+dnd3TBAdTXc+SFrQG9SpNis495KvAMIpZm6L+mhFZQBQ== X-Received: by 2002:a17:90a:c283:: with SMTP id f3mr1171840pjt.138.1644324081530; Tue, 08 Feb 2022 04:41:21 -0800 (PST) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:41b6:813e:c823:609c]) by smtp.gmail.com with ESMTPSA id h11sm15056939pfe.214.2022.02.08.04.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 04:41:21 -0800 (PST) From: Chen-Yu Tsai To: Stephen Boyd , Michael Turquette , Matthias Brugger Cc: Chen-Yu Tsai , Chun-Jie Chen , AngeloGioacchino Del Regno , Miles Chen , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 15/31] clk: mediatek: Implement mtk_clk_unregister_fixed_clks() API Date: Tue, 8 Feb 2022 20:40:18 +0800 Message-Id: <20220208124034.414635-16-wenst@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220208124034.414635-1-wenst@chromium.org> References: <20220208124034.414635-1-wenst@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 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); =20 +void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, int n= um, + struct clk_onecell_data *clk_data) +{ + int i; + + if (!clk_data) + return; + + for (i =3D num; i > 0; i--) { + const struct mtk_fixed_clk *rc =3D &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] =3D 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 =3D _rate, \ } =20 -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 n= um, + struct clk_onecell_data *clk_data); =20 struct mtk_fixed_factor { int id; --=20 2.35.0.263.gb82422642f-goog