Thread (17 messages) 17 messages, 2 authors, 2012-12-31

[PATCH RFC 10/15] via-rhine: WOL: remove duplication into a helper.

From: Andreas Mohr <hidden>
Date: 2012-12-31 15:34:43
Subsystem: networking drivers, the rest, via rhine network driver · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Kevin Brace

From: Andreas Mohr <redacted>

Signed-off-by: Andreas Mohr <redacted>
---
 drivers/net/ethernet/via/via-rhine.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index ca788c0..7e13d50 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -2168,6 +2168,14 @@ static void netdev_set_msglevel(struct net_device *dev, u32 value)
 	rp->msg_enable = value;
 }
 
+/* Indicates the set of WOL features supported by this card rev. */
+static inline u32
+rhine_wol_support_bits_get(struct rhine_private *rp)
+{
+	return	WAKE_PHY | WAKE_MAGIC |
+		WAKE_UCAST | WAKE_MCAST | WAKE_BCAST;	/* Untested */
+}
+
 static void
 rhine_ethop_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
@@ -2177,8 +2185,7 @@ rhine_ethop_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 		return;
 
 	spin_lock_irq(&rp->lock);
-	wol->supported = WAKE_PHY | WAKE_MAGIC |
-			 WAKE_UCAST | WAKE_MCAST | WAKE_BCAST;	/* Untested */
+	wol->supported = rhine_wol_support_bits_get(rp);
 	wol->wolopts = rp->wolopts;
 	spin_unlock_irq(&rp->lock);
 }
@@ -2187,13 +2194,11 @@ static int
 rhine_ethop_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
 	struct rhine_private *rp = netdev_priv(dev);
-	u32 support = WAKE_PHY | WAKE_MAGIC |
-		      WAKE_UCAST | WAKE_MCAST | WAKE_BCAST;	/* Untested */
 
 	if (!(rp->quirks & rqHaveWOL))
 		return -EINVAL;
 
-	if (wol->wolopts & ~support)
+	if (wol->wolopts & ~(rhine_wol_support_bits_get(rp)))
 		return -EINVAL;
 
 	spin_lock_irq(&rp->lock);
-- 
1.7.2.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help