linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] constify ethtool_ops structures
@ 2016-08-31  7:30 Julia Lawall
  2016-08-31  7:30 ` [PATCH 1/6] staging: slicoss: " Julia Lawall
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ 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] 13+ messages in thread

* [PATCH 1/6] staging: slicoss: constify ethtool_ops structures
  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 ` [PATCH 2/6] net: ethernet: et131x: " Julia Lawall
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ 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] 13+ messages in thread

* [PATCH 2/6] net: ethernet: et131x: constify ethtool_ops structures
  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 ` Julia Lawall
  2016-08-31 11:48   ` Mark Einon
  2016-08-31  7:30 ` [PATCH 3/6] net: bcmgenet: " Julia Lawall
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 13+ 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] 13+ messages in thread

* [PATCH 3/6] net: bcmgenet: constify ethtool_ops structures
  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  7:30 ` Julia Lawall
  2016-08-31 17:08   ` Florian Fainelli
  2016-08-31  7:30 ` [PATCH 4/6] net: hisilicon: " Julia Lawall
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 13+ 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] 13+ messages in thread

* [PATCH 4/6] net: hisilicon: constify ethtool_ops structures
  2016-08-31  7:30 [PATCH 0/6] constify ethtool_ops structures Julia Lawall
                   ` (2 preceding siblings ...)
  2016-08-31  7:30 ` [PATCH 3/6] net: bcmgenet: " Julia Lawall
@ 2016-08-31  7:30 ` Julia Lawall
  2016-08-31  7:30 ` [PATCH 5/6] dwc_eth_qos: " Julia Lawall
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ 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] 13+ messages in thread

* [PATCH 5/6] dwc_eth_qos: constify ethtool_ops structures
  2016-08-31  7:30 [PATCH 0/6] constify ethtool_ops structures Julia Lawall
                   ` (3 preceding siblings ...)
  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 6/6] net: systemport: " Julia Lawall
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ 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] 13+ messages in thread

* [PATCH 6/6] net: systemport: constify ethtool_ops structures
  2016-08-31  7:30 [PATCH 0/6] constify ethtool_ops structures Julia Lawall
                   ` (4 preceding siblings ...)
  2016-08-31  7:30 ` [PATCH 5/6] dwc_eth_qos: " Julia Lawall
@ 2016-08-31  7:30 ` Julia Lawall
  2016-08-31 17:08   ` Florian Fainelli
  2016-08-31 15:39 ` [PATCH 0/6] " Stephen Hemminger
  2016-08-31 16:22 ` David Miller
  7 siblings, 1 reply; 13+ 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] 13+ messages in thread

* Re: [PATCH 2/6] net: ethernet: et131x: constify ethtool_ops structures
  2016-08-31  7:30 ` [PATCH 2/6] net: ethernet: et131x: " Julia Lawall
@ 2016-08-31 11:48   ` Mark Einon
  0 siblings, 0 replies; 13+ 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] 13+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
  2016-08-31  7:30 [PATCH 0/6] constify ethtool_ops structures Julia Lawall
                   ` (5 preceding siblings ...)
  2016-08-31  7:30 ` [PATCH 6/6] net: systemport: " Julia Lawall
@ 2016-08-31 15:39 ` Stephen Hemminger
  2016-08-31 19:40   ` Julia Lawall
  2016-08-31 16:22 ` David Miller
  7 siblings, 1 reply; 13+ 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] 13+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
  2016-08-31  7:30 [PATCH 0/6] constify ethtool_ops structures Julia Lawall
                   ` (6 preceding siblings ...)
  2016-08-31 15:39 ` [PATCH 0/6] " Stephen Hemminger
@ 2016-08-31 16:22 ` David Miller
  7 siblings, 0 replies; 13+ 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] 13+ messages in thread

* Re: [PATCH 3/6] net: bcmgenet: constify ethtool_ops structures
  2016-08-31  7:30 ` [PATCH 3/6] net: bcmgenet: " Julia Lawall
@ 2016-08-31 17:08   ` Florian Fainelli
  0 siblings, 0 replies; 13+ 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] 13+ messages in thread

* Re: [PATCH 6/6] net: systemport: constify ethtool_ops structures
  2016-08-31  7:30 ` [PATCH 6/6] net: systemport: " Julia Lawall
@ 2016-08-31 17:08   ` Florian Fainelli
  0 siblings, 0 replies; 13+ 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] 13+ messages in thread

* Re: [PATCH 0/6] constify ethtool_ops structures
  2016-08-31 15:39 ` [PATCH 0/6] " Stephen Hemminger
@ 2016-08-31 19:40   ` Julia Lawall
  0 siblings, 0 replies; 13+ 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] 13+ messages in thread

end of thread, other threads:[~2016-08-31 19:40 UTC | newest]

Thread overview: 13+ 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 ` [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 ` [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

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).