Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
45242006
Commit
45242006
authored
Oct 14, 2009
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make flush_to_ldisc properly handle parallel calls
parent
80f50691
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
drivers/char/tty_buffer.c
drivers/char/tty_buffer.c
+13
-16
No files found.
drivers/char/tty_buffer.c
View file @
45242006
...
...
@@ -402,28 +402,26 @@ static void flush_to_ldisc(struct work_struct *work)
container_of
(
work
,
struct
tty_struct
,
buf
.
work
.
work
);
unsigned
long
flags
;
struct
tty_ldisc
*
disc
;
struct
tty_buffer
*
tbuf
,
*
head
;
char
*
char_buf
;
unsigned
char
*
flag_buf
;
disc
=
tty_ldisc_ref
(
tty
);
if
(
disc
==
NULL
)
/* !TTY_LDISC */
return
;
spin_lock_irqsave
(
&
tty
->
buf
.
lock
,
flags
);
/* So we know a flush is running */
set_bit
(
TTY_FLUSHING
,
&
tty
->
flags
);
head
=
tty
->
buf
.
head
;
if
(
head
!=
NULL
)
{
tty
->
buf
.
head
=
NULL
;
for
(;;)
{
int
count
=
head
->
commit
-
head
->
read
;
if
(
!
test_and_set_bit
(
TTY_FLUSHING
,
&
tty
->
flags
))
{
struct
tty_buffer
*
head
;
while
((
head
=
tty
->
buf
.
head
)
!=
NULL
)
{
int
count
;
char
*
char_buf
;
unsigned
char
*
flag_buf
;
count
=
head
->
commit
-
head
->
read
;
if
(
!
count
)
{
if
(
head
->
next
==
NULL
)
break
;
tbuf
=
head
;
head
=
head
->
next
;
tty_buffer_free
(
tty
,
tbuf
);
tty
->
buf
.
head
=
head
->
next
;
tty_buffer_free
(
tty
,
head
);
continue
;
}
/* Ldisc or user is trying to flush the buffers
...
...
@@ -445,9 +443,9 @@ static void flush_to_ldisc(struct work_struct *work)
flag_buf
,
count
);
spin_lock_irqsave
(
&
tty
->
buf
.
lock
,
flags
);
}
/* Restore the queue head */
tty
->
buf
.
head
=
head
;
clear_bit
(
TTY_FLUSHING
,
&
tty
->
flags
);
}
/* We may have a deferred request to flush the input buffer,
if so pull the chain under the lock and empty the queue */
if
(
test_bit
(
TTY_FLUSHPENDING
,
&
tty
->
flags
))
{
...
...
@@ -455,7 +453,6 @@ static void flush_to_ldisc(struct work_struct *work)
clear_bit
(
TTY_FLUSHPENDING
,
&
tty
->
flags
);
wake_up
(
&
tty
->
read_wait
);
}
clear_bit
(
TTY_FLUSHING
,
&
tty
->
flags
);
spin_unlock_irqrestore
(
&
tty
->
buf
.
lock
,
flags
);
tty_ldisc_deref
(
disc
);
...
...
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