linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: Lior Dotan <liodot@gmail.com>
Cc: kernel-janitors@vger.kernel.org,
	Christopher Harrer <charrer@alacritech.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] staging: slicoss: constify ethtool_ops structures
Date: Wed, 31 Aug 2016 09:30:43 +0200	[thread overview]
Message-ID: <1472628648-3603-2-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/staging/slicoss/slicoss.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 7834bda..21280a3 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -124,7 +124,7 @@ static const struct pci_device_id slic_pci_tbl[] = {
 	{ 0 }
 };
 
-static struct ethtool_ops slic_ethtool_ops;
+static const struct ethtool_ops slic_ethtool_ops;
 
 MODULE_DEVICE_TABLE(pci, slic_pci_tbl);
 
@@ -3128,7 +3128,7 @@ static void __exit slic_module_cleanup(void)
 	pci_unregister_driver(&slic_driver);
 }
 
-static struct ethtool_ops slic_ethtool_ops = {
+static const struct ethtool_ops slic_ethtool_ops = {
 	.get_coalesce = slic_get_coalesce,
 	.set_coalesce = slic_set_coalesce
 };

  reply	other threads:[~2016-08-31  7:50 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 ` Julia Lawall [this message]
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 ` [PATCH 3/6] net: bcmgenet: " Julia Lawall
2016-08-31 17:08   ` 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-2-git-send-email-Julia.Lawall@lip6.fr \
    --to=julia.lawall@lip6.fr \
    --cc=charrer@alacritech.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liodot@gmail.com \
    /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).