Merge branch 'rmobile-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / char / nwbutton.c
index 2d26497..04a480f 100644 (file)
 #define __NWBUTTON_C           /* Tell the header file who we are */
 #include "nwbutton.h"
 
+static void button_sequence_finished (unsigned long parameters);
+
 static int button_press_count;         /* The count of button presses */
-static struct timer_list button_timer; /* Times for the end of a sequence */ 
+/* Times for the end of a sequence */
+static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
 static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
 static char button_output_buffer[32];  /* Stores data to write out of device */
 static int bcount;                     /* The number of bytes in the buffer */
@@ -72,7 +75,7 @@ int button_add_callback (void (*callback) (void), int count)
  * with -EINVAL. If there is more than one entry with the same address,
  * because it searches the list from end to beginning, it will unregister the
  * last one to be registered first (FILO- First In Last Out).
- * Note that this is not neccessarily true if the entries are not submitted
+ * Note that this is not necessarily true if the entries are not submitted
  * at the same time, because another driver could have unregistered a callback
  * between the submissions creating a gap earlier in the list, which would
  * be filled first at submission time.
@@ -146,14 +149,8 @@ static void button_sequence_finished (unsigned long parameters)
 
 static irqreturn_t button_handler (int irq, void *dev_id)
 {
-       if (button_press_count) {
-               del_timer (&button_timer);
-       }
        button_press_count++;
-       init_timer (&button_timer);
-       button_timer.function = button_sequence_finished;
-       button_timer.expires = (jiffies + bdelay);
-       add_timer (&button_timer);
+       mod_timer(&button_timer, jiffies + bdelay);
 
        return IRQ_HANDLED;
 }
@@ -185,6 +182,7 @@ static int button_read (struct file *filp, char __user *buffer,
 static const struct file_operations button_fops = {
        .owner          = THIS_MODULE,
        .read           = button_read,
+       .llseek         = noop_llseek,
 };
 
 /*