All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31  7:30 ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: devel; +Cc: kernel-janitors, linux-kernel, netdev

Constify ethtool_ops structures.

---

 drivers/net/ethernet/agere/et131x.c              |    2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c       |    2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c   |    2 +-
 drivers/net/ethernet/hisilicon/hip04_eth.c       |    2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
 drivers/net/ethernet/synopsys/dwc_eth_qos.c      |    2 +-
 drivers/staging/slicoss/slicoss.c                |    4 ++--
 9 files changed, 10 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31  7:30 ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: devel; +Cc: netdev, kernel-janitors, linux-kernel

Constify ethtool_ops structures.

---

 drivers/net/ethernet/agere/et131x.c              |    2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c       |    2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c   |    2 +-
 drivers/net/ethernet/hisilicon/hip04_eth.c       |    2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
 drivers/net/ethernet/synopsys/dwc_eth_qos.c      |    2 +-
 drivers/staging/slicoss/slicoss.c                |    4 ++--
 9 files changed, 10 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31  7:30 ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: devel; +Cc: kernel-janitors, linux-kernel, netdev

Constify ethtool_ops structures.

---

 drivers/net/ethernet/agere/et131x.c              |    2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c       |    2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c   |    2 +-
 drivers/net/ethernet/hisilicon/hip04_eth.c       |    2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
 drivers/net/ethernet/synopsys/dwc_eth_qos.c      |    2 +-
 drivers/staging/slicoss/slicoss.c                |    4 ++--
 9 files changed, 10 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 1/6] staging: slicoss: constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
@ 2016-08-31  7:30   ` Julia Lawall
  -1 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Lior Dotan
  Cc: kernel-janitors, Christopher Harrer, Greg Kroah-Hartman, devel,
	linux-kernel

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
 };

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 1/6] staging: slicoss: constify ethtool_ops structures
@ 2016-08-31  7:30   ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Lior Dotan
  Cc: kernel-janitors, Christopher Harrer, Greg Kroah-Hartman, devel,
	linux-kernel

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
 };


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/6] net: ethernet: et131x: constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
@ 2016-08-31  7:30   ` Julia Lawall
  -1 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Mark Einon; +Cc: kernel-janitors, netdev, linux-kernel

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/agere/et131x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index c83ebae..9066838 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -2961,7 +2961,7 @@ static void et131x_get_drvinfo(struct net_device *netdev,
 		sizeof(info->bus_info));
 }
 
-static struct ethtool_ops et131x_ethtool_ops = {
+static const struct ethtool_ops et131x_ethtool_ops = {
 	.get_drvinfo	= et131x_get_drvinfo,
 	.get_regs_len	= et131x_get_regs_len,
 	.get_regs	= et131x_get_regs,

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/6] net: ethernet: et131x: constify ethtool_ops structures
@ 2016-08-31  7:30   ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Mark Einon; +Cc: kernel-janitors, netdev, linux-kernel

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/agere/et131x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index c83ebae..9066838 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -2961,7 +2961,7 @@ static void et131x_get_drvinfo(struct net_device *netdev,
 		sizeof(info->bus_info));
 }
 
