From patchwork Thu Jan 5 00:22:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13089244 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 4255CC46467 for ; Thu, 5 Jan 2023 00:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231258AbjAEAW3 (ORCPT ); Wed, 4 Jan 2023 19:22:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234393AbjAEAW0 (ORCPT ); Wed, 4 Jan 2023 19:22:26 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB2AE43A2E for ; Wed, 4 Jan 2023 16:22:25 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id bf43so52858328lfb.6 for ; Wed, 04 Jan 2023 16:22:25 -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=ce4nWtQTzmJz9V5Gg6kSD4rQYBwczLgo3Cm/X4Z1bnM=; b=fNPGDAg8iGnqEaZ91hIwN5lSd4fBxyM61qSNgJ1HV48KBU15MHJYKrvRQmKZZp0qbP B00F7ce53KCZb5itXQybmkB8fqQFzH5TzcTE768Sm6cQEUZ/evN1DwfVLHI94slk8AMZ +cW4qC53TU930mKHKuk40cZrBKUE+GHr07XreevoHBlTKjLLKH02QD1tZ5L4U6gh2XWM mNRJcaNc+I0eP7Ty7xr79MVg2NY/4bhy7cgOUEbyk1JWPBnN1Qorz5jIRLEr5MzkEyc5 Z/7hxUS6hwzUZ1CMOYvgPQ+ByBPI09sIxlCF0iwal7Ln6gZzA+YjkH2z0IPgsmJX4boD ujvw== 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=ce4nWtQTzmJz9V5Gg6kSD4rQYBwczLgo3Cm/X4Z1bnM=; b=bYWSavHhtp4zOmtOkvZOeRjkKkYMXVzOtLiCMl3rzIgtmWRILf/sjtj92YmmFJENad QDSRy55ku4kY3gGBf4QiAUy47gKgJqgQZSBW+vDV4Mh5yiYolBtBG2VIZ3l+nt2OC4pk ZuVxqFKKXXIxnQyByV7+YAGW4fN1DgSU4s5i8KO+ddRw+B3EzAxx8KKTjjRJpS/vCf4J ISgHOR2g0dyM0w44/KcKNtcWDsIYe1F2hm5V3QIRL4bxC+8QKBdnuX8KDbzF/LS3w7yY 8pY5cu87riBpnNBQJ4SpkaiQyFc8PW5/iAY75IaVRptk1nLVueDJcuaOqzONiZlS8Ly/ Dnaw== X-Gm-Message-State: AFqh2kogLX2v9n17POUlzar59I7UVTHFMo5dGSqEI4XsUTw0lUSETD5z gs5yOXVdlOfNZwDFsVrObhvznFGx5P9s0DHn X-Google-Smtp-Source: AMrXdXuo4m6fRH68Gv3wTjgQmGY0TETXWABcNyklOH66bt+kOw3MwvfrXmvu3U0+WeT7Rk3ZJl93wA== X-Received: by 2002:ac2:5fce:0:b0:4b5:850e:6f4a with SMTP id q14-20020ac25fce000000b004b5850e6f4amr15697082lfg.69.1672878144080; Wed, 04 Jan 2023 16:22:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 16:22:23 -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 1/3] interconnect: qcom: osm-l3: fix icc_onecell_data allocation Date: Thu, 5 Jan 2023 02:22:19 +0200 Message-Id: <20230105002221.1416479-2-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 This is a struct with a trailing zero-length array of icc_node pointers but it's allocated as if it were a single array of icc_nodes instead. Fortunately this overallocates memory rather then allocating less memory than required. Fix by replacing devm_kcalloc() with devm_kzalloc() and struct_size() macro. Fixes: 5bc9900addaf ("interconnect: qcom: Add OSM L3 interconnect provider support") Signed-off-by: Dmitry Baryshkov --- drivers/interconnect/qcom/osm-l3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/osm-l3.c b/drivers/interconnect/qcom/osm-l3.c index 5fa171087425..1bc01ff6e02a 100644 --- a/drivers/interconnect/qcom/osm-l3.c +++ b/drivers/interconnect/qcom/osm-l3.c @@ -236,7 +236,7 @@ static int qcom_osm_l3_probe(struct platform_device *pdev) qnodes = desc->nodes; num_nodes = desc->num_nodes; - data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL); + data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); if (!data) return -ENOMEM; From patchwork Thu Jan 5 00:22:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13089245 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 521AFC54EBD for ; Thu, 5 Jan 2023 00:22:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234393AbjAEAW3 (ORCPT ); Wed, 4 Jan 2023 19:22:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234738AbjAEAW1 (ORCPT ); Wed, 4 Jan 2023 19:22:27 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C9F43A3B for ; Wed, 4 Jan 2023 16:22:26 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id bt23so36218883lfb.5 for ; Wed, 04 Jan 2023 16:22:26 -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=1NMmTiUGV9FdUmug/UYdoZYx4aroDbr73GnE3YCbpaI=; b=aXDWs1rUKThWuSv0XaZges+BWAdi4FGvQ94RQts9a1uldSBdCQd9tn8os0tWrR0zs3 HuPkmFZLFUyjb9C73vyNnjvdA4m2MvI5zRzXh4ETQyileKrSmyXLbzT5ivuxgvom3shz vs5cjCqLcMxOWzHAvWLjBTW54aWgo+l4SSSk+KNcm23AAIbdcvB0YDigGLHahxERaE/S tyHq0i/dJBEeRO+uMiEeW4na3ysFLJUwfnvu4lnAEuSPAKcmblB2690qDppViPmHaQ+i TwoPDYXbJqzK6lNC3+x6/auGesqsNswjUW23v/m+Ral41leWcBUxm3Ka7IJbMrpfswwk zDXw== 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=1NMmTiUGV9FdUmug/UYdoZYx4aroDbr73GnE3YCbpaI=; b=yBqECkFGrmY/dxfAoWyIRs3j1qg1u6sS/V0aWngeTklcFD7tm9cRd+/ly/hCSlwYcj gKOKuqbfW3w66nWGTJ1G/EoESNog7jtp7y0yHgPpcOnGL8epbrhUGeX2yJH00n/eSGR0 taLXg+VuHH3jmUFZPVZeEGXHYGfyQn/CR10mbUDo7AAZxKvQ4rUot9q02n2dD6G7IZ+M YqYAsLw+/P31MrsEr2G2wwZRNsa5EmxD+cRJaoAbkgAIwNFjHlnLVRg7Ngr517wnrB3x SXFLjQlciB+wDb2lMed078NQ6zwXfEg3pGZk5bFLPgZDIvfrb+7nxhHvt7W9x5W3iCj+ AYtA== X-Gm-Message-State: AFqh2kpFHatduG9s28Xr+hd7/VyJ1r0fTLSN8ZAGbxB+ZUkd8c91Jpe+ 7UFeLKossRS3+JWhnpTyn9HymiMAgFmfGhTS X-Google-Smtp-Source: AMrXdXsJqbZdjoEp+2dq+ytY4cwMflOU6RNck2fSP/PIoPEMXt3kw4RFQfbmnajicseYubv2ice4Gg== X-Received: by 2002:a05:6512:3d08:b0:4b5:9b84:2366 with SMTP id d8-20020a0565123d0800b004b59b842366mr15797279lfv.58.1672878145191; Wed, 04 Jan 2023 16:22:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 16:22:24 -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 2/3] interconnect: qcom: sm8450: switch to qcom_icc_rpmh_* function Date: Thu, 5 Jan 2023 02:22:20 +0200 Message-Id: <20230105002221.1416479-3-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 sm8450 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: fafc114a468e ("interconnect: qcom: Add SM8450 interconnect provider driver") Signed-off-by: Dmitry Baryshkov --- drivers/interconnect/qcom/sm8450.c | 98 +----------------------------- 1 file changed, 2 insertions(+), 96 deletions(-) diff --git a/drivers/interconnect/qcom/sm8450.c b/drivers/interconnect/qcom/sm8450.c index e3a12e3d6e06..2d7a8e7b85ec 100644 --- a/drivers/interconnect/qcom/sm8450.c +++ b/drivers/interconnect/qcom/sm8450.c @@ -1844,100 +1844,6 @@ static const struct qcom_icc_desc sm8450_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(&pdev->dev, "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,sm8450-aggre1-noc", .data = &sm8450_aggre1_noc}, @@ -1966,8 +1872,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-sm8450", .of_match_table = qnoc_of_match, 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,