Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp748422rwb; Fri, 13 Jan 2023 03:48:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXuiQFg6H6EFDOlfhI/20DgIbKRPl0kUWyDjEhBG/x4B3N17nlfqs/aIKJFdy3g/gM1xgq64 X-Received: by 2002:a17:906:8492:b0:7c0:f118:7e51 with SMTP id m18-20020a170906849200b007c0f1187e51mr58336211ejx.38.1673610517648; Fri, 13 Jan 2023 03:48:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673610517; cv=none; d=google.com; s=arc-20160816; b=nJB4T6w2gHE+aT8FSTxxaDpyjWvrw6MrZTzhASpPsb/xFor6VoXVdryCWqYLCaqmHa 0YU162uepkgvaYK/uSDGrNB08G6sPGECS0Q0+YhXHm2ejRdkYX6g2U7CPAqGIZpnaL/n Ic4gyXaMdJL/IPosqLxrjb+FtWQY9PNiFkA/HA47THMCEThPtvDb94MacALIlWMevvF4 sFDcNTXUsKasWKK3wQKmkoWGSRabjfSkEyJVlg6HvoRUcVnASaPESmFMU91CaRdQiKdE 8ysxVltGvCz039LWWiL7+mpkOflWzwbLE140wkEXsizrD5tvqUfMGsa0oEWS3KN4rVOk 1ykg== 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=4FVi43O2hhEkBB1+/ML86GmtG6dEULcGHlrYpDkLU1g=; b=DCCKfRdpCiY54fAucbBfgWvBUk5W3IrkZunbFz9GuuT/6JKdZPbB56ir7VMU7vYyjl xFzujujO979a4NAq1x8zIhThXD7LIFCjpyflEY+/HmD8nhVmO8C3kzxE+0MSUHQz0H4w wnclamLH4ks7wRY80GnjQyFQFB7kSeFsA5eingRDL+F3NP7r1vj/OXICfP4g/ZWV+fjg leqYfzMmoczMBK07z0rJDGGmXUHZPY7sDJNZOQoHOVj/cZ6ED83zZmh0Qy1OUGwH00Vu CpDR1YGFeUVew5KzcBDC+9DYzAEokapuY8ggC7a8BgVhO5DDoJKlUfzMJScRH7DVI+49 1N7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=KH2y3s+5; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu1-20020a170906eec100b0081a9c3ca498si22380919ejb.314.2023.01.13.03.48.23; Fri, 13 Jan 2023 03:48:37 -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=KH2y3s+5; 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 S241296AbjAMLd7 (ORCPT + 51 others); Fri, 13 Jan 2023 06:33:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234853AbjAMLdD (ORCPT ); Fri, 13 Jan 2023 06:33:03 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71F0B3FA2F; Fri, 13 Jan 2023 03:07:07 -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 ECEDE6602DD1; Fri, 13 Jan 2023 11:07:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1673608026; bh=PGO3NiBc+eG+zlOj+zCEsQPdPVSpKwfxJukNUr/qR44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KH2y3s+5NRwlMUJwKDpB5mu84EqxQBpNCQks5s8d2JOtwlvBZMtTbgtvOaxv8c2dC KhWTNT8Acm9dfYlDB8A2DGLfnxmjDBrT/4FXCI6pd0INWFfODCQCib0wsNnN3/NxQM gHwHE2eDIdjiZYlqLwo/6JlaMtueJPcTZG7dedhXp/LnYG858y0a42lDQzH0quDw7Y Q8GMlhXAo0aBZHuAKbpNGMCK6WJQNgrgJ0gjZKbiyF+4mrhjqDRXbSVwqOq9yZmspX ilN1Fw82l7fM3Cm1ve1lxvaQMbwzMPSMrPX/jHd0qqj9VLb6vjwsrHEz+51XBwI8fs mCX17xqjHD+tg== 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 v3 04/23] clk: mediatek: cpumux: Propagate struct device where possible Date: Fri, 13 Jan 2023 12:05:57 +0100 Message-Id: <20230113110616.111001-5-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113110616.111001-1-angelogioacchino.delregno@collabora.com> References: <20230113110616.111001-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 | 8 ++++---- drivers/clk/mediatek/clk-cpumux.h | 2 +- drivers/clk/mediatek/clk-mt2701.c | 2 +- drivers/clk/mediatek/clk-mt6795-infracfg.c | 3 ++- drivers/clk/mediatek/clk-mt7622.c | 4 ++-- drivers/clk/mediatek/clk-mt7629.c | 4 ++-- drivers/clk/mediatek/clk-mt8173.c | 4 ++-- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c index 25618eff6f2a..da05f06192c0 100644 --- a/drivers/clk/mediatek/clk-cpumux.c +++ b/drivers/clk/mediatek/clk-cpumux.c @@ -58,7 +58,7 @@ static const struct clk_ops clk_cpumux_ops = { }; static struct clk_hw * -mtk_clk_register_cpumux(const struct mtk_composite *mux, +mtk_clk_register_cpumux(struct device *dev, const struct mtk_composite *mux, struct regmap *regmap) { struct mtk_clk_cpumux *cpumux; @@ -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); @@ -102,7 +102,7 @@ static void mtk_clk_unregister_cpumux(struct clk_hw *hw) kfree(cpumux); } -int mtk_clk_register_cpumuxes(struct device_node *node, +int mtk_clk_register_cpumuxes(struct device *dev, struct device_node *node, const struct mtk_composite *clks, int num, struct clk_hw_onecell_data *clk_data) { @@ -125,7 +125,7 @@ int mtk_clk_register_cpumuxes(struct device_node *node, continue; } - hw = mtk_clk_register_cpumux(mux, regmap); + hw = mtk_clk_register_cpumux(dev, mux, regmap); 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..64e45c63b4a0 100644 --- a/drivers/clk/mediatek/clk-cpumux.h +++ b/drivers/clk/mediatek/clk-cpumux.h @@ -11,7 +11,7 @@ struct clk_hw_onecell_data; struct device_node; struct mtk_composite; -int mtk_clk_register_cpumuxes(struct device_node *node, +int mtk_clk_register_cpumuxes(struct device *dev, struct device_node *node, 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 61f1f358104b..3d56ab25aeac 100644 --- a/drivers/clk/mediatek/clk-mt2701.c +++ b/drivers/clk/mediatek/clk-mt2701.c @@ -769,7 +769,7 @@ static void __init mtk_infrasys_init_early(struct device_node *node) mtk_clk_register_factors(infra_fixed_divs, ARRAY_SIZE(infra_fixed_divs), infra_clk_data); - mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes), + mtk_clk_register_cpumuxes(NULL, node, cpu_muxes, ARRAY_SIZE(cpu_muxes), infra_clk_data); r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, diff --git a/drivers/clk/mediatek/clk-mt6795-infracfg.c b/drivers/clk/mediatek/clk-mt6795-infracfg.c index 8025d171d692..23d9fc057e61 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(&pdev->dev, node, cpu_muxes, + ARRAY_SIZE(cpu_muxes), clk_data); if (ret) goto unregister_gates; diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c index 976f318c2e5e..a51a6ed9c4b8 100644 --- a/drivers/clk/mediatek/clk-mt7622.c +++ b/drivers/clk/mediatek/clk-mt7622.c @@ -673,8 +673,8 @@ static int mtk_infrasys_init(struct platform_device *pdev) mtk_clk_register_gates(&pdev->dev, node, infra_clks, ARRAY_SIZE(infra_clks), clk_data); - mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes), - clk_data); + mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes, + ARRAY_SIZE(infra_muxes), clk_data); 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 aadf5d1bc986..0fa158d61a29 100644 --- a/drivers/clk/mediatek/clk-mt7629.c +++ b/drivers/clk/mediatek/clk-mt7629.c @@ -608,8 +608,8 @@ static int mtk_infrasys_init(struct platform_device *pdev) mtk_clk_register_gates(&pdev->dev, node, infra_clks, ARRAY_SIZE(infra_clks), clk_data); - mtk_clk_register_cpumuxes(node, infra_muxes, ARRAY_SIZE(infra_muxes), - clk_data); + mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes, + ARRAY_SIZE(infra_muxes), clk_data); 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 c6545f9c759f..767368463ec5 100644 --- a/drivers/clk/mediatek/clk-mt8173.c +++ b/drivers/clk/mediatek/clk-mt8173.c @@ -892,8 +892,8 @@ static void __init mtk_infrasys_init(struct device_node *node) ARRAY_SIZE(infra_clks), clk_data); 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); + mtk_clk_register_cpumuxes(NULL, node, cpu_muxes, + ARRAY_SIZE(cpu_muxes), clk_data); r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); if (r) -- 2.39.0