From patchwork Thu Jan 5 00:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13089246 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 2B0E6C46467 for ; Thu, 5 Jan 2023 00:22:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235101AbjAEAWb (ORCPT ); Wed, 4 Jan 2023 19:22:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234581AbjAEAWa (ORCPT ); Wed, 4 Jan 2023 19:22:30 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0326D43A30 for ; Wed, 4 Jan 2023 16:22:29 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id bq39so45067256lfb.0 for ; Wed, 04 Jan 2023 16:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+ndoGo0L0trdB1SJI5vVwfFWDuQ8EsWjbtAz+We2f9E=; b=oTeMSShq7t40VB0qniYCwFnFoh8geFbWJjFWyePKeAgjzdjoGs8O8EFAeApKozOWrH EGJE4pajj7MZByog8CGg4xqNnal86ET28iJMtUwQgcXKaxTyPJmi+5/fO7GRCUPtbNr3 xreAh/8FA+czumvdHjpIfPbAzfcegE1Po5Lor2dyfc8kx9E2l3r1PsU4k9qKgThJ6r0Q Kzo+VHWpzWkf666Rk2YMLQnee2l7EvzQYYfPudKauT12hMj7Ba0NLNr+MyO80M8l/amv 5OH7+QunZ6eKii+k+egFL8DAhh6uLd0w6GVwsb8sWUtbsm9Fx3TZ7cbGDvG5UbQYEUms hyew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+ndoGo0L0trdB1SJI5vVwfFWDuQ8EsWjbtAz+We2f9E=; b=LA2Z/cCpikrvN9h0Z1AOo/VQ6rGenDsrI6X0u+8FgszMYDjsWWxyKOpwUV0ygCuCqO XFnv+GDqGYSDqwSIIXI8on0BXaK53DS3wAplqv96YY5PiYY4WYs3nXowtBYgiaT9BQVe fGjCdlTU2k9Yu6Lg3HdOJqhRhbRTdypfxqIboKwq66Ee1g2vGGXHfwxTfS3yRXnrQcBB phKyXVYjtXu0U8FdCegaqEVBOsTg0FIfaj5862ZRu9i3jJVplsijaZ7TsgpAvKoexxBh Lv+oANKxMPl+h7vQqfoQV9o54+Jgk4XeOIiVSFeJYqVJpYn+2SyWcmnabmFxet9Gva9+ R7AQ== X-Gm-Message-State: AFqh2kobgmzA8kkBkZe/t0YbZK8+pBVy4mhfE5EyyY70ndmU5k2QHhux zzvWHUHlwcnyFxQKBAjocq0yWVGPlaDcRBp2 X-Google-Smtp-Source: AMrXdXtJFiQ17gwDglGRIuACrY0HZ132bP+xsoouZJ5HYi6uoB0LGj6sS88T+m8y9bEInVaCzLsxEg== X-Received: by 2002:a05:6512:142:b0:4b5:a207:8d73 with SMTP id m2-20020a056512014200b004b5a2078d73mr12928034lfo.52.1672878147385; Wed, 04 Jan 2023 16:22:27 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id d18-20020ac241d2000000b004b4cbc942a3sm5291992lfi.127.2023.01.04.16.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 16:22:25 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Georgi Djakov Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 3/3] interconnect: qcom: sm8550: switch to qcom_icc_rpmh_* function Date: Thu, 5 Jan 2023 02:22:21 +0200 Message-Id: <20230105002221.1416479-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105002221.1416479-1-dmitry.baryshkov@linaro.org> References: <20230105002221.1416479-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Change sm8550 interconnect driver to use generic qcom_icc_rpmh_* functions rather than embedding a copy of thema. This also fixes an overallocation of memory for icc_onecell_data structure. Fixes: e6f0d6a30f73 ("interconnect: qcom: Add SM8550 interconnect provider driver") Signed-off-by: Dmitry Baryshkov --- drivers/interconnect/qcom/sm8550.c | 99 +----------------------------- 1 file changed, 2 insertions(+), 97 deletions(-) diff --git a/drivers/interconnect/qcom/sm8550.c b/drivers/interconnect/qcom/sm8550.c index 54fa027ab961..d823ba988ef6 100644 --- a/drivers/interconnect/qcom/sm8550.c +++ b/drivers/interconnect/qcom/sm8550.c @@ -2165,101 +2165,6 @@ static const struct qcom_icc_desc sm8550_system_noc = { .num_bcms = ARRAY_SIZE(system_noc_bcms), }; -static int qnoc_probe(struct platform_device *pdev) -{ - const struct qcom_icc_desc *desc; - struct icc_onecell_data *data; - struct icc_provider *provider; - struct qcom_icc_node * const *qnodes; - struct qcom_icc_provider *qp; - struct icc_node *node; - size_t num_nodes, i; - int ret; - - desc = device_get_match_data(&pdev->dev); - if (!desc) - return -EINVAL; - - qnodes = desc->nodes; - num_nodes = desc->num_nodes; - - qp = devm_kzalloc(&pdev->dev, sizeof(*qp), GFP_KERNEL); - if (!qp) - return -ENOMEM; - - data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL); - if (!data) - return -ENOMEM; - - provider = &qp->provider; - provider->dev = &pdev->dev; - provider->set = qcom_icc_set; - provider->pre_aggregate = qcom_icc_pre_aggregate; - provider->aggregate = qcom_icc_aggregate; - provider->xlate_extended = qcom_icc_xlate_extended; - INIT_LIST_HEAD(&provider->nodes); - provider->data = data; - - qp->dev = &pdev->dev; - qp->bcms = desc->bcms; - qp->num_bcms = desc->num_bcms; - - qp->voter = of_bcm_voter_get(qp->dev, NULL); - if (IS_ERR(qp->voter)) - return PTR_ERR(qp->voter); - - ret = icc_provider_add(provider); - if (ret) { - dev_err_probe(&pdev->dev, ret, - "error adding interconnect provider\n"); - return ret; - } - - for (i = 0; i < qp->num_bcms; i++) - qcom_icc_bcm_init(qp->bcms[i], &pdev->dev); - - for (i = 0; i < num_nodes; i++) { - size_t j; - - if (!qnodes[i]) - continue; - - node = icc_node_create(qnodes[i]->id); - if (IS_ERR(node)) { - ret = PTR_ERR(node); - goto err; - } - - node->name = qnodes[i]->name; - node->data = qnodes[i]; - icc_node_add(node, provider); - - for (j = 0; j < qnodes[i]->num_links; j++) - icc_link_create(node, qnodes[i]->links[j]); - - data->nodes[i] = node; - } - data->num_nodes = num_nodes; - - platform_set_drvdata(pdev, qp); - - return 0; -err: - icc_nodes_remove(provider); - icc_provider_del(provider); - return ret; -} - -static int qnoc_remove(struct platform_device *pdev) -{ - struct qcom_icc_provider *qp = platform_get_drvdata(pdev); - - icc_nodes_remove(&qp->provider); - icc_provider_del(&qp->provider); - - return 0; -} - static const struct of_device_id qnoc_of_match[] = { { .compatible = "qcom,sm8550-aggre1-noc", .data = &sm8550_aggre1_noc}, @@ -2294,8 +2199,8 @@ static const struct of_device_id qnoc_of_match[] = { MODULE_DEVICE_TABLE(of, qnoc_of_match); static struct platform_driver qnoc_driver = { - .probe = qnoc_probe, - .remove = qnoc_remove, + .probe = qcom_icc_rpmh_probe, + .remove = qcom_icc_rpmh_remove, .driver = { .name = "qnoc-sm8550", .of_match_table = qnoc_of_match,