linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / i2c / busses / i2c-ite.c
index 6263811..df3e57e 100644 (file)
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/wait.h>
 #include <asm/irq.h>
 #include <asm/io.h>
 
@@ -107,9 +107,9 @@ static int iic_ite_getclock(void *data)
  * IIC controller interrupts.
  */
 static void iic_ite_waitforpin(void) {
-
+   DEFINE_WAIT(wait);
    int timeout = 2;
-   long flags;
+   unsigned long flags;
 
    /* If interrupts are enabled (which they are), then put the process to
     * sleep.  This process will be awakened by two events -- either the
@@ -121,13 +121,15 @@ static void iic_ite_waitforpin(void) {
        spin_lock_irqsave(&lock, flags);
        if (iic_pending == 0) {
                spin_unlock_irqrestore(&lock, flags);
-               if (interruptible_sleep_on_timeout(&iic_wait, timeout*HZ)) {
+               prepare_to_wait(&iic_wait, &wait, TASK_INTERRUPTIBLE);
+               if (schedule_timeout(timeout*HZ)) {
                        spin_lock_irqsave(&lock, flags);
                        if (iic_pending == 1) {
                                iic_pending = 0;
                        }
                        spin_unlock_irqrestore(&lock, flags);
                }
+               finish_wait(&iic_wait, &wait);
        } else {
                iic_pending = 0;
                spin_unlock_irqrestore(&lock, flags);