From: Stephen Hemminger <stephen@networkplumber.org>
To: Julia Lawall <Julia.Lawall@lip6.fr>,
Tom Lendacky <thomas.lendacky@amd.com>
Cc: netdev@vger.kernel.org
Subject: [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops
Date: Wed, 31 Aug 2016 08:57:36 -0700 [thread overview]
Message-ID: <20160831085736.29fc6512@xeon-e3> (raw)
In-Reply-To: <1472628648-3603-1-git-send-email-Julia.Lawall@lip6.fr>
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
next prev parent reply other threads:[~2016-08-31 15:57 UTC|newest]
Thread overview: 16+ 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 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 15:57 ` Stephen Hemminger [this message]
2016-08-31 21:17 ` [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops 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
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=20160831085736.29fc6512@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=Julia.Lawall@lip6.fr \
--cc=netdev@vger.kernel.org \
--cc=thomas.lendacky@amd.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).