From patchwork Tue Feb 8 12:40:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 12738648 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BD45C433F5 for ; Tue, 8 Feb 2022 12:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QVer98QPe9O5x1JwfrgMQkNuxPpCG7YmQBO2nRtPwFM=; b=F5oLUXCS7dhFch 4bXwvzWBolfw4o5BQX8OkoNnFdT4axQPfI9fTqBCVkxIfz49Q+jvvmttaMOaUlRfDgIiwAdvzopTO ke58F2FizUkFSbogUf1mQxrbWuLqdOS1GrD3uzMCx0CCw7LW8ZRHWy/0z4rMqVZ1grROBuc5A9c4r UAoZFC/nkQ0ljMw82cdYWJ4BihgY4at9hanhdF6GWSfYQYfDbuKATyfFehqFjmV7XdgFFxUG/rZIF HIZgcM60U+bsgEu+9Rdyd3uJP76wgo7sy77I1xlauOXM1+1VgF9U38sy/Q/8S3N6N4Un7WgnuXwNO s28G50OeHyKPqy+nyGuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHPyf-00Dshq-9M; Tue, 08 Feb 2022 12:52:14 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHPoJ-00DnZS-FN for linux-arm-kernel@lists.infradead.org; Tue, 08 Feb 2022 12:41:33 +0000 Received: by mail-pf1-x42c.google.com with SMTP id z13so1009385pfa.3 for ; Tue, 08 Feb 2022 04:41:30 -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=eHwaFCxTmQBqke38QY+U5TZZstQq9O/KJJL77r3W7Ws=; b=nvJ9cLw2nqPy00A1rg0QyEIyTWd8T9dpFDluSxKOq9Tn01B1Y1MbhjQSTCkrI27lra TPGEARXZUBxH7ykfmmOa39dR6Oy6acq0JeHZz8WIgow8M1VrhGsVwV07krTMrsDqoSNI XG0NVawmgtjcczlzwoL1Zq8zDR39B0P7nUe1s= 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=eHwaFCxTmQBqke38QY+U5TZZstQq9O/KJJL77r3W7Ws=; b=OWKvda7rQUjbaEdziFexHi+dpewVVnv8iloHa3bu7joCShBrYPThhqdAdiX7mE5Dm2 6OvYvf/A9npi1QwwJsb0X19bF9HPldq7w7DEbWCilHfqCTabvnFOOcH13+ota0t//imn BWm89aK5w04+1baYBxOGPNg1OaGfjnhQpNPjAvaxGntrIY/EQx3F3dtcV2ryU3nMdC6q QoxonSNrSgi2qSkAX1mh1rukD8v/hyciTyG4R7RpP4sp6eOM7GtJY9UZLTC3GD4e4WXv MQx9W6qFG+DzvawNsjfe524fhb207iVIF3QKzi4JmbbibNp/JUDajJkj+/6/YpJ1DSkY KEkQ== X-Gm-Message-State: AOAM531qRlHx7VEW+pCp7PoDODofo2HoSwz2UHLVZ7t+VYh2X0jkZ0y3 nSoLT/KyaLy+EdZVs10s5WOUyg== X-Google-Smtp-Source: ABdhPJyYdWVRlyhjrE40StYyFinJI1sYaLoiAb4EohqiUabCdb/YfzS2WfyZVC3UGTCq7xluaPc2Xw== X-Received: by 2002:a63:8142:: with SMTP id t63mr3362355pgd.256.1644324090238; Tue, 08 Feb 2022 04:41:30 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 04:41:30 -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 19/31] clk: mediatek: Add mtk_clk_simple_remove() Date: Tue, 8 Feb 2022 20:40:22 +0800 Message-Id: <20220208124034.414635-20-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220208_044131_600458_EA3B8B57 X-CRM114-Status: GOOD ( 13.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In commit c58cd0e40ffa ("clk: mediatek: Add mtk_clk_simple_probe() to simplify clock providers"), a generic probe function was added to simplify clk drivers that only needed to support clk gates. However due to the lack of unregister APIs, a corresponding remove function was not added. Now that the unregister APIs have been implemented, add aforementioned remove function to make it complete. 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 | 15 +++++++++++++++ drivers/clk/mediatek/clk-mtk.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 869e6ae55c82..f108786caeda 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -374,6 +374,8 @@ int mtk_clk_simple_probe(struct platform_device *pdev) if (r) goto free_data; + platform_set_drvdata(pdev, clk_data); + return r; free_data: @@ -381,4 +383,17 @@ int mtk_clk_simple_probe(struct platform_device *pdev) return r; } +int mtk_clk_simple_remove(struct platform_device *pdev) +{ + const struct mtk_clk_desc *mcd = of_device_get_match_data(&pdev->dev); + struct clk_onecell_data *clk_data = platform_get_drvdata(pdev); + struct device_node *node = pdev->dev.of_node; + + of_clk_del_provider(node); + mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data); + mtk_free_clk_data(clk_data); + + return 0; +} + MODULE_LICENSE("GPL"); diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h index 3c3a934f53cd..4fa658f5d934 100644 --- a/drivers/clk/mediatek/clk-mtk.h +++ b/drivers/clk/mediatek/clk-mtk.h @@ -202,5 +202,6 @@ struct mtk_clk_desc { }; int mtk_clk_simple_probe(struct platform_device *pdev); +int mtk_clk_simple_remove(struct platform_device *pdev); #endif /* __DRV_CLK_MTK_H */