diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-12-24 03:02:30 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-24 14:46:17 -0500 |
commit | cffdde993a016bedbc2f5eb60d00c3a766ffb612 (patch) | |
tree | fb8a001f35306b5bfd49af53e3aff22c298df2c6 /drivers | |
parent | c45bc9d62c39202b401d1bf7bb2812abb88798a1 (diff) |
sony-laptop - switch from workqueue to a timer
The function that is executing in workqueue context does not need
to sleep so let's switch to a timer which is more lightweight.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index b7aa959b0c05..cc7172ea19dd 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -145,6 +145,7 @@ struct sony_laptop_input_s { | |||
145 | struct input_dev *key_dev; | 145 | struct input_dev *key_dev; |
146 | struct kfifo fifo; | 146 | struct kfifo fifo; |
147 | spinlock_t fifo_lock; | 147 | spinlock_t fifo_lock; |
148 | struct timer_list release_key_timer; | ||
148 | }; | 149 | }; |
149 | 150 | ||
150 | static struct sony_laptop_input_s sony_laptop_input = { | 151 | static struct sony_laptop_input_s sony_laptop_input = { |
@@ -298,10 +299,8 @@ static int sony_laptop_input_keycode_map[] = { | |||
298 | }; | 299 | }; |
299 | 300 | ||
300 | /* release buttons after a short delay if pressed */ | 301 | /* release buttons after a short delay if pressed */ |
301 | static void do_sony_laptop_release_key(struct work_struct *work) | 302 | static void do_sony_laptop_release_key(unsigned long unused) |
302 | { | 303 | { |
303 | struct delayed_work *dwork = | ||
304 | container_of(work, struct delayed_work, work); | ||
305 | struct sony_laptop_keypress kp; | 304 | struct sony_laptop_keypress kp; |
306 | unsigned long flags; | 305 | unsigned long flags; |
307 | 306 | ||
@@ -315,14 +314,12 @@ static void do_sony_laptop_release_key(struct work_struct *work) | |||
315 | 314 | ||
316 | /* If there is something in the fifo schedule next release. */ | 315 | /* If there is something in the fifo schedule next release. */ |
317 | if (kfifo_len(&sony_laptop_input.fifo) != 0) | 316 | if (kfifo_len(&sony_laptop_input.fifo) != 0) |
318 | schedule_delayed_work(dwork, msecs_to_jiffies(10)); | 317 | mod_timer(&sony_laptop_input.release_key_timer, |
318 | jiffies + msecs_to_jiffies(10)); | ||
319 | 319 | ||
320 | spin_unlock_irqrestore(&sony_laptop_input.fifo_lock, flags); | 320 | spin_unlock_irqrestore(&sony_laptop_input.fifo_lock, flags); |
321 | } | 321 | } |
322 | 322 | ||
323 | static DECLARE_DELAYED_WORK(sony_laptop_release_key_work, | ||
324 | do_sony_laptop_release_key); | ||
325 | |||
326 | /* forward event to the input subsystem */ | 323 | /* forward event to the input subsystem */ |
327 | static void sony_laptop_report_input_event(u8 event) | 324 | static void sony_laptop_report_input_event(u8 event) |
328 | { | 325 | { |
@@ -380,8 +377,8 @@ static void sony_laptop_report_input_event(u8 event) | |||
380 | kfifo_in_locked(&sony_laptop_input.fifo, | 377 | kfifo_in_locked(&sony_laptop_input.fifo, |
381 | (unsigned char *)&kp, sizeof(kp), | 378 | (unsigned char *)&kp, sizeof(kp), |
382 | &sony_laptop_input.fifo_lock); | 379 | &sony_laptop_input.fifo_lock); |
383 | schedule_delayed_work(&sony_laptop_release_key_work, | 380 | mod_timer(&sony_laptop_input.release_key_timer, |
384 | msecs_to_jiffies(10)); | 381 | jiffies + msecs_to_jiffies(10)); |
385 | } else | 382 | } else |
386 | dprintk("unknown input event %.2x\n", event); | 383 | dprintk("unknown input event %.2x\n", event); |
387 | } | 384 | } |
@@ -406,6 +403,9 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
406 | goto err_dec_users; | 403 | goto err_dec_users; |
407 | } | 404 | } |
408 | 405 | ||
406 | setup_timer(&sony_laptop_input.release_key_timer, | ||
407 | do_sony_laptop_release_key, 0); | ||
408 | |||
409 | /* input keys */ | 409 | /* input keys */ |
410 | key_dev = input_allocate_device(); | 410 | key_dev = input_allocate_device(); |
411 | if (!key_dev) { | 411 | if (!key_dev) { |
@@ -485,7 +485,7 @@ static void sony_laptop_remove_input(void) | |||
485 | if (!atomic_dec_and_test(&sony_laptop_input.users)) | 485 | if (!atomic_dec_and_test(&sony_laptop_input.users)) |
486 | return; | 486 | return; |
487 | 487 | ||
488 | cancel_delayed_work_sync(&sony_laptop_release_key_work); | 488 | del_timer_sync(&sony_laptop_input.release_key_timer); |
489 | 489 | ||
490 | /* | 490 | /* |
491 | * Generate key-up events for remaining keys. Note that we don't | 491 | * Generate key-up events for remaining keys. Note that we don't |