Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3535
b: refs/heads/master
c: a9180ab
h: refs/heads/master
i:
  3533: 8bf4965
  3531: 515aad3
  3527: 432778d
  3519: 2c06ab8
v: v3
  • Loading branch information
Dmitry Torokhov committed Jun 1, 2005
1 parent 90a8dd3 commit fb81824
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9d5432979951c8761c2b4517007039b9bcc1c110
refs/heads/master: a9180ab2e21b0c0ffcec7461c3a52ab7608d023a
27 changes: 10 additions & 17 deletions trunk/drivers/input/serio/serio.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@
#include <linux/serio.h>
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/completion.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/kthread.h>

MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Serio abstraction core");
Expand Down Expand Up @@ -138,8 +137,7 @@ struct serio_event {
static DEFINE_SPINLOCK(serio_event_lock); /* protects serio_event_list */
static LIST_HEAD(serio_event_list);
static DECLARE_WAIT_QUEUE_HEAD(serio_wait);
static DECLARE_COMPLETION(serio_exited);
static int serio_pid;
static struct task_struct *serio_task;

static void serio_queue_event(void *object, struct module *owner,
enum serio_event_type event_type)
Expand Down Expand Up @@ -337,20 +335,15 @@ static struct serio *serio_get_pending_child(struct serio *parent)

static int serio_thread(void *nothing)
{
lock_kernel();
daemonize("kseriod");
allow_signal(SIGTERM);

do {
serio_handle_events();
wait_event_interruptible(serio_wait, !list_empty(&serio_event_list));
wait_event_interruptible(serio_wait,
kthread_should_stop() || !list_empty(&serio_event_list));
try_to_freeze(PF_FREEZE);
} while (!signal_pending(current));
} while (!kthread_should_stop());

printk(KERN_DEBUG "serio: kseriod exiting\n");

unlock_kernel();
complete_and_exit(&serio_exited, 0);
return 0;
}


Expand Down Expand Up @@ -848,9 +841,10 @@ irqreturn_t serio_interrupt(struct serio *serio,

static int __init serio_init(void)
{
if (!(serio_pid = kernel_thread(serio_thread, NULL, CLONE_KERNEL))) {
serio_task = kthread_run(serio_thread, NULL, "kseriod");
if (IS_ERR(serio_task)) {
printk(KERN_ERR "serio: Failed to start kseriod\n");
return -1;
return PTR_ERR(serio_task);
}

serio_bus.dev_attrs = serio_device_attrs;
Expand All @@ -866,8 +860,7 @@ static int __init serio_init(void)
static void __exit serio_exit(void)
{
bus_unregister(&serio_bus);
kill_proc(serio_pid, SIGTERM, 1);
wait_for_completion(&serio_exited);
kthread_stop(serio_task);
}

module_init(serio_init);
Expand Down

0 comments on commit fb81824

Please sign in to comment.