Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183089
b: refs/heads/master
c: d621af4
h: refs/heads/master
i:
  183087: 342cbdc
v: v3
  • Loading branch information
Dmitry Torokhov committed Jan 6, 2010
1 parent 21da565 commit 1683dcb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 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: 361b7b5b032338361ea88412f1fc45479fdd5859
refs/heads/master: d621af473079851caac873adc5431a05c9d78dfd
30 changes: 11 additions & 19 deletions trunk/drivers/input/gameport/gameport.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,12 @@ static void gameport_free_event(struct gameport_event *event)

static void gameport_remove_duplicate_events(struct gameport_event *event)
{
struct list_head *node, *next;
struct gameport_event *e;
struct gameport_event *e, *next;
unsigned long flags;

spin_lock_irqsave(&gameport_event_lock, flags);

list_for_each_safe(node, next, &gameport_event_list) {
e = list_entry(node, struct gameport_event, node);
list_for_each_entry_safe(e, next, &gameport_event_list, node) {
if (event->object == e->object) {
/*
* If this event is of different type we should not
Expand All @@ -315,7 +313,7 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
if (event->type != e->type)
break;

list_del_init(node);
list_del_init(&e->node);
gameport_free_event(e);
}
}
Expand All @@ -325,21 +323,17 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)

static struct gameport_event *gameport_get_event(void)
{
struct gameport_event *event;
struct list_head *node;
struct gameport_event *event = NULL;
unsigned long flags;

spin_lock_irqsave(&gameport_event_lock, flags);

if (list_empty(&gameport_event_list)) {
spin_unlock_irqrestore(&gameport_event_lock, flags);
return NULL;
if (!list_empty(&gameport_event_list)) {
event = list_first_entry(&gameport_event_list,
struct gameport_event, node);
list_del_init(&event->node);
}

node = gameport_event_list.next;
event = list_entry(node, struct gameport_event, node);
list_del_init(node);

spin_unlock_irqrestore(&gameport_event_lock, flags);

return event;
Expand Down Expand Up @@ -385,16 +379,14 @@ static void gameport_handle_event(void)
*/
static void gameport_remove_pending_events(void *object)
{
struct list_head *node, *next;
struct gameport_event *event;
struct gameport_event *event, *next;
unsigned long flags;

spin_lock_irqsave(&gameport_event_lock, flags);

list_for_each_safe(node, next, &gameport_event_list) {
event = list_entry(node, struct gameport_event, node);
list_for_each_entry_safe(event, next, &gameport_event_list, node) {
if (event->object == object) {
list_del_init(node);
list_del_init(&event->node);
gameport_free_event(event);
}
}
Expand Down

0 comments on commit 1683dcb

Please sign in to comment.