From patchwork Fri Dec 23 09:42:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 36170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp229881wrn; Fri, 23 Dec 2022 01:44:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXss51Wju/57cOR6vBwI7f5uUw76PgtsPCr1wDMQuoLLdULyfbzAgt+eybVlPN9gxYUpLKzg X-Received: by 2002:a17:90a:6002:b0:216:cdc7:58bb with SMTP id y2-20020a17090a600200b00216cdc758bbmr10520141pji.34.1671788687494; Fri, 23 Dec 2022 01:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671788687; cv=none; d=google.com; s=arc-20160816; b=pme8adt3KunNhT9NUYOtqsP5OvQV9DoSnayIomW0pa/QmXchv3q97rk9/sdUwRHipX 1XSIZoHli8D0pe+fGloNEH4EVLY8VTsZAz9omiQajbCkEYLRlRiYMJk24GNSsalO7T4e eurEvuxCaFA2LH7hCPGW4WFqiQLvdKN/qYPykK1lRYM9Erplg3Cup5wUUSn42A72Zqzj OrVLnJG91HmwZnFsIYfDSdV3n7+sR13OBp1n6Y15ioRTuIFOO43EtRioTdIzT+KVRh0S O2F3OY0oNuIIARMgW4pFG7MgcCf6c+tPDFP0Vxd49BsaOa0EL/gQuUPn4kCk3suukJhm hHSg== 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=iT1DuwEyxcOOMz7LI32HlThFbaPSzNVoPL+z5zN11HU=; b=cfsoOFVs8ils+x2EE+Vf+j7uolv1d5HBNjTo+xZta9Qvpy9vfdpSSSr4DmbpC7qU3W xssdbQ1NhtkM2bAXC+EVes3HuvW/d9k0mkhJLGK2VzO9B0c7hGW02ly3ogBxCbCQBv1f CNeTJUzU2OghN5N4xowsOxNH5DpZ0/8FqTJntrSTshcXrE6riODRH/IfKUVdNRUI9H9P ED/B8GPADP/UXDEzr9P8DyTWz7kzMrth8GevI7AS5AUsyY0JRKw2DhiItTCEq1bqE7O+ czkbHxsmw0gRrecArdOdzYxw3jK1ip0D3PbvXtO18KYYsl23fgmSk8EocZ1L0iLVly7N eAuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=n+sFVnLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk7-20020a17090b224700b00225aff126desi3522889pjb.109.2022.12.23.01.44.35; Fri, 23 Dec 2022 01:44:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=n+sFVnLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236079AbiLWJnd (ORCPT + 99 others); Fri, 23 Dec 2022 04:43:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236102AbiLWJnQ (ORCPT ); Fri, 23 Dec 2022 04:43:16 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29AFF3578A; Fri, 23 Dec 2022 01:43:14 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id B3A376602CEA; Fri, 23 Dec 2022 09:43:11 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1671788593; bh=TEeukEcmEw2M1hk42gs6TWEg0hPcaPFVIEtr7muKTec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n+sFVnLKV2g0PitOiTd7Tcty7AnIzOwj+3AuwbpZzqEKeF4FCTYhoa1TLKWoLueb1 jTg5T7SkJZaTpurkn4RAMWdBlype9JsnVnRdlqtxfwEKCkbatQUnG7H972pR9Ic2vI vQMLqj1ZRCM2Qf44Iu0/NsVeScUVTEKXdnMj1fnsB4XexdVAMkzfUTrRd23/5gTNeI m68bWK+v16l2hAieGhn4xGNH22to6s/3K1ZdOVZ32GKboyVM30SLz1tlozLgqvR25V SB8swy+5cF/3MwfMJuEr39uaq+YTIfd5G+CYRRgeKI+bwCjt7R7IcAUgLHbErJ/XKL pg3dHgweZbuGw== From: AngeloGioacchino Del Regno To: mturquette@baylibre.com Cc: sboyd@kernel.org, matthias.bgg@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, angelogioacchino.delregno@collabora.com, wenst@chromium.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, fparent@baylibre.com, chun-jie.chen@mediatek.com, sam.shih@mediatek.com, y.oudjana@protonmail.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, ryder.lee@kernel.org, daniel@makrotopia.org, jose.exposito89@gmail.com, yangyingliang@huawei.com, pablo.sun@mediatek.com, msp@baylibre.com, weiyi.lu@mediatek.com, ikjn@chromium.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, kernel@collabora.com Subject: [PATCH v2 04/23] clk: mediatek: cpumux: Propagate struct device where possible Date: Fri, 23 Dec 2022 10:42:40 +0100 Message-Id: <20221223094259.87373-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221223094259.87373-1-angelogioacchino.delregno@collabora.com> References: <20221223094259.87373-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752997495108286391?= X-GMAIL-MSGID: =?utf-8?q?1752997495108286391?= Take a pointer to a struct device in mtk_clk_register_cpumuxes() and propagate the same to mtk_clk_register_cpumux() => clk_hw_register(). Even though runtime pm is unlikely to be used with CPU muxes, this helps with code consistency and possibly opens to commonization of some mtk_clk_register_(x) functions. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai Reviewed-by: Markus Schneider-Pargmann --- drivers/clk/mediatek/clk-cpumux.c | 9 +++++---- drivers/clk/mediatek/clk-cpumux.h | 3 ++- drivers/clk/mediatek/clk-mt2701.c | 2 +- drivers/clk/mediatek/clk-mt6795-infracfg.c | 3 ++- drivers/clk/mediatek/clk-mt7622.c | 2 +- drivers/clk/mediatek/clk-mt7629.c | 2 +- drivers/clk/mediatek/clk-mt8173.c | 2 +- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c index 25618eff6f2a..889534f7e97d 100644 --- a/drivers/clk/mediatek/clk-cpumux.c +++ b/drivers/clk/mediatek/clk-cpumux.c @@ -59,7 +59,7 @@ static const struct clk_ops clk_cpumux_ops = { static struct clk_hw * mtk_clk_register_cpumux(const struct mtk_composite *mux, - struct regmap *regmap) + struct regmap *regmap, struct device *dev) { struct mtk_clk_cpumux *cpumux; int ret; @@ -81,7 +81,7 @@ mtk_clk_register_cpumux(const struct mtk_composite *mux, cpumux->regmap = regmap; cpumux->hw.init = &init; - ret = clk_hw_register(NULL, &cpumux->hw); + ret = clk_hw_register(dev, &cpumux->hw); if (ret) { kfree(cpumux); return ERR_PTR(ret); @@ -104,7 +104,8 @@ static void mtk_clk_unregister_cpumux(struct clk_hw *hw) int mtk_clk_register_cpumuxes(struct device_node *node, const struct mtk_composite *clks, int num, - struct clk_hw_onecell_data *clk_data) + struct clk_hw_onecell_data *clk_data, + struct device *dev) { int i; struct clk_hw *hw; @@ -125,7 +126,7 @@ int mtk_clk_register_cpumuxes(struct device_node *node, continue; } - hw = mtk_clk_register_cpumux(mux, regmap); + hw = mtk_clk_register_cpumux(mux, regmap, dev); if (IS_ERR(hw)) { pr_err("Failed to register clk %s: %pe\n", mux->name, hw); diff --git a/drivers/clk/mediatek/clk-cpumux.h b/drivers/clk/mediatek/clk-cpumux.h index 325adbef25d1..0b7a59d4e0f2 100644 --- a/drivers/clk/mediatek/clk-cpumux.h +++ b/drivers/clk/mediatek/clk-cpumux.h @@ -13,7 +13,8 @@ struct mtk_composite; int mtk_clk_register_cpumuxes(struct device_node *node, const struct mtk_composite *clks, int num, - struct clk_hw_onecell_data *clk_data); + struct clk_hw_onecell_data *clk_data, + struct device *dev); void mtk_clk_unregister_cpumuxes(const struct mtk_composite *clks, int num, struct clk_hw_onecell_data *clk_data); diff --git a/drivers/clk/mediatek/clk-mt2701.c b/drivers/clk/mediatek/clk-mt2701.c index dff69fabb171..dcae25778817 100644 --- a/drivers/clk/mediatek/clk-mt2701.c +++ b/drivers/clk/mediatek/clk-mt2701.c @@ -770,7 +770,7 @@ static void __init mtk_infrasys_init_early(struct device_node *node) infra_clk_data); mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), - infra_clk_data); + infra_clk_data, NULL); r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, infra_clk_data); diff --git a/drivers/clk/mediatek/clk-mt6795-infracfg.c b/drivers/clk/mediatek/clk-mt6795-infracfg.c index 4bbd2bfe2ec4..850b24666592 100644 --- a/drivers/clk/mediatek/clk-mt6795-infracfg.c +++ b/drivers/clk/mediatek/clk-mt6795-infracfg.c @@ -106,7 +106,8 @@ static int clk_mt6795_infracfg_probe(struct platform_device *pdev) if (ret) goto free_clk_data; - ret = mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data); + ret = mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), + clk_data, &pdev->dev); if (ret) goto unregister_gates; diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c index eab450fc824c..adf3b4535170 100644 --- a/drivers/clk/mediatek/clk-mt7622.c +++ b/drivers/clk/mediatek/clk-mt7622.c @@ -674,7 +674,7 @@ static int mtk_infrasys_init(struct platform_device *pdev) clk_data, &pdev->dev); mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes), - clk_data); + clk_data, &pdev->dev); r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); diff --git a/drivers/clk/mediatek/clk-mt7629.c b/drivers/clk/mediatek/clk-mt7629.c index 2daceeab7fc4..48bc4a6705fb 100644 --- a/drivers/clk/mediatek/clk-mt7629.c +++ b/drivers/clk/mediatek/clk-mt7629.c @@ -609,7 +609,7 @@ static int mtk_infrasys_init(struct platform_device *pdev) clk_data, &pdev->dev); mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes), - clk_data); + clk_data, &pdev->dev); return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); diff --git a/drivers/clk/mediatek/clk-mt8173.c b/drivers/clk/mediatek/clk-mt8173.c index dfb819dd1b1b..125b01b9e2ab 100644 --- a/drivers/clk/mediatek/clk-mt8173.c +++ b/drivers/clk/mediatek/clk-mt8173.c @@ -893,7 +893,7 @@ static void __init mtk_infrasys_init(struct device_node *node) mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data); mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), - clk_data); + clk_data, NULL); r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); if (r)