From patchwork Thu Dec 16 16:22:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 12696508 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58980C433EF for ; Thu, 16 Dec 2021 16:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KKrQ8vfWTHPpB+zJrrm5KEkxgmwOqrgchITiR10lF3Y=; b=iMOtyJzzrQBSWU J4JEjGPaHlm0xdYB31mfzIw18sxedrg+6RZRZfUIuYLWTyFTLtPLpxxry3Qz6DiHZTffe0i0blgBu Jhke5iZTUmyZu2FW+kVaDsSB8UA8FblAqDZxQ7r0Vg4yCu/AuzZd+h+YHGOgDK6oXnosmAXP70Tua QrmdX1FEI+MQB/W7AGH4Loa6fnsrZcUPGKf+ukWCgsKwh9PsJwEvxbz/T15S7p2vCZmPVkoAMtYOy vvfxxvdsq8S/kUVu0M1NT9Wf2Mp2GibGkcMibH8FZ5nhQupvqwGQn5FwBhw5Mr7TMNoq4xf2lnSip okV8fB6BV3O3OCpKAKow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxtgU-006dZF-F6; Thu, 16 Dec 2021 16:32:48 +0000 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxtWI-006aER-Pg for linux-arm-kernel@lists.infradead.org; Thu, 16 Dec 2021 16:22:16 +0000 Received: by mail-lj1-x22f.google.com with SMTP id v15so39408033ljc.0 for ; Thu, 16 Dec 2021 08:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4lWtkWUkkW3ND3RjcGaqJdo8TrrjuOiBcKkAeDb9fTo=; b=X19CCWSHn+YUHSaTyIW1WkzS0qn/tl30Lmbqg5N7OydTWstDVDYHDH22bqmTE4S4Rk 5U0jsh8xNoewi0aeZ8t3LbOALo5ol45GHayFSqWcgvO1q1p2zXwHxD79ClnJPmlDPMgQ 0TJ/LQ3mKJTaWy/tNmXDdGCaQvRNE0rAYzxPav3wRBLSnUZh9s7/vvMp26kTog9mQql/ oexJaqt8KdTpN2iRmXEbWgA4ij/rjeDjSRYz/tRgvFYA60JLCiWfmrBGvfbfWdIZHNJ1 No6qAASzU1mJZZL2Pf90U0jWc1fI/1S/ohuiwXZG+boKRlTTZMBsniLW5n+Nz+1y1zi2 IVsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4lWtkWUkkW3ND3RjcGaqJdo8TrrjuOiBcKkAeDb9fTo=; b=BgxDK+eTlIfQuVEZhIJtOHi/qs9eJ2Y5NKC2mQzRob3SeoKsJnJ9tc0ggpQE9GX401 9uPQwfu0I5jYni/P68sWMpWNdu4c+CTEqWku3wgHa6ZPRtb9NksdTtcsuHnvt6wXfTrS FyprN6t6COTGnebMDaPTr2m9vr5W1BtFAbnmIFSkGotQd8874jCgQWBg3VyGQ98+MVTM 6rekV7YnV8hzAWFnNRGPqX6DwKE274nJhHdkMRYEU8s1EPV7Tz/67WYBgreft3WSLkdl NDZfetFCFlADP/0jQTPD0t2xj2ZORswY4n2jpcmfKzhHWFJkGphlCLnb3TjpeeFHKebZ sn/A== X-Gm-Message-State: AOAM5316pSKNgrvCBWQM2ZiJEtiuhAAqIxt57VeE4+FoojUFq7d5U6Mu oV+rHMCkkPMosLsHLXz3AJI= X-Google-Smtp-Source: ABdhPJw7w293M7f00o/g7bhxbJz0jq9qzwJ29MYFqBPAHxUkJMWnG8RqduvBa2CVLAnpR9T+cSbrfQ== X-Received: by 2002:a2e:8502:: with SMTP id j2mr16129822lji.191.1639671732555; Thu, 16 Dec 2021 08:22:12 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id s13sm938623lfg.126.2021.12.16.08.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 08:22:12 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Linus Walleij Cc: Dong Aisheng , Fabio Estevam , Shawn Guo , Stefan Agner , Pengutronix Kernel Team , Sascha Hauer , NXP Linux Team , Lakshmi Sowjanya D , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 1/4] pinctrl: imx: prepare for making "group_names" in "function_desc" const Date: Thu, 16 Dec 2021 17:22:03 +0100 Message-Id: <20211216162206.8027-1-zajec5@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211216_082214_885403_E47BF72D X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rafał Miłecki The plan for "struct function_desc" is to make its "group_names" /double/ const. That will allow drivers to use it with static const data. This imx change is required to avoid: drivers/pinctrl/freescale/pinctrl-imx.c: In function 'imx_pinctrl_parse_functions': drivers/pinctrl/freescale/pinctrl-imx.c:672:24: error: assignment of read-only location '*(func->group_names + (sizetype)(i * 4))' 672 | func->group_names[i] = child->name; | ^ Signed-off-by: Rafał Miłecki --- drivers/pinctrl/freescale/pinctrl-imx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index daf28bc5661d..47b2ab1a14d0 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -648,6 +648,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np, struct device_node *child; struct function_desc *func; struct group_desc *grp; + const char **group_names; u32 i = 0; dev_dbg(pctl->dev, "parse function(%d): %pOFn\n", index, np); @@ -663,14 +664,16 @@ static int imx_pinctrl_parse_functions(struct device_node *np, dev_err(ipctl->dev, "no groups defined in %pOF\n", np); return -EINVAL; } - func->group_names = devm_kcalloc(ipctl->dev, func->num_group_names, - sizeof(char *), GFP_KERNEL); + + group_names = devm_kcalloc(ipctl->dev, func->num_group_names, + sizeof(char *), GFP_KERNEL); if (!func->group_names) return -ENOMEM; + for_each_child_of_node(np, child) + group_names[i] = child->name; + func->group_names = group_names; for_each_child_of_node(np, child) { - func->group_names[i] = child->name; - grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc), GFP_KERNEL); if (!grp) {