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
52b46da7
Commit
52b46da7
authored
Jun 20, 2003
by
Vojtech Pavlik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: Add locking to serio.c
parent
04093765
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
drivers/input/serio/serio.c
drivers/input/serio/serio.c
+13
-0
No files found.
drivers/input/serio/serio.c
View file @
52b46da7
...
@@ -58,6 +58,7 @@ struct serio_event {
...
@@ -58,6 +58,7 @@ struct serio_event {
struct
list_head
node
;
struct
list_head
node
;
};
};
static
DECLARE_MUTEX
(
serio_sem
);
static
LIST_HEAD
(
serio_list
);
static
LIST_HEAD
(
serio_list
);
static
LIST_HEAD
(
serio_dev_list
);
static
LIST_HEAD
(
serio_dev_list
);
static
LIST_HEAD
(
serio_event_list
);
static
LIST_HEAD
(
serio_event_list
);
...
@@ -90,9 +91,11 @@ void serio_handle_events(void)
...
@@ -90,9 +91,11 @@ void serio_handle_events(void)
switch
(
event
->
type
)
{
switch
(
event
->
type
)
{
case
SERIO_RESCAN
:
case
SERIO_RESCAN
:
down
(
&
serio_sem
);
if
(
event
->
serio
->
dev
&&
event
->
serio
->
dev
->
disconnect
)
if
(
event
->
serio
->
dev
&&
event
->
serio
->
dev
->
disconnect
)
event
->
serio
->
dev
->
disconnect
(
event
->
serio
);
event
->
serio
->
dev
->
disconnect
(
event
->
serio
);
serio_find_dev
(
event
->
serio
);
serio_find_dev
(
event
->
serio
);
up
(
&
serio_sem
);
break
;
break
;
default:
default:
break
;
break
;
...
@@ -153,30 +156,37 @@ irqreturn_t serio_interrupt(struct serio *serio,
...
@@ -153,30 +156,37 @@ irqreturn_t serio_interrupt(struct serio *serio,
void
serio_register_port
(
struct
serio
*
serio
)
void
serio_register_port
(
struct
serio
*
serio
)
{
{
down
(
&
serio_sem
);
list_add_tail
(
&
serio
->
node
,
&
serio_list
);
list_add_tail
(
&
serio
->
node
,
&
serio_list
);
serio_find_dev
(
serio
);
serio_find_dev
(
serio
);
up
(
&
serio_sem
);
}
}
void
serio_unregister_port
(
struct
serio
*
serio
)
void
serio_unregister_port
(
struct
serio
*
serio
)
{
{
down
(
&
serio_sem
);
list_del_init
(
&
serio
->
node
);
list_del_init
(
&
serio
->
node
);
if
(
serio
->
dev
&&
serio
->
dev
->
disconnect
)
if
(
serio
->
dev
&&
serio
->
dev
->
disconnect
)
serio
->
dev
->
disconnect
(
serio
);
serio
->
dev
->
disconnect
(
serio
);
up
(
&
serio_sem
);
}
}
void
serio_register_device
(
struct
serio_dev
*
dev
)
void
serio_register_device
(
struct
serio_dev
*
dev
)
{
{
struct
serio
*
serio
;
struct
serio
*
serio
;
down
(
&
serio_sem
);
list_add_tail
(
&
dev
->
node
,
&
serio_dev_list
);
list_add_tail
(
&
dev
->
node
,
&
serio_dev_list
);
list_for_each_entry
(
serio
,
&
serio_list
,
node
)
list_for_each_entry
(
serio
,
&
serio_list
,
node
)
if
(
!
serio
->
dev
&&
dev
->
connect
)
if
(
!
serio
->
dev
&&
dev
->
connect
)
dev
->
connect
(
serio
,
dev
);
dev
->
connect
(
serio
,
dev
);
up
(
&
serio_sem
);
}
}
void
serio_unregister_device
(
struct
serio_dev
*
dev
)
void
serio_unregister_device
(
struct
serio_dev
*
dev
)
{
{
struct
serio
*
serio
;
struct
serio
*
serio
;
down
(
&
serio_sem
);
list_del_init
(
&
dev
->
node
);
list_del_init
(
&
dev
->
node
);
list_for_each_entry
(
serio
,
&
serio_list
,
node
)
{
list_for_each_entry
(
serio
,
&
serio_list
,
node
)
{
...
@@ -184,8 +194,10 @@ void serio_unregister_device(struct serio_dev *dev)
...
@@ -184,8 +194,10 @@ void serio_unregister_device(struct serio_dev *dev)
dev
->
disconnect
(
serio
);
dev
->
disconnect
(
serio
);
serio_find_dev
(
serio
);
serio_find_dev
(
serio
);
}
}
up
(
&
serio_sem
);
}
}
/* called from serio_dev->connect/disconnect methods under serio_sem */
int
serio_open
(
struct
serio
*
serio
,
struct
serio_dev
*
dev
)
int
serio_open
(
struct
serio
*
serio
,
struct
serio_dev
*
dev
)
{
{
if
(
serio
->
open
(
serio
))
if
(
serio
->
open
(
serio
))
...
@@ -194,6 +206,7 @@ int serio_open(struct serio *serio, struct serio_dev *dev)
...
@@ -194,6 +206,7 @@ int serio_open(struct serio *serio, struct serio_dev *dev)
return
0
;
return
0
;
}
}
/* called from serio_dev->connect/disconnect methods under serio_sem */
void
serio_close
(
struct
serio
*
serio
)
void
serio_close
(
struct
serio
*
serio
)
{
{
serio
->
close
(
serio
);
serio
->
close
(
serio
);
...
...
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