public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Garrett <mjg59@srcf.ucam.org>
To: dmitry.torokhov@gmail.com, IvDoorn@gmail.com, hmh@hmh.eng.br
Cc: sitsofe@yahoo.com, linux-kernel@vger.kernel.org
Subject: [PATCH v3] rfkill-input doesn't work until 5 minutes after boot
Date: Sun, 5 Oct 2008 12:02:26 +0100	[thread overview]
Message-ID: <20081005110226.GB4087@srcf.ucam.org> (raw)
In-Reply-To: <20081005004334.GA31844@srcf.ucam.org>

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>

---

Document the requirement to initialise the struct.

diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index e5b6955..6c7baa0 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -103,6 +103,8 @@ static void rfkill_schedule_toggle(struct rfkill_task *task)
 		.desired_state = RFKILL_STATE_UNBLOCKED,	\
 	}
 
+/* Remember to initialise these in rfkill_handler_init if you add any */
+
 static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);
 static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH);
 static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB);
@@ -255,6 +257,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

  parent reply	other threads:[~2008-10-05 11:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-04 20:43 [PATCH] rfkill-input doesn't work until 5 minutes after boot Matthew Garrett
2008-10-04 22:03 ` Sitsofe Wheeler
2008-10-04 22:39 ` Andrew Morton
2008-10-04 22:50   ` Matthew Garrett
2008-10-05  0:43 ` [PATCH v2] " Matthew Garrett
2008-10-05  4:43   ` Andrew Morton
2008-10-05 10:58     ` Matthew Garrett
2008-10-05 11:02   ` Matthew Garrett [this message]
2008-10-05 13:51     ` [PATCH v3] " Henrique de Moraes Holschuh
2008-10-05 14:31     ` Ivo van Doorn
2008-10-06  2:16       ` Henrique de Moraes Holschuh
2008-10-05 19:04     ` Sitsofe Wheeler
2008-10-05 21:24     ` Dmitry Torokhov
2008-10-05 21:33       ` Matthew Garrett
2008-10-06  5:52         ` Sitsofe Wheeler
2008-10-06 16:31           ` Ivo van Doorn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081005110226.GB4087@srcf.ucam.org \
    --to=mjg59@srcf.ucam.org \
    --cc=IvDoorn@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hmh@hmh.eng.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sitsofe@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox