Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d621af47
Commit
d621af47
authored
Jan 05, 2010
by
Dmitry Torokhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Input: gameport - make use of list_first_entry() helper
Signed-off-by:
Dmitry Torokhov
<
dtor@mail.ru
>
parent
361b7b5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
19 deletions
+11
-19
drivers/input/gameport/gameport.c
drivers/input/gameport/gameport.c
+11
-19
No files found.
drivers/input/gameport/gameport.c
View file @
d621af47
...
@@ -298,14 +298,12 @@ static void gameport_free_event(struct gameport_event *event)
...
@@ -298,14 +298,12 @@ static void gameport_free_event(struct gameport_event *event)
static
void
gameport_remove_duplicate_events
(
struct
gameport_event
*
event
)
static
void
gameport_remove_duplicate_events
(
struct
gameport_event
*
event
)
{
{
struct
list_head
*
node
,
*
next
;
struct
gameport_event
*
e
,
*
next
;
struct
gameport_event
*
e
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
gameport_event_lock
,
flags
);
spin_lock_irqsave
(
&
gameport_event_lock
,
flags
);
list_for_each_safe
(
node
,
next
,
&
gameport_event_list
)
{
list_for_each_entry_safe
(
e
,
next
,
&
gameport_event_list
,
node
)
{
e
=
list_entry
(
node
,
struct
gameport_event
,
node
);
if
(
event
->
object
==
e
->
object
)
{
if
(
event
->
object
==
e
->
object
)
{
/*
/*
* If this event is of different type we should not
* If this event is of different type we should not
...
@@ -315,7 +313,7 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
...
@@ -315,7 +313,7 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
if
(
event
->
type
!=
e
->
type
)
if
(
event
->
type
!=
e
->
type
)
break
;
break
;
list_del_init
(
node
);
list_del_init
(
&
e
->
node
);
gameport_free_event
(
e
);
gameport_free_event
(
e
);
}
}
}
}
...
@@ -325,21 +323,17 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
...
@@ -325,21 +323,17 @@ static void gameport_remove_duplicate_events(struct gameport_event *event)
static
struct
gameport_event
*
gameport_get_event
(
void
)
static
struct
gameport_event
*
gameport_get_event
(
void
)
{
{
struct
gameport_event
*
event
;
struct
gameport_event
*
event
=
NULL
;
struct
list_head
*
node
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
gameport_event_lock
,
flags
);
spin_lock_irqsave
(
&
gameport_event_lock
,
flags
);
if
(
list_empty
(
&
gameport_event_list
))
{
if
(
!
list_empty
(
&
gameport_event_list
))
{
spin_unlock_irqrestore
(
&
gameport_event_lock
,
flags
);
event
=
list_first_entry
(
&
gameport_event_list
,
return
NULL
;
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
);
spin_unlock_irqrestore
(
&
gameport_event_lock
,
flags
);
return
event
;
return
event
;
...
@@ -385,16 +379,14 @@ static void gameport_handle_event(void)
...
@@ -385,16 +379,14 @@ static void gameport_handle_event(void)
*/
*/
static
void
gameport_remove_pending_events
(
void
*
object
)
static
void
gameport_remove_pending_events
(
void
*
object
)
{
{
struct
list_head
*
node
,
*
next
;
struct
gameport_event
*
event
,
*
next
;
struct
gameport_event
*
event
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
gameport_event_lock
,
flags
);
spin_lock_irqsave
(
&
gameport_event_lock
,
flags
);
list_for_each_safe
(
node
,
next
,
&
gameport_event_list
)
{
list_for_each_entry_safe
(
event
,
next
,
&
gameport_event_list
,
node
)
{
event
=
list_entry
(
node
,
struct
gameport_event
,
node
);
if
(
event
->
object
==
object
)
{
if
(
event
->
object
==
object
)
{
list_del_init
(
node
);
list_del_init
(
&
event
->
node
);
gameport_free_event
(
event
);
gameport_free_event
(
event
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment