Re: [PATCH] 2.5: ewrk3 cli/sti removal by VDA

From: Adam Kropelin (akropel1@rochester.rr.com)
Date: Mon Oct 21 2002 - 21:09:33 EST


On Mon, Oct 21, 2002 at 08:36:17PM -0400, Jeff Garzik wrote:
> Adam Kropelin wrote:
> >Below is a patch from Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
> >which
> >removes cli/sti in the ewrk3 driver. It tests out fine here with SMP &
> >preempt.
>
> Applied and then cleaned up... ETHTOOL_PHYS_ID needs to use
> schedule_timeout(), and using typeof should be avoided.

The patch below (against yours) should fix ETHTOOL_PHYS_ID again. Let me
know if I got it wrong. Was my prior use of
wait_event_interruptible_tiumeout actually broken or rather
just a lot more complicated than it needed to be?

I didn't find any use of typeof. If you point me to it I'll fix that up,
too.

Thanks for bearing with me. I'm climbing the clue-ladder as fast as I
can... ;)

--Adam

--- linux-2.5.44/drivers/net/ewrk3.c Mon Oct 21 22:01:01 2002
+++ linux-2.5.44/drivers/net/ewrk3.c.new Mon Oct 21 21:58:13 2002
@@ -1759,23 +1759,18 @@
                 return 0;
         }
 
-#ifdef BROKEN
         /* Blink LED for identification */
         case ETHTOOL_PHYS_ID: {
                 struct ethtool_value edata;
                 u_long flags;
- long delay, ret;
+ long ret=0;
                 u_char cr;
                 int count;
- wait_queue_head_t wait;
-
- init_waitqueue_head(&wait);
 
                 if (copy_from_user(&edata, useraddr, sizeof(edata)))
                         return -EFAULT;
 
                 /* Toggle LED 4x per second */
- delay = HZ >> 2;
                 count = edata.data << 2;
 
                 spin_lock_irqsave(&lp->hw_lock, flags);
@@ -1796,24 +1791,21 @@
 
                         /* Wait a little while */
                         spin_unlock_irqrestore(&lp->hw_lock, flags);
- ret = delay;
- __wait_event_interruptible_timeout(wait, 0, ret);
+ set_current_state(TASK_INTERRUPTIBLE);
+ ret = schedule_timeout(HZ>>2);
                         spin_lock_irqsave(&lp->hw_lock, flags);
 
                         /* Exit if we got a signal */
- if (ret == -ERESTARTSYS)
- goto out;
+ if (ret)
+ break;
                 }
 
- ret = 0;
-out:
                 lp->led_mask = CR_LED;
                 cr = inb(EWRK3_CR);
                 outb(cr & ~CR_LED, EWRK3_CR);
                 spin_unlock_irqrestore(&lp->hw_lock, flags);
- return ret;
+ return ret ? -ERESTARTSYS : 0;
         }
-#endif /* BROKEN */
 
         }
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:56 EST