lkml.org 
[lkml]   [2008]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH v2] rfkill-input doesn't work until 5 minutes after boot
rfkill-input implements debounce as follows:

if (time_after(jiffies, task->last + msecs_to_jiffies(200))) {

However, task->last is initialised to 0 while jiffies starts at -300*HZ.
Any input within 5 minutes of kernel start is therefore ignored. Fix by
initialising task->last correctly.

Signed-off-by: Matthew Garrett <mjg@redhat.com>

---

Set the last event value at module load time, since otherwise we'll have
a window of failure if someone loads the module in a few hundred million
years. I look forward to being rewarded by the post-humans for caring so
much about them.

diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index e5b6955..86197bb 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -255,6 +255,11 @@ static struct input_handler rfkill_handler = {

static int __init rfkill_handler_init(void)
{
+ rfkill_wlan.last = jiffies - HZ/5;
+ rfkill_bt.last = jiffies - HZ/5;
+ rfkill_uwb.last = jiffies - HZ/5;
+ rfkill_wimax.last = jiffies - HZ/5;
+ rfkill_wwan.last = jiffies - HZ/5;
return input_register_handler(&rfkill_handler);
}

--
Matthew Garrett | mjg59@srcf.ucam.org

\
 
 \ /
  Last update: 2008-10-05 02:45    [W:0.089 / U:2.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site