-static struct ethtool_ops et131x_ethtool_ops = {
+static const struct ethtool_ops et131x_ethtool_ops = {
 	.get_drvinfo	= et131x_get_drvinfo,
 	.get_regs_len	= et131x_get_regs_len,
 	.get_regs	= et131x_get_regs,


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/6] net: bcmgenet: constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
@ 2016-08-31  7:30   ` Julia Lawall
  -1 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: kernel-janitors, netdev, linux-kernel

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,

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/6] net: bcmgenet: constify ethtool_ops structures
@ 2016-08-31  7:30   ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: kernel-janitors, netdev, linux-kernel

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,


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/6] net: hisilicon: constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
@ 2016-08-31  7:30   ` Julia Lawall
  -1 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Yisen Zhuang; +Cc: kernel-janitors, Salil Mehta, netdev, linux-kernel

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/hisilicon/hip04_eth.c       |    2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 0c4afe9..a90ab40 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -755,7 +755,7 @@ static void hip04_get_drvinfo(struct net_device *netdev,
 	strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
 }
 
-static struct ethtool_ops hip04_ethtool_ops = {
+static const struct ethtool_ops hip04_ethtool_ops = {
 	.get_coalesce		= hip04_get_coalesce,
 	.set_coalesce		= hip04_set_coalesce,
 	.get_drvinfo		= hip04_get_drvinfo,
diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
index b5d7ad0..ca68e22 100644
--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
@@ -699,7 +699,7 @@ static int hisi_femac_net_ioctl(struct net_device *dev,
 	return phy_mii_ioctl(dev->phydev, ifreq, cmd);
 }
 
-static struct ethtool_ops hisi_femac_ethtools_ops = {
+static const struct ethtool_ops hisi_femac_ethtools_ops = {
 	.get_link		= ethtool_op_get_link,
 	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
 	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index 275618b..e69a6be 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -750,7 +750,7 @@ static const struct net_device_ops hix5hd2_netdev_ops = {
 	.ndo_set_mac_address	= hix5hd2_net_set_mac_address,
 };
 
-static struct ethtool_ops hix5hd2_ethtools_ops = {
+static const struct ethtool_ops hix5hd2_ethtools_ops = {
 	.get_link		= ethtool_op_get_link,
 	.get_link_ksettings     = phy_ethtool_get_link_ksettings,
 	.set_link_ksettings     = phy_ethtool_set_link_ksettings,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index ab33487..5eb3245 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -1264,7 +1264,7 @@ static int hns_get_rxnfc(struct net_device *netdev,
 	return 0;
 }
 
-static struct ethtool_ops hns_ethtool_ops = {
+static const struct ethtool_ops hns_ethtool_ops = {
 	.get_drvinfo = hns_nic_get_drvinfo,
 	.get_link  = hns_nic_get_link,
 	.get_settings  = hns_nic_get_settings,

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/6] net: hisilicon: constify ethtool_ops structures
@ 2016-08-31  7:30   ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Yisen Zhuang; +Cc: kernel-janitors, Salil Mehta, netdev, linux-kernel

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/hisilicon/hip04_eth.c       |    2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 0c4afe9..a90ab40 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -755,7 +755,7 @@ static void hip04_get_drvinfo(struct net_device *netdev,
 	strlcpy(drvinfo->version, DRV_VERSION, sizeof(drvinfo->version));
 }
 
-static struct ethtool_ops hip04_ethtool_ops = {
+static const struct ethtool_ops hip04_ethtool_ops = {
 	.get_coalesce		= hip04_get_coalesce,
 	.set_coalesce		= hip04_set_coalesce,
 	.get_drvinfo		= hip04_get_drvinfo,
diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
index b5d7ad0..ca68e22 100644
--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
@@ -699,7 +699,7 @@ static int hisi_femac_net_ioctl(struct net_device *dev,
 	return phy_mii_ioctl(dev->phydev, ifreq, cmd);
 }
 
-static struct ethtool_ops hisi_femac_ethtools_ops = {
+static const struct ethtool_ops hisi_femac_ethtools_ops = {
 	.get_link		= ethtool_op_get_link,
 	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
 	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index 275618b..e69a6be 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -750,7 +750,7 @@ static const struct net_device_ops hix5hd2_netdev_ops = {
 	.ndo_set_mac_address	= hix5hd2_net_set_mac_address,
 };
 
-static struct ethtool_ops hix5hd2_ethtools_ops = {
+static const struct ethtool_ops hix5hd2_ethtools_ops = {
 	.get_link		= ethtool_op_get_link,
 	.get_link_ksettings     = phy_ethtool_get_link_ksettings,
 	.set_link_ksettings     = phy_ethtool_set_link_ksettings,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index ab33487..5eb3245 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -1264,7 +1264,7 @@ static int hns_get_rxnfc(struct net_device *netdev,
 	return 0;
 }
 
-static struct ethtool_ops hns_ethtool_ops = {
+static const struct ethtool_ops hns_ethtool_ops = {
 	.get_drvinfo = hns_nic_get_drvinfo,
 	.get_link  = hns_nic_get_link,
 	.get_settings  = hns_nic_get_settings,


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 5/6] dwc_eth_qos: constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
@ 2016-08-31  7:30   ` Julia Lawall
  -1 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Lars Persson; +Cc: kernel-janitors, netdev, linux-kernel

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/synopsys/dwc_eth_qos.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
index 5a3941b..c25d971 100644
--- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c
+++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
@@ -2743,7 +2743,7 @@ static void dwceqos_set_msglevel(struct net_device *ndev, u32 msglevel)
 	lp->msg_enable = msglevel;
 }
 
-static struct ethtool_ops dwceqos_ethtool_ops = {
+static const struct ethtool_ops dwceqos_ethtool_ops = {
 	.get_drvinfo    = dwceqos_get_drvinfo,
 	.get_link       = ethtool_op_get_link,
 	.get_pauseparam = dwceqos_get_pauseparam,

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 5/6] dwc_eth_qos: constify ethtool_ops structures
@ 2016-08-31  7:30   ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Lars Persson; +Cc: kernel-janitors, netdev, linux-kernel

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/synopsys/dwc_eth_qos.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
index 5a3941b..c25d971 100644
--- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c
+++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
@@ -2743,7 +2743,7 @@ static void dwceqos_set_msglevel(struct net_device *ndev, u32 msglevel)
 	lp->msg_enable = msglevel;
 }
 
-static struct ethtool_ops dwceqos_ethtool_ops = {
+static const struct ethtool_ops dwceqos_ethtool_ops = {
 	.get_drvinfo    = dwceqos_get_drvinfo,
 	.get_link       = ethtool_op_get_link,
 	.get_pauseparam = dwceqos_get_pauseparam,


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 6/6] net: systemport: constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
@ 2016-08-31  7:30   ` Julia Lawall
  -1 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: kernel-janitors, netdev, linux-kernel

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/bcmsysport.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index b2d3086..dbbe8a5 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1692,7 +1692,7 @@ static int bcm_sysport_stop(struct net_device *dev)
 	return 0;
 }
 
-static struct ethtool_ops bcm_sysport_ethtool_ops = {
+static const struct ethtool_ops bcm_sysport_ethtool_ops = {
 	.get_drvinfo		= bcm_sysport_get_drvinfo,
 	.get_msglevel		= bcm_sysport_get_msglvl,
 	.set_msglevel		= bcm_sysport_set_msglvl,

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 6/6] net: systemport: constify ethtool_ops structures
@ 2016-08-31  7:30   ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31  7:30 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: kernel-janitors, netdev, linux-kernel

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/bcmsysport.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index b2d3086..dbbe8a5 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1692,7 +1692,7 @@ static int bcm_sysport_stop(struct net_device *dev)
 	return 0;
 }
 
-static struct ethtool_ops bcm_sysport_ethtool_ops = {
+static const struct ethtool_ops bcm_sysport_ethtool_ops = {
 	.get_drvinfo		= bcm_sysport_get_drvinfo,
 	.get_msglevel		= bcm_sysport_get_msglvl,
 	.set_msglevel		= bcm_sysport_set_msglvl,


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 2/6] net: ethernet: et131x: constify ethtool_ops structures
  2016-08-31  7:30   ` Julia Lawall
@ 2016-08-31 11:48     ` Mark Einon
  -1 siblings, 0 replies; 32+ messages in thread
From: Mark Einon @ 2016-08-31 11:48 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, netdev, linux-kernel

On Wed, Aug 31, 2016 at 09:30:44AM +0200, Julia Lawall wrote:
> 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>

Looks good, thanks.

Acked-by: Mark Einon <mark.einon@gmail.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 2/6] net: ethernet: et131x: constify ethtool_ops structures
@ 2016-08-31 11:48     ` Mark Einon
  0 siblings, 0 replies; 32+ messages in thread
From: Mark Einon @ 2016-08-31 11:48 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, netdev, linux-kernel

On Wed, Aug 31, 2016 at 09:30:44AM +0200, Julia Lawall wrote:
> 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>

Looks good, thanks.

Acked-by: Mark Einon <mark.einon@gmail.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
@ 2016-08-31 15:39   ` Stephen Hemminger
  -1 siblings, 0 replies; 32+ messages in thread
From: Stephen Hemminger @ 2016-08-31 15:39 UTC (permalink / raw)
  To: Julia Lawall; +Cc: devel, netdev, kernel-janitors, linux-kernel

On Wed, 31 Aug 2016 09:30:42 +0200
Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> Constify ethtool_ops structures.
> 
> ---
> 
>  drivers/net/ethernet/agere/et131x.c              |    2 +-
>  drivers/net/ethernet/broadcom/bcmsysport.c       |    2 +-
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c   |    2 +-
>  drivers/net/ethernet/hisilicon/hip04_eth.c       |    2 +-
>  drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
>  drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
>  drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
>  drivers/net/ethernet/synopsys/dwc_eth_qos.c      |    2 +-
>  drivers/staging/slicoss/slicoss.c                |    4 ++--
>  9 files changed, 10 insertions(+), 10 deletions(-)
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Other drivers with same type of issue


drivers/net/ethernet/mediatek/mtk_eth_soc.c:static struct ethtool_ops mtk_ethtool_ops = {
drivers/net/ethernet/synopsys/dwc_eth_qos.c:static struct ethtool_ops dwceqos_ethtool_ops = {
drivers/net/ethernet/xilinx/xilinx_axienet_main.c:static struct ethtool_ops axienet_ethtool_ops = {
drivers/net/usb/r8152.c:static struct ethtool_ops ops = {
drivers/staging/netlogic/xlr_net.c:static struct ethtool_ops xlr_ethtool_ops = {

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31 15:39   ` Stephen Hemminger
  0 siblings, 0 replies; 32+ messages in thread
From: Stephen Hemminger @ 2016-08-31 15:39 UTC (permalink / raw)
  To: Julia Lawall; +Cc: devel, netdev, kernel-janitors, linux-kernel

On Wed, 31 Aug 2016 09:30:42 +0200
Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> Constify ethtool_ops structures.
> 
> ---
> 
>  drivers/net/ethernet/agere/et131x.c              |    2 +-
>  drivers/net/ethernet/broadcom/bcmsysport.c       |    2 +-
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c   |    2 +-
>  drivers/net/ethernet/hisilicon/hip04_eth.c       |    2 +-
>  drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
>  drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
>  drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
>  drivers/net/ethernet/synopsys/dwc_eth_qos.c      |    2 +-
>  drivers/staging/slicoss/slicoss.c                |    4 ++--
>  9 files changed, 10 insertions(+), 10 deletions(-)
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Other drivers with same type of issue


drivers/net/ethernet/mediatek/mtk_eth_soc.c:static struct ethtool_ops mtk_ethtool_ops = {
drivers/net/ethernet/synopsys/dwc_eth_qos.c:static struct ethtool_ops dwceqos_ethtool_ops = {
drivers/net/ethernet/xilinx/xilinx_axienet_main.c:static struct ethtool_ops axienet_ethtool_ops = {
drivers/net/usb/r8152.c:static struct ethtool_ops ops = {
drivers/staging/netlogic/xlr_net.c:static struct ethtool_ops xlr_ethtool_ops = {

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops
  2016-08-31  7:30 ` Julia Lawall
                   ` (8 preceding siblings ...)
  (?)
@ 2016-08-31 15:57 ` Stephen Hemminger
  2016-08-31 21:17   ` David Miller
  -1 siblings, 1 reply; 32+ messages in thread
From: Stephen Hemminger @ 2016-08-31 15:57 UTC (permalink / raw)
  To: Julia Lawall, Tom Lendacky; +Cc: netdev

Casting away const is bad practice. Since this is ARM specific driver
don't have hardware actually test this.

Having getter functions for ops is really unnecessary code bloat, but
not going to touch that.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c     | 4 ++--
 drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 4 ++--
 drivers/net/ethernet/amd/xgbe/xgbe.h         | 5 +++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index a9b2709..7f9216d 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1708,9 +1708,9 @@ static const struct net_device_ops xgbe_netdev_ops = {
 	.ndo_set_features	= xgbe_set_features,
 };
 
-struct net_device_ops *xgbe_get_netdev_ops(void)
+const struct net_device_ops *xgbe_get_netdev_ops(void)
 {
-	return (struct net_device_ops *)&xgbe_netdev_ops;
+	return &xgbe_netdev_ops;
 }
 
 static void xgbe_rx_refresh(struct xgbe_channel *channel)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
index 11d9f0c..4007b42 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
@@ -623,7 +623,7 @@ static const struct ethtool_ops xgbe_ethtool_ops = {
 	.get_ts_info = xgbe_get_ts_info,
 };
 
-struct ethtool_ops *xgbe_get_ethtool_ops(void)
+const struct ethtool_ops *xgbe_get_ethtool_ops(void)
 {
-	return (struct ethtool_ops *)&xgbe_ethtool_ops;
+	return &xgbe_ethtool_ops;
 }
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h
index 98d9d63..5dd17dc 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe.h
@@ -956,8 +956,9 @@ struct xgbe_prv_data {
 void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *);
 void xgbe_init_function_ptrs_phy(struct xgbe_phy_if *);
 void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *);
-struct net_device_ops *xgbe_get_netdev_ops(void);
-struct ethtool_ops *xgbe_get_ethtool_ops(void);
+const struct net_device_ops *xgbe_get_netdev_ops(void);
+const struct ethtool_ops *xgbe_get_ethtool_ops(void);
+
 #ifdef CONFIG_AMD_XGBE_DCB
 const struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void);
 #endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
  2016-08-31  7:30 ` Julia Lawall
  (?)
@ 2016-08-31 16:22   ` David Miller
  -1 siblings, 0 replies; 32+ messages in thread
From: David Miller @ 2016-08-31 16:22 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: devel, kernel-janitors, linux-kernel, netdev

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed, 31 Aug 2016 09:30:42 +0200

> Constify ethtool_ops structures.

Patches 2-6 applied, thanks.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31 16:22   ` David Miller
  0 siblings, 0 replies; 32+ messages in thread
From: David Miller @ 2016-08-31 16:22 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: devel, netdev, kernel-janitors, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed, 31 Aug 2016 09:30:42 +0200

> Constify ethtool_ops structures.

Patches 2-6 applied, thanks.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31 16:22   ` David Miller
  0 siblings, 0 replies; 32+ messages in thread
From: David Miller @ 2016-08-31 16:22 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: devel, kernel-janitors, linux-kernel, netdev

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed, 31 Aug 2016 09:30:42 +0200

> Constify ethtool_ops structures.

Patches 2-6 applied, thanks.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 3/6] net: bcmgenet: constify ethtool_ops structures
  2016-08-31  7:30   ` Julia Lawall
@ 2016-08-31 17:08     ` Florian Fainelli
  -1 siblings, 0 replies; 32+ messages in thread
From: Florian Fainelli @ 2016-08-31 17:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, netdev, linux-kernel

On 08/31/2016 12:30 AM, Julia Lawall wrote:
> 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>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 3/6] net: bcmgenet: constify ethtool_ops structures
@ 2016-08-31 17:08     ` Florian Fainelli
  0 siblings, 0 replies; 32+ messages in thread
From: Florian Fainelli @ 2016-08-31 17:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, netdev, linux-kernel

On 08/31/2016 12:30 AM, Julia Lawall wrote:
> 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>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 6/6] net: systemport: constify ethtool_ops structures
  2016-08-31  7:30   ` Julia Lawall
@ 2016-08-31 17:08     ` Florian Fainelli
  -1 siblings, 0 replies; 32+ messages in thread
From: Florian Fainelli @ 2016-08-31 17:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, netdev, linux-kernel

On 08/31/2016 12:30 AM, Julia Lawall wrote:
> 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>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 6/6] net: systemport: constify ethtool_ops structures
@ 2016-08-31 17:08     ` Florian Fainelli
  0 siblings, 0 replies; 32+ messages in thread
From: Florian Fainelli @ 2016-08-31 17:08 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, netdev, linux-kernel

On 08/31/2016 12:30 AM, Julia Lawall wrote:
> 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>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
  2016-08-31 15:39   ` Stephen Hemminger
@ 2016-08-31 19:40     ` Julia Lawall
  -1 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31 19:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: devel, netdev, kernel-janitors, linux-kernel



On Wed, 31 Aug 2016, Stephen Hemminger wrote:

> On Wed, 31 Aug 2016 09:30:42 +0200
> Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>
> > Constify ethtool_ops structures.
> >
> > ---
> >
> >  drivers/net/ethernet/agere/et131x.c              |    2 +-
> >  drivers/net/ethernet/broadcom/bcmsysport.c       |    2 +-
> >  drivers/net/ethernet/broadcom/genet/bcmgenet.c   |    2 +-
> >  drivers/net/ethernet/hisilicon/hip04_eth.c       |    2 +-
> >  drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
> >  drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
> >  drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
> >  drivers/net/ethernet/synopsys/dwc_eth_qos.c      |    2 +-
> >  drivers/staging/slicoss/slicoss.c                |    4 ++--
> >  9 files changed, 10 insertions(+), 10 deletions(-)
> > _______________________________________________
> > devel mailing list
> > devel@linuxdriverproject.org
> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
>
> Other drivers with same type of issue
>
>
> drivers/net/ethernet/mediatek/mtk_eth_soc.c:static struct ethtool_ops mtk_ethtool_ops = {
> drivers/net/ethernet/synopsys/dwc_eth_qos.c:static struct ethtool_ops dwceqos_ethtool_ops = {
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c:static struct ethtool_ops axienet_ethtool_ops = {
> drivers/net/usb/r8152.c:static struct ethtool_ops ops = {
> drivers/staging/netlogic/xlr_net.c:static struct ethtool_ops xlr_ethtool_ops = {

Thanks.  Probably they don't compile for x86, or at least not with make
allyesconfig.  I can check on them.

julia

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31 19:40     ` Julia Lawall
  0 siblings, 0 replies; 32+ messages in thread
From: Julia Lawall @ 2016-08-31 19:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: devel, netdev, kernel-janitors, linux-kernel



On Wed, 31 Aug 2016, Stephen Hemminger wrote:

> On Wed, 31 Aug 2016 09:30:42 +0200
> Julia Lawall <Julia.Lawall@lip6.fr> wrote:
>
> > Constify ethtool_ops structures.
> >
> > ---
> >
> >  drivers/net/ethernet/agere/et131x.c              |    2 +-
> >  drivers/net/ethernet/broadcom/bcmsysport.c       |    2 +-
> >  drivers/net/ethernet/broadcom/genet/bcmgenet.c   |    2 +-
> >  drivers/net/ethernet/hisilicon/hip04_eth.c       |    2 +-
> >  drivers/net/ethernet/hisilicon/hisi_femac.c      |    2 +-
> >  drivers/net/ethernet/hisilicon/hix5hd2_gmac.c    |    2 +-
> >  drivers/net/ethernet/hisilicon/hns/hns_ethtool.c |    2 +-
> >  drivers/net/ethernet/synopsys/dwc_eth_qos.c      |    2 +-
> >  drivers/staging/slicoss/slicoss.c                |    4 ++--
> >  9 files changed, 10 insertions(+), 10 deletions(-)
> > _______________________________________________
> > devel mailing list
> > devel@linuxdriverproject.org
> > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
>
> Other drivers with same type of issue
>
>
> drivers/net/ethernet/mediatek/mtk_eth_soc.c:static struct ethtool_ops mtk_ethtool_ops = {
> drivers/net/ethernet/synopsys/dwc_eth_qos.c:static struct ethtool_ops dwceqos_ethtool_ops = {
> drivers/net/ethernet/xilinx/xilinx_axienet_main.c:static struct ethtool_ops axienet_ethtool_ops = {
> drivers/net/usb/r8152.c:static struct ethtool_ops ops = {
> drivers/staging/netlogic/xlr_net.c:static struct ethtool_ops xlr_ethtool_ops = {

Thanks.  Probably they don't compile for x86, or at least not with make
allyesconfig.  I can check on them.

julia

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops
  2016-08-31 15:57 ` [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops Stephen Hemminger
@ 2016-08-31 21:17   ` David Miller
  2016-09-01  0:50     ` Tom Lendacky
  0 siblings, 1 reply; 32+ messages in thread
From: David Miller @ 2016-08-31 21:17 UTC (permalink / raw)
  To: stephen; +Cc: Julia.Lawall, thomas.lendacky, netdev

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 31 Aug 2016 08:57:36 -0700

> Casting away const is bad practice. Since this is ARM specific driver
> don't have hardware actually test this.
> 
> Having getter functions for ops is really unnecessary code bloat, but
> not going to touch that.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

I'll just apply this, let's see what happens.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops
  2016-08-31 21:17   ` David Miller
@ 2016-09-01  0:50     ` Tom Lendacky
  2016-09-01 17:45       ` Tom Lendacky
  0 siblings, 1 reply; 32+ messages in thread
From: Tom Lendacky @ 2016-09-01  0:50 UTC (permalink / raw)
  To: David Miller, stephen; +Cc: Julia.Lawall, netdev

On 08/31/2016 04:17 PM, David Miller wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
> Date: Wed, 31 Aug 2016 08:57:36 -0700
> 
>> Casting away const is bad practice. Since this is ARM specific driver
>> don't have hardware actually test this.
>>
>> Having getter functions for ops is really unnecessary code bloat, but
>> not going to touch that.
>>
>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> I'll just apply this, let's see what happens.

I should be able to test this in the next few days. I don't expect there
to be an issue. I'll let you know what I find.

Thanks,
Tom

> 

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops
  2016-09-01  0:50     ` Tom Lendacky
@ 2016-09-01 17:45       ` Tom Lendacky
  0 siblings, 0 replies; 32+ messages in thread
From: Tom Lendacky @ 2016-09-01 17:45 UTC (permalink / raw)
  To: David Miller, stephen; +Cc: Julia.Lawall, netdev

On 08/31/2016 07:50 PM, Tom Lendacky wrote:
> On 08/31/2016 04:17 PM, David Miller wrote:
>> From: Stephen Hemminger <stephen@networkplumber.org>
>> Date: Wed, 31 Aug 2016 08:57:36 -0700
>>
>>> Casting away const is bad practice. Since this is ARM specific driver
>>> don't have hardware actually test this.
>>>
>>> Having getter functions for ops is really unnecessary code bloat, but
>>> not going to touch that.
>>>
>>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>>
>> I'll just apply this, let's see what happens.
> 
> I should be able to test this in the next few days. I don't expect there
> to be an issue. I'll let you know what I find.

No issues found in build and test. For what it's worth since the patch
is already applied:

Tested-by: Tom Lendacky <thomas.lendacky@amd.com>

> 
> Thanks,
> Tom
> 
>>

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2016-09-01 22:20 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31  7:30 [PATCH 0/6] constify ethtool_ops structures Julia Lawall
2016-08-31  7:30 ` Julia Lawall
2016-08-31  7:30 ` Julia Lawall
2016-08-31  7:30 ` [PATCH 1/6] staging: slicoss: " Julia Lawall
2016-08-31  7:30   ` Julia Lawall
2016-08-31  7:30 ` [PATCH 2/6] net: ethernet: et131x: " Julia Lawall
2016-08-31  7:30   ` Julia Lawall
2016-08-31 11:48   ` Mark Einon
2016-08-31 11:48     ` Mark Einon
2016-08-31  7:30 ` [PATCH 3/6] net: bcmgenet: " Julia Lawall
2016-08-31  7:30   ` Julia Lawall
2016-08-31 17:08   ` Florian Fainelli
2016-08-31 17:08     ` Florian Fainelli
2016-08-31  7:30 ` [PATCH 4/6] net: hisilicon: " Julia Lawall
2016-08-31  7:30   ` Julia Lawall
2016-08-31  7:30 ` [PATCH 5/6] dwc_eth_qos: " Julia Lawall
2016-08-31  7:30   ` Julia Lawall
2016-08-31  7:30 ` [PATCH 6/6] net: systemport: " Julia Lawall
2016-08-31  7:30   ` Julia Lawall
2016-08-31 17:08   ` Florian Fainelli
2016-08-31 17:08     ` Florian Fainelli
2016-08-31 15:39 ` [PATCH 0/6] " Stephen Hemminger
2016-08-31 15:39   ` Stephen Hemminger
2016-08-31 19:40   ` Julia Lawall
2016-08-31 19:40     ` Julia Lawall
2016-08-31 15:57 ` [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops Stephen Hemminger
2016-08-31 21:17   ` David Miller
2016-09-01  0:50     ` Tom Lendacky
2016-09-01 17:45       ` Tom Lendacky
2016-08-31 16:22 ` [PATCH 0/6] constify ethtool_ops structures David Miller
2016-08-31 16:22   ` David Miller
2016-08-31 16:22   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.