2.5.31 i2c updates
PATCH 3/4 2.5.31 i2c updates
Hello Linus,
Please apply the following four tested patches that update 2.5.31 with these I2C changes:
o Support for SMBus 2.0 PEC Packet Error Checking
o New adapter-i2c-frodo for SA 1110 board
o New adapter-i2c-rpx for embeded MPC8XX
o Replace depreciated cli()&sti() with spin_{un}lock_irq()
o Updated documentation
Thanks,
Albert
drivers/i2c/i2c-algo-bit.c 2002-07-07 20:41:49.000000000 -0400 renamed from drivers/i2c/i2c-algo-bit.c.orig 2002-07-05 19:42:28.000000000 -0400 +2 -2
@@ -21,7 +21,7 @@ /* With some changes from Kyösti Mälkki <[email protected]> and even Frodo Looijaard <[email protected]> */ -/* $Id: i2c-algo-bit.c,v 1.34 2001/11/19 18:45:02 mds Exp $ */ +/* $Id: i2c-algo-bit.c,v 1.37 2002/07/08 00:41:49 mds Exp $ */ #include <linux/kernel.h> #include <linux/module.h>
@@ -143,7 +148,7 @@ /* scl, sda may not be high */ DEBPROTO(printk(" Sr ")); setsda(adap,1); - setscl(adap,1); + sclhi(adap); udelay(adap->udelay); sdalo(adap);
drivers/i2c/i2c-algo-ibm_ocp.c 2002-07-03 21:00:38.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +966 -0
966 lines not on this page · raw message
drivers/i2c/i2c-algo-ibm_ocp.h 2002-07-03 21:00:38.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +55 -0
55 lines not on this page · raw message
drivers/i2c/i2c-elektor.c 2002-08-07 22:39:08.000000000 -0400 renamed from drivers/i2c/i2c-elektor.c.orig 2002-07-05 19:42:02.000000000 -0400 +4 -8
@@ -55,12 +55,9 @@ in some functions, called from the algo-pcf module. Sometimes it's need to be rewriten - but for now just remove this for simpler reading */ -#if (LINUX_VERSION_CODE < 0x020301) -static struct wait_queue *pcf_wait = NULL; -#else static wait_queue_head_t pcf_wait; -#endif static int pcf_pending; +spinlock_t irq_driver_lock = SPIN_LOCK_UNLOCKED; /* ----- global defines ----------------------------------------------- */ #define DEB(x) if (i2c_debug>=1) x
@@ -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); } else { udelay(100); }
@@ -280,9 +277,7 @@ base = DEFAULT_BASE; } -#if (LINUX_VERSION_CODE >= 0x020301) init_waitqueue_head(&pcf_wait); -#endif if (pcf_isa_init() == 0) { if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) { pcf_isa_exit();
@@ -297,6 +292,7 @@ return 0; } +EXPORT_NO_SYMBOLS; #ifdef MODULE MODULE_AUTHOR("Hans Berglund <[email protected]>");
drivers/i2c/i2c-frodo.c 2002-07-09 08:39:21.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +118 -0
118 lines not on this page · raw message
drivers/i2c/i2c-rpx.c 2002-06-11 22:29:54.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +136 -0
136 lines not on this page · raw message
Signature · 2 lines
Albert Cranford Deerfield Beach FL USA [email protected]
drivers/i2c/i2c-elektor.c 2002-08-07 22:39:08.000000000 -0400 line 126
Quoted 12 lines · Albert Cranford
drivers/i2c/i2c-elektor.c 2002-08-07 22:39:08.000000000 -0400 renamed from drivers/i2c/i2c-elektor.c.orig 2002-07-05 19:42:02.000000000 -0400 +2
-2@@ -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.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html