From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: kernel-janitors@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] net: bcmgenet: constify ethtool_ops structures
Date: Wed, 31 Aug 2016 09:30:45 +0200 [thread overview]
Message-ID: <1472628648-3603-4-git-send-email-Julia.Lawall@lip6.fr> (raw)
In-Reply-To: <1472628648-3603-1-git-send-email-Julia.Lawall@lip6.fr>
Check for ethtool_ops structures that are only stored in the ethtool_ops
field of a net_device structure or passed as the second argument to
netdev_set_default_ethtool_ops. These contexts are declared const, so
ethtool_ops structures that have these properties can be declared as const
also.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct ethtool_ops i@p = { ... };
@ok1@
identifier r.i;
struct net_device e;
position p;
@@
e.ethtool_ops = &i@p;
@ok2@
identifier r.i;
expression e;
position p;
@@
netdev_set_default_ethtool_ops(e, &i@p)
@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct ethtool_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 8d4f849..46f9043 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -973,7 +973,7 @@ static int bcmgenet_nway_reset(struct net_device *dev)
}
/* standard ethtool support functions. */
-static struct ethtool_ops bcmgenet_ethtool_ops = {
+static const struct ethtool_ops bcmgenet_ethtool_ops = {
.get_strings = bcmgenet_get_strings,
.get_sset_count = bcmgenet_get_sset_count,
.get_ethtool_stats = bcmgenet_get_ethtool_stats,
next prev parent reply other threads:[~2016-08-31 7:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 7:30 [PATCH 0/6] constify ethtool_ops structures Julia Lawall
2016-08-31 7:30 ` [PATCH 1/6] staging: slicoss: " Julia Lawall
2016-08-31 7:30 ` [PATCH 2/6] net: ethernet: et131x: " Julia Lawall
2016-08-31 11:48 ` Mark Einon
2016-08-31 7:30 ` Julia Lawall [this message]
2016-08-31 17:08 ` [PATCH 3/6] net: bcmgenet: " Florian Fainelli
2016-08-31 7:30 ` [PATCH 4/6] net: hisilicon: " Julia Lawall
2016-08-31 7:30 ` [PATCH 5/6] dwc_eth_qos: " Julia Lawall
2016-08-31 7:30 ` [PATCH 6/6] net: systemport: " Julia Lawall
2016-08-31 17:08 ` Florian Fainelli
2016-08-31 15:39 ` [PATCH 0/6] " Stephen Hemminger
2016-08-31 19:40 ` Julia Lawall
2016-08-31 16:22 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472628648-3603-4-git-send-email-Julia.Lawall@lip6.fr \
--to=julia.lawall@lip6.fr \
--cc=f.fainelli@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).