From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AF08C43470 for ; Wed, 12 May 2021 20:13:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E314A60BBB for ; Wed, 12 May 2021 20:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241626AbhELULQ (ORCPT ); Wed, 12 May 2021 16:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352268AbhELSCy (ORCPT ); Wed, 12 May 2021 14:02:54 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97878C061574; Wed, 12 May 2021 11:01:45 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id g4so5577572lfv.6; Wed, 12 May 2021 11:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4mB2Sy8f/RdfyHgUhquFJEEonvYuVEw1zWLlnmUy+Jk=; b=GOeogpmgKqdqij54HrOemUOhcctTu8jcqropTAi1PhgWpwzcfgL8goQkwh5mD9gxmp hGQA18ryam3usNDZXHSpFya5bNAuGEyhEX6kfFgTAI0VK1PLDyWnT4zCS/RK66DSo+8t C1CQHGu5SXCcB+nDeff6NZRrdo6srMq807onM1kI1D8ELXeEKgf7pIjVLbA5jOnHOaF4 ND+I4Rld7sRw1RHPpF2PplJNsa4fZweLnUeZkHxLA/re0OVuO+9mSDuQUbalPW0vpOdo v+PomfqmTPF78ytzL3z6LHjD0LZQUHQNBexCQ3qaEFjrtwcW0gKfYMMSJ9O1ZC5U6QR/ EgCw== 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=4mB2Sy8f/RdfyHgUhquFJEEonvYuVEw1zWLlnmUy+Jk=; b=DvpUW15LXj2HDJxGywdvSlH5KM4dwZenFg/Qbv81hTegyKhc0gHb7JrIrv2O0xCSyt kIhsH4fmJalmR7y/k7GPQxXtTssx52rtwxK0xfo8xjxz0aZl51O1w8n57RN9HlXSOgFd +bCzmFPy9zl8UwL7knu45HHLjEKCrcx5rIQL8t3tG2lR2Rk55LLdHkrqJFcjd/+UTpVd kbPDeiE7/QJKanqeM7HPUr1L913vAmIKOa37whqcz9sckLAWzQjVw+RlBBXJ7tsdZxuq U7HvC1G1NlJhuWqfwXktGg9ccvSDwtfs+7Vi5pCg71EDa3kZc5/yjKnEpgPaDIoagFpD tqrw== X-Gm-Message-State: AOAM531mToVsm+Qggot/c9kAMSTcYQ0rqD7Ecrxs05DN+KZpWIuw+7ni JWbC4/AoZ2RVRFwhXksgofI= X-Google-Smtp-Source: ABdhPJwPZWErJLIGbAnsOEYzbfXRz/LctoJgDaFyC/CSa7AmmSWoglX9vgFF2q4Q7FMy79yiBn+NIg== X-Received: by 2002:a05:6512:402:: with SMTP id u2mr24816582lfk.68.1620842504155; Wed, 12 May 2021 11:01:44 -0700 (PDT) Received: from localhost.localdomain (h-98-128-228-193.NA.cust.bahnhof.se. [98.128.228.193]) by smtp.gmail.com with ESMTPSA id y3sm73772ljj.121.2021.05.12.11.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 11:01:43 -0700 (PDT) From: Rikard Falkeborn To: Linus Walleij Cc: Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Rikard Falkeborn Subject: [PATCH] pinctrl: at91: Constify struct at91_pinctrl_mux_ops Date: Wed, 12 May 2021 20:01:40 +0200 Message-Id: <20210512180140.33293-1-rikard.falkeborn@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The at91_pinctrl_mux_ops struct is never modified by the driver. Make it const wherever it is possible to allow the compiler to put the static variables in read-only memory. Note that sam9x60_ops was already const, but the const was cast away when the return value of of_match_device() was cast to a pointer to a non-const struct at91_pinctrl_mux_ops. Signed-off-by: Rikard Falkeborn --- drivers/pinctrl/pinctrl-at91.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index fc61aaec34cc..72e6df7abe8c 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -42,7 +42,7 @@ struct at91_gpio_chip { int pioc_idx; /* PIO bank index */ void __iomem *regbase; /* PIO bank virtual address */ struct clk *clock; /* associated clock */ - struct at91_pinctrl_mux_ops *ops; /* ops */ + const struct at91_pinctrl_mux_ops *ops; /* ops */ }; static struct at91_gpio_chip *gpio_chips[MAX_GPIO_BANKS]; @@ -210,7 +210,7 @@ struct at91_pinctrl { struct at91_pin_group *groups; int ngroups; - struct at91_pinctrl_mux_ops *ops; + const struct at91_pinctrl_mux_ops *ops; }; static inline const struct at91_pin_group *at91_pinctrl_find_group_by_name( @@ -688,7 +688,7 @@ static void at91_mux_sam9x60_set_slewrate(void __iomem *pio, unsigned pin, writel_relaxed(tmp, pio + SAM9X60_PIO_SLEWR); } -static struct at91_pinctrl_mux_ops at91rm9200_ops = { +static const struct at91_pinctrl_mux_ops at91rm9200_ops = { .get_periph = at91_mux_get_periph, .mux_A_periph = at91_mux_set_A_periph, .mux_B_periph = at91_mux_set_B_periph, @@ -697,7 +697,7 @@ static struct at91_pinctrl_mux_ops at91rm9200_ops = { .irq_type = gpio_irq_type, }; -static struct at91_pinctrl_mux_ops at91sam9x5_ops = { +static const struct at91_pinctrl_mux_ops at91sam9x5_ops = { .get_periph = at91_mux_pio3_get_periph, .mux_A_periph = at91_mux_pio3_set_A_periph, .mux_B_periph = at91_mux_pio3_set_B_periph, @@ -737,7 +737,7 @@ static const struct at91_pinctrl_mux_ops sam9x60_ops = { .irq_type = alt_gpio_irq_type, }; -static struct at91_pinctrl_mux_ops sama5d3_ops = { +static const struct at91_pinctrl_mux_ops sama5d3_ops = { .get_periph = at91_mux_pio3_get_periph, .mux_A_periph = at91_mux_pio3_set_A_periph, .mux_B_periph = at91_mux_pio3_set_B_periph, @@ -1284,7 +1284,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, return -ENODEV; info->dev = &pdev->dev; - info->ops = (struct at91_pinctrl_mux_ops *) + info->ops = (const struct at91_pinctrl_mux_ops *) of_match_device(at91_pinctrl_of_match, &pdev->dev)->data; at91_pinctrl_child_count(info, np); @@ -1849,7 +1849,7 @@ static int at91_gpio_probe(struct platform_device *pdev) goto err; } - at91_chip->ops = (struct at91_pinctrl_mux_ops *) + at91_chip->ops = (const struct at91_pinctrl_mux_ops *) of_match_device(at91_gpio_of_match, &pdev->dev)->data; at91_chip->pioc_virq = irq; at91_chip->pioc_idx = alias_idx; -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3E36C433ED for ; Wed, 12 May 2021 18:04:35 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 140B861625 for ; Wed, 12 May 2021 18:04:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 140B861625 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=f2AFlT+4r2VQ8DxzsHVd0b/6DaJFWqLeeZzKp+IytKk=; b=FLkSPtAduj2aa7AbB15DsVxp1E M/48bx7/VkOuZGBd3E7uZWkfqnwAlh2l0EpO3REyqmnE8yAf57xOEf48zKHMS4OqsEfojljReHLtu jbZh+tD+NGGaShpyr34ddzRix2ew5H59X47QN+XnE43eERKIRQoTconTtzn9Wtm1t/Yro7OJml0gI utMvXk1npwsT3YIqDwW34dO2Rb/egn10BM8Yz7AVo+Ri0LbX1Be0QvAMJZfZiUbhiTQiWvR1L+eoE 0jv+/ZS4/DG+/vLw4CcizQGOmxNIz5vc/1tGAgC9cWmdC6WvuBAEouIoLSh2eq/wlHPnufuxZIHLF 8Sg0Jv5Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgtBK-003VYi-Qb; Wed, 12 May 2021 18:02:03 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgtB7-003VV5-6T for linux-arm-kernel@desiato.infradead.org; Wed, 12 May 2021 18:01:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=4mB2Sy8f/RdfyHgUhquFJEEonvYuVEw1zWLlnmUy+Jk=; b=b9qR0KKySvwH+W2hhzAeTo25oX 1vg6k61lIL2icxTZgLU2oaxzlOCOb0TYetJxxS6UhbsoAlV52hCK+qzp55x4A6rJmgigA/R1+3jJF uwW48scFxafu1rNxvTOHFTIcnncd5dOOdUxwItAWT04f1g3BKPoG2amQFkKRnzomPfYpRCg8T9bb0 8YkKBtjDQ3qrhwJYvPXNZz3yOKt3rVJSWDLr2U4Ugt7QqcrVlF18D1e5Z5AcPfMA+V9jLLHx9W1qr F54BQ6hBiJVIsxped9zldFdVxImc/AIFeD56IAHJrzAyZ4DsVA9vFCSFVHyk4mnSTMtfhLQnIEtlC ldSv3huQ==; Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgtB4-00Afko-EV for linux-arm-kernel@lists.infradead.org; Wed, 12 May 2021 18:01:48 +0000 Received: by mail-lf1-x130.google.com with SMTP id x19so35019187lfa.2 for ; Wed, 12 May 2021 11:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4mB2Sy8f/RdfyHgUhquFJEEonvYuVEw1zWLlnmUy+Jk=; b=GOeogpmgKqdqij54HrOemUOhcctTu8jcqropTAi1PhgWpwzcfgL8goQkwh5mD9gxmp hGQA18ryam3usNDZXHSpFya5bNAuGEyhEX6kfFgTAI0VK1PLDyWnT4zCS/RK66DSo+8t C1CQHGu5SXCcB+nDeff6NZRrdo6srMq807onM1kI1D8ELXeEKgf7pIjVLbA5jOnHOaF4 ND+I4Rld7sRw1RHPpF2PplJNsa4fZweLnUeZkHxLA/re0OVuO+9mSDuQUbalPW0vpOdo v+PomfqmTPF78ytzL3z6LHjD0LZQUHQNBexCQ3qaEFjrtwcW0gKfYMMSJ9O1ZC5U6QR/ EgCw== 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=4mB2Sy8f/RdfyHgUhquFJEEonvYuVEw1zWLlnmUy+Jk=; b=AwCN26mgv4fcIPH0nfLif7go7hNtkAXLAyxRmGyVedKrn2INZRkKw8Acc7APAyg3s1 Yu/6IVHW5Q3vCXUJPfGpumUzqFKYl0D0JSdNlTYOpUFfw7pJFbMv/6coW9q9+mMOYG4Y SjpcE6gLlwrYUHQz0VqGK0RDGA6EwQ9pl/YlJvEwS2inbQhFDEuN/lT7Iee1Q3Hve29Z ApVgHcUWcr+q6Pkw1P8+68nyBM6MlqaEdcmxAQ/zGTIkSb0wJNiHEE9yggmNTOhG56oX E8Y0aL0UheZOFMFLuCu+NH1IZZoueWjMenHiwyd3DlIJxvsaoW/sCv3lJE/bqg9Oa2Gm QpYA== X-Gm-Message-State: AOAM5338TDdwpAEDk1lUN7wwGNrVGcJE/FZJ51f0c5tjRJabM0uYVuOC xs4kmt0IGbRPwUv5W4YmHDU= X-Google-Smtp-Source: ABdhPJwPZWErJLIGbAnsOEYzbfXRz/LctoJgDaFyC/CSa7AmmSWoglX9vgFF2q4Q7FMy79yiBn+NIg== X-Received: by 2002:a05:6512:402:: with SMTP id u2mr24816582lfk.68.1620842504155; Wed, 12 May 2021 11:01:44 -0700 (PDT) Received: from localhost.localdomain (h-98-128-228-193.NA.cust.bahnhof.se. [98.128.228.193]) by smtp.gmail.com with ESMTPSA id y3sm73772ljj.121.2021.05.12.11.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 11:01:43 -0700 (PDT) From: Rikard Falkeborn To: Linus Walleij Subject: [PATCH] pinctrl: at91: Constify struct at91_pinctrl_mux_ops Date: Wed, 12 May 2021 20:01:40 +0200 Message-Id: <20210512180140.33293-1-rikard.falkeborn@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-20210512_110146_512201_1341D395 X-CRM114-Status: GOOD ( 16.81 ) 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: , Cc: Alexandre Belloni , Rikard Falkeborn , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Ludovic Desroches , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The at91_pinctrl_mux_ops struct is never modified by the driver. Make it const wherever it is possible to allow the compiler to put the static variables in read-only memory. Note that sam9x60_ops was already const, but the const was cast away when the return value of of_match_device() was cast to a pointer to a non-const struct at91_pinctrl_mux_ops. Signed-off-by: Rikard Falkeborn --- drivers/pinctrl/pinctrl-at91.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index fc61aaec34cc..72e6df7abe8c 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -42,7 +42,7 @@ struct at91_gpio_chip { int pioc_idx; /* PIO bank index */ void __iomem *regbase; /* PIO bank virtual address */ struct clk *clock; /* associated clock */ - struct at91_pinctrl_mux_ops *ops; /* ops */ + const struct at91_pinctrl_mux_ops *ops; /* ops */ }; static struct at91_gpio_chip *gpio_chips[MAX_GPIO_BANKS]; @@ -210,7 +210,7 @@ struct at91_pinctrl { struct at91_pin_group *groups; int ngroups; - struct at91_pinctrl_mux_ops *ops; + const struct at91_pinctrl_mux_ops *ops; }; static inline const struct at91_pin_group *at91_pinctrl_find_group_by_name( @@ -688,7 +688,7 @@ static void at91_mux_sam9x60_set_slewrate(void __iomem *pio, unsigned pin, writel_relaxed(tmp, pio + SAM9X60_PIO_SLEWR); } -static struct at91_pinctrl_mux_ops at91rm9200_ops = { +static const struct at91_pinctrl_mux_ops at91rm9200_ops = { .get_periph = at91_mux_get_periph, .mux_A_periph = at91_mux_set_A_periph, .mux_B_periph = at91_mux_set_B_periph, @@ -697,7 +697,7 @@ static struct at91_pinctrl_mux_ops at91rm9200_ops = { .irq_type = gpio_irq_type, }; -static struct at91_pinctrl_mux_ops at91sam9x5_ops = { +static const struct at91_pinctrl_mux_ops at91sam9x5_ops = { .get_periph = at91_mux_pio3_get_periph, .mux_A_periph = at91_mux_pio3_set_A_periph, .mux_B_periph = at91_mux_pio3_set_B_periph, @@ -737,7 +737,7 @@ static const struct at91_pinctrl_mux_ops sam9x60_ops = { .irq_type = alt_gpio_irq_type, }; -static struct at91_pinctrl_mux_ops sama5d3_ops = { +static const struct at91_pinctrl_mux_ops sama5d3_ops = { .get_periph = at91_mux_pio3_get_periph, .mux_A_periph = at91_mux_pio3_set_A_periph, .mux_B_periph = at91_mux_pio3_set_B_periph, @@ -1284,7 +1284,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, return -ENODEV; info->dev = &pdev->dev; - info->ops = (struct at91_pinctrl_mux_ops *) + info->ops = (const struct at91_pinctrl_mux_ops *) of_match_device(at91_pinctrl_of_match, &pdev->dev)->data; at91_pinctrl_child_count(info, np); @@ -1849,7 +1849,7 @@ static int at91_gpio_probe(struct platform_device *pdev) goto err; } - at91_chip->ops = (struct at91_pinctrl_mux_ops *) + at91_chip->ops = (const struct at91_pinctrl_mux_ops *) of_match_device(at91_gpio_of_match, &pdev->dev)->data; at91_chip->pioc_virq = irq; at91_chip->pioc_idx = alias_idx; -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel