Skip to contentSkip to conversation

Re: [Fwd: extra spinlocking in forcedeth 0.25]

Fwd: extra spinlocking in forcedeth 0.25 Andrew de Quincey 1 participant 1 message Apr 14, 2004 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 23 lines · you

Andrew,

could you have a look at the attached mail regarding spinlocking in your WOL patch for forcedeth?

In 0.23 -> 0.25 forcedeth diff I noticed this:

+       case ETHTOOL_GWOL:
+       {
+               struct ethtool_wolinfo wolinfo;
+               memset(&wolinfo, 0, sizeof(wolinfo));
+               wolinfo.supported = WAKE_MAGIC;

(quoted diff) +10 -0
+
+               spin_lock_irq(&np->lock);
+               if (np->wolenabled)
+                       wolinfo.wolopts = WAKE_MAGIC;
+               spin_unlock_irq(&np->lock);
+
+               if (copy_to_user(useraddr, &wolinfo, sizeof(wolinfo)))
+                       return -EFAULT;
+               return 0;
+       }
Quoted 2 lines

IMHO this pair of lock()/unlock() is not needed
and can be safely removed.

Yeah, he's right. Absolutely no need for it there.