From patchwork Sun Sep 11 13:06:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 9325249 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BF4E96077F for ; Sun, 11 Sep 2016 13:28:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2EA728407 for ; Sun, 11 Sep 2016 13:28:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A788A28665; Sun, 11 Sep 2016 13:28:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8202428407 for ; Sun, 11 Sep 2016 13:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756576AbcIKN2H (ORCPT ); Sun, 11 Sep 2016 09:28:07 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:11441 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932322AbcIKN0c (ORCPT ); Sun, 11 Sep 2016 09:26:32 -0400 X-IronPort-AV: E=Sophos;i="5.30,317,1470693600"; d="scan'208";a="236011221" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 11 Sep 2016 15:24:16 +0200 From: Julia Lawall To: Sergei Shtylyov Cc: joe@perches.com, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 23/26] sh_eth: constify local structures Date: Sun, 11 Sep 2016 15:06:05 +0200 Message-Id: <1473599168-30561-24-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473599168-30561-1-git-send-email-Julia.Lawall@lip6.fr> References: <1473599168-30561-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For structure types defined in the same file or local header files, find top-level static structure declarations that have the following properties: 1. Never reassigned. 2. Address never taken 3. Not passed to a top-level macro call 4. No pointer or array-typed field passed to a function or stored in a variable. Declare structures having all of these properties as const. Done using Coccinelle. Based on a suggestion by Joe Perches . Signed-off-by: Julia Lawall --- The semantic patch seems too long for a commit log, but is in the cover letter. drivers/net/ethernet/renesas/sh_eth.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 1f8240a..d2ed57f 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -654,7 +654,7 @@ static void sh_eth_set_rate_sh7724(struct net_device *ndev) } /* SH7724 */ -static struct sh_eth_cpu_data sh7724_data = { +static const struct sh_eth_cpu_data sh7724_data = { .set_duplex = sh_eth_set_duplex, .set_rate = sh_eth_set_rate_sh7724, @@ -692,7 +692,7 @@ static void sh_eth_set_rate_sh7757(struct net_device *ndev) } /* SH7757 */ -static struct sh_eth_cpu_data sh7757_data = { +static const struct sh_eth_cpu_data sh7757_data = { .set_duplex = sh_eth_set_duplex, .set_rate = sh_eth_set_rate_sh7757, @@ -757,7 +757,7 @@ static void sh_eth_set_rate_giga(struct net_device *ndev) } /* SH7757(GETHERC) */ -static struct sh_eth_cpu_data sh7757_data_giga = { +static const struct sh_eth_cpu_data sh7757_data_giga = { .chip_reset = sh_eth_chip_reset_giga, .set_duplex = sh_eth_set_duplex, .set_rate = sh_eth_set_rate_giga, @@ -788,7 +788,7 @@ static struct sh_eth_cpu_data sh7757_data_giga = { }; /* SH7734 */ -static struct sh_eth_cpu_data sh7734_data = { +static const struct sh_eth_cpu_data sh7734_data = { .chip_reset = sh_eth_chip_reset, .set_duplex = sh_eth_set_duplex, .set_rate = sh_eth_set_rate_gether, @@ -817,7 +817,7 @@ static struct sh_eth_cpu_data sh7734_data = { }; /* SH7763 */ -static struct sh_eth_cpu_data sh7763_data = { +static const struct sh_eth_cpu_data sh7763_data = { .chip_reset = sh_eth_chip_reset, .set_duplex = sh_eth_set_duplex, .set_rate = sh_eth_set_rate_gether, @@ -844,7 +844,7 @@ static struct sh_eth_cpu_data sh7763_data = { .irq_flags = IRQF_SHARED, }; -static struct sh_eth_cpu_data sh7619_data = { +static const struct sh_eth_cpu_data sh7619_data = { .register_type = SH_ETH_REG_FAST_SH3_SH2, .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, @@ -855,7 +855,7 @@ static struct sh_eth_cpu_data sh7619_data = { .hw_swap = 1, }; -static struct sh_eth_cpu_data sh771x_data = { +static const struct sh_eth_cpu_data sh771x_data = { .register_type = SH_ETH_REG_FAST_SH3_SH2, .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,