Skip to content

Commit 8cd1c6a

Browse files
0xff07jserv
authored andcommitted
Refine wordings
1 parent 56f566a commit 8cd1c6a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lkmpg.tex

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,34 +1931,36 @@ \subsection{Bottom Half}
19311931

19321932
\subsection{Threaded IRQ}
19331933

1934-
Threaded IRQ is a mechanism to handle both top-half and bottom-half of an IRQ at once.
1935-
A threaded IRQ splits one handler into two: one for the top-half, the other for the bottom-half.
1936-
Those two handlers are registered at once by \cpp|request_threaded_irq()|.
1934+
Threaded IRQ is a mechanism to organize both top-half and bottom-half of an IRQ at once.
1935+
A threaded IRQ splits the one handler in \cpp|request_irq()| into two: one for the top-half, the other for the bottom-half.
1936+
The \cpp|request_threaded_irq()| is the function for using threaded IRQs.
1937+
Two handlers are registered at once in the \cpp|request_threaded_irq()|.
19371938

1939+
Those two handlers run in different context.
19381940
The top-half handler runs in interrupt context.
19391941
It's the equivalence of the handler passed to the \cpp|request_irq()|.
19401942
The bottom-half handler on the other hand runs in its own thread.
1941-
This thread is created on registration of a threaded IRQ. Its sole purpose is to run this bottom-half handler.
1943+
This thread is created on registration of a threaded IRQ.
1944+
Its sole purpose is to run this bottom-half handler.
19421945
This is where a threaded IRQ is ``threaded''.
1943-
1944-
Whether the bottom-half handler will be invoked is determined by the return value of the top-half handler.
1945-
If \cpp|IRQ_WAKE_THREAD| is returned, that bottom-half serving thread will wake up.
1946+
If \cpp|IRQ_WAKE_THREAD| is returned by the top-half handler, that bottom-half serving thread will wake up.
19461947
The thread then runs the bottom-half handler.
19471948

19481949
Here is an example of how to do the same thing as before, with top and bottom halves, but using threads.
19491950

19501951
\samplec{examples/bh_threaded.c}
19511952

1952-
\cpp|request_threaded_irq()| only takes one additional parameter than the \cpp|request_irq()| -- the bottom-half handling function that runs in its own thread.
1953+
A threaded IRQ is registered using \cpp|request_threaded_irq()|.
1954+
This function only takes one additional parameter than the \cpp|request_irq()| -- the bottom-half handling function that runs in its own thread.
19531955
In this example it is the \cpp|button_bottom_half()|.
19541956
Usage of other parameters are the same as \cpp|request_irq()|.
19551957

19561958
Presence of both handlers is not mandatory.
19571959
If either of them is not needed, pass the \cpp|NULL| instead.
1958-
A \cpp|NULL| top-half handler implicitly means doing nothing but waking up the bottom-half serving thread; A \cpp|NULL| bottom-half handler will have the same effect as \cpp|request_irq()|.
1960+
A \cpp|NULL| top-half handler implicitly means doing nothing but waking up the bottom-half serving thread (for running the bottom-half handler); A \cpp|NULL| bottom-half handler would have the same effect as if \cpp|request_irq()| were used.
19591961
In fact, this is how \cpp|request_irq()| is implemented.
19601962

1961-
Note that passing \cpp|NULL| as both handlers is considered an error and will make registration fail.
1963+
Note that passing \cpp|NULL| to both handlers is considered an error and will make registration fail.
19621964

19631965
\section{Virtual Input Device Driver}
19641966
\label{sec:vinput}

0 commit comments

Comments
 (0)