Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2368342pxk; Mon, 14 Sep 2020 11:23:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHcGqHZ6h9uOzIie1M3q/vltYYcmXzdu8LXe3KY2oxf4EP4CKFeYVW5x03qjyo0sD7UIVP X-Received: by 2002:a17:906:8c1:: with SMTP id o1mr16550761eje.478.1600107801564; Mon, 14 Sep 2020 11:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600107801; cv=none; d=google.com; s=arc-20160816; b=nATfGfViXZOWZvf3BF/GJrRFL4EbqSAjl4UOPgahYSlVaEvBTugLwlhqZ/3bmkn5E+ oxVQ2YNir/PAOGbN0INJpadgAuWBwtSxcjImk/iuChWt6Bs/B7HS67NAZQEvX2L9VSDy kBo6+StjVISp8ol1l4MrRTK80uMl/d0pt+IiD4EcjQcVBzJ9iuGmfhRj+UmmviShp1og E6aIQon4uKiXS6x2xMp8t++E66LTlMKDJAG4TRhmsQdSAsIXNH9eJRZWvQfgAVHdgcqk D3XpeQF/rhBSlQ1gLQw1ynrixXo/RILOUlg9y/Pg5G8xVeLi0IabyM+zVChZwbwQ48vl 1skA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=bxVplJc+j25YZx49J1PHku+gqhyQgloCcvrgKIa9smQ=; b=B77hjMB2db+3wrrXfYaMHepl58ap2t0DFyXNanGufIwB3JXBPpEf6i4+3nrE4pG2Y8 qasyJy+ZG8nrqJd+E8HhL0wHpjVU0ELhGln4fMDKhgIDARttUjA7k35ohcY8EiKbaaw3 OsaegJR5A9RGBZNluGpCJreKrPaf2+Am7jyu1DXmPen/5+TYCXmWGEnd3tfLfbdcE/q1 KSlcNwzM3C5z/+DDzmHd+m3MoSmjnJeKVgljmoXpnHpYDrr5wBvZznchBEkPlo2o5m8k BFViHwA9lc+9yiHqgpoG7RDQtEpzRa+tjESDemob4Ea+Zf6bZQjEA9JOpzrUFE4bMRyq gNzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="ehB3c/w6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bh20si7198753ejb.294.2020.09.14.11.22.57; Mon, 14 Sep 2020 11:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="ehB3c/w6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726076AbgINSV5 (ORCPT + 99 others); Mon, 14 Sep 2020 14:21:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbgINSVO (ORCPT ); Mon, 14 Sep 2020 14:21:14 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 309C8C06178A for ; Mon, 14 Sep 2020 11:21:14 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id d13so467034pgl.6 for ; Mon, 14 Sep 2020 11:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bxVplJc+j25YZx49J1PHku+gqhyQgloCcvrgKIa9smQ=; b=ehB3c/w6zP/NpUxCCiuSzpbu4ddmh0c+zKwmHa8epMH9PFohzaiLQn5gJcfMIIHgpm PP12eR66FqNtJ37qJAHsLrXdvSPlWmlhtr3KMofZk/2S87HjYW0qSdOnYqYWYPSIYSp8 BVuh2ZmJ1BYfXjgSmqxDr4T8FgLMkNNeLHoQY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bxVplJc+j25YZx49J1PHku+gqhyQgloCcvrgKIa9smQ=; b=OaLBpRAdBxSpdg4/5wm8xB1lb5A5Ros+bsjJCPceNZMIX/THVuCYU1WNtGba2KydNc xQfsl/KPmtBL2dTYJgFzIrji+eiThXAHmOljSy+wHLEQMrt7Xjf50Ni3VobsM9LnTvKz koQ4SUDY8lHO1Yz6hTwlkx+C12OWeFMSDCLyqF5WIl9sfbTs92jDHi+dqKpWrOxwhLQK SeACj7BJnqtSKpzz9DD+D5RImWsGFzDajpKmdKVueRCqrjQIMiAZ2OxySNsXwYbXEpXF L6k2VUiH4fcQQwZOjunlR4oJPR4o29IXGGtpDwc45v5ZeEhF3iRlOAt9+jA16jT/P8Og 4rpg== X-Gm-Message-State: AOAM531sLiUcNuT3rh3UESkCSxrbjvLzH3egdELtygTvd+xfUEjS+aP+ Het9jKjtzKAKq8zJ7Sfir6t0xw== X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr15331929plp.151.1600107673438; Mon, 14 Sep 2020 11:21:13 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id m21sm10857065pfo.13.2020.09.14.11.21.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 11:21:12 -0700 (PDT) From: Stephen Boyd To: Georgi Djakov Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Bjorn Andersson , Sibi Sankar , Evan Green Subject: [PATCH] interconnect: qcom: osm-l3: Mark more structures const Date: Mon, 14 Sep 2020 11:21:12 -0700 Message-Id: <20200914182112.513981-1-swboyd@chromium.org> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These structures aren't modified at runtime. Mark them const so they get moved to read-only memory. We have to cast away const in one place when we store into the data member of struct icc_node. This is paired with a re-const of the data member when it is extracted in qcom_icc_set(). Cc: Sibi Sankar Cc: Evan Green Signed-off-by: Stephen Boyd --- drivers/interconnect/qcom/osm-l3.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/interconnect/qcom/osm-l3.c b/drivers/interconnect/qcom/osm-l3.c index 96fb9ff5ff2e..ba2ee6683a82 100644 --- a/drivers/interconnect/qcom/osm-l3.c +++ b/drivers/interconnect/qcom/osm-l3.c @@ -57,12 +57,12 @@ struct qcom_icc_node { }; struct qcom_icc_desc { - struct qcom_icc_node **nodes; + const struct qcom_icc_node **nodes; size_t num_nodes; }; #define DEFINE_QNODE(_name, _id, _buswidth, ...) \ - static struct qcom_icc_node _name = { \ + static const struct qcom_icc_node _name = { \ .name = #_name, \ .id = _id, \ .buswidth = _buswidth, \ @@ -73,7 +73,7 @@ struct qcom_icc_desc { DEFINE_QNODE(sdm845_osm_apps_l3, SDM845_MASTER_OSM_L3_APPS, 16, SDM845_SLAVE_OSM_L3); DEFINE_QNODE(sdm845_osm_l3, SDM845_SLAVE_OSM_L3, 16); -static struct qcom_icc_node *sdm845_osm_l3_nodes[] = { +static const struct qcom_icc_node *sdm845_osm_l3_nodes[] = { [MASTER_OSM_L3_APPS] = &sdm845_osm_apps_l3, [SLAVE_OSM_L3] = &sdm845_osm_l3, }; @@ -86,7 +86,7 @@ static const struct qcom_icc_desc sdm845_icc_osm_l3 = { DEFINE_QNODE(sc7180_osm_apps_l3, SC7180_MASTER_OSM_L3_APPS, 16, SC7180_SLAVE_OSM_L3); DEFINE_QNODE(sc7180_osm_l3, SC7180_SLAVE_OSM_L3, 16); -static struct qcom_icc_node *sc7180_osm_l3_nodes[] = { +static const struct qcom_icc_node *sc7180_osm_l3_nodes[] = { [MASTER_OSM_L3_APPS] = &sc7180_osm_apps_l3, [SLAVE_OSM_L3] = &sc7180_osm_l3, }; @@ -100,7 +100,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) { struct qcom_osm_l3_icc_provider *qp; struct icc_provider *provider; - struct qcom_icc_node *qn; + const struct qcom_icc_node *qn; struct icc_node *n; unsigned int index; u32 agg_peak = 0; @@ -145,7 +145,7 @@ static int qcom_osm_l3_probe(struct platform_device *pdev) const struct qcom_icc_desc *desc; struct icc_onecell_data *data; struct icc_provider *provider; - struct qcom_icc_node **qnodes; + const struct qcom_icc_node **qnodes; struct icc_node *node; size_t num_nodes; struct clk *clk; @@ -235,7 +235,8 @@ static int qcom_osm_l3_probe(struct platform_device *pdev) } node->name = qnodes[i]->name; - node->data = qnodes[i]; + /* Cast away const and add it back in qcom_icc_set() */ + node->data = (void *)qnodes[i]; icc_node_add(node, provider); for (j = 0; j < qnodes[i]->num_links; j++) -- Sent by a computer, using git, on the internet