Patchwork [1/2] net: add dev_ethtool_set_flags helper

login
register
mail settings
Submitter Neil Horman
Date May 24, 2011, 5:15 p.m.
Message ID <1306257314-3925-2-git-send-email-nhorman@tuxdriver.com>
Download mbox | patch
Permalink /patch/97184/
State Superseded
Delegated to: David Miller
Headers show

Comments

Neil Horman - May 24, 2011, 5:15 p.m.
Add a helper to check for presence of a set_flags method in an ethtool_ops
structure and conditionally call it

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: davem@davemloft.net
---
 include/linux/netdevice.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Patch

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ca333e7..243781c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2624,6 +2624,13 @@  static inline u32 dev_ethtool_get_flags(struct net_device *dev)
 	return dev->ethtool_ops->get_flags(dev);
 }
 
+static inline int dev_ethtool_set_flags(struct net_device *dev, u32 flags)
+{
+	if (!dev->ethtool_ops || !dev->ethtool_ops->set_flags)
+		return 0;
+	return dev->ethtool_ops->set_flags(dev, flags);
+}
+
 /* Logging, debugging and troubleshooting/diagnostic helpers. */
 
 /* netdev_printk helpers, similar to dev_printk */