Re: [patch 3/4] 2.5.31 i2c updates

From: Russell King (rmk@arm.linux.org.uk)
Date: Wed Aug 14 2002 - 03:55:15 EST


On Mon, Aug 12, 2002 at 09:57:50AM -0400, Albert Cranford wrote:
> @@ -121,12 +118,12 @@
> int timeout = 2;
>
> if (irq > 0) {
> - cli();
> + spin_lock_irq(&irq_driver_lock);
> if (pcf_pending == 0) {
> interruptible_sleep_on_timeout(&pcf_wait, timeout*HZ );
> } else
> pcf_pending = 0;
> - sti();
> + spin_unlock_irq(&irq_driver_lock);

In case you didn't get my previous message, sleeping with spinlocks held
is the perfect path to deadlock. Also, scheduling with interrupts disabled
is not a good idea. Unfortunately the code above does both.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- 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 : Thu Aug 15 2002 - 22:00:36 EST