summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/ps2.c
diff options
context:
space:
mode:
authordzwdz2022-08-28 14:53:48 +0200
committerdzwdz2022-08-28 14:53:48 +0200
commit96a1be7e79704d3d60324547b689f8dcdc357524 (patch)
tree17728f878af64669b16423e21a48b6bec1dc4d8e /src/kernel/arch/amd64/driver/ps2.c
parent83567c386e4a50cc4303d2c3966d7518331e129f (diff)
kernel/driver: add postqueue_join / postqueue_pop
Diffstat (limited to 'src/kernel/arch/amd64/driver/ps2.c')
-rw-r--r--src/kernel/arch/amd64/driver/ps2.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c
index bac060e..196b890 100644
--- a/src/kernel/arch/amd64/driver/ps2.c
+++ b/src/kernel/arch/amd64/driver/ps2.c
@@ -63,16 +63,10 @@ void ps2_irq(void) {
if (!(status & 1)) break; /* read while data available */
if (status & (1 << 5)) {
ring_put1b((void*)&mouse_backlog, port_in8(PS2));
- if (mouse_queue) {
- accept(mouse_queue);
- mouse_queue = mouse_queue->postqueue_next;
- }
+ postqueue_pop(&mouse_queue, accept);
} else {
ring_put1b((void*)&kb_backlog, port_in8(PS2));
- if (kb_queue) {
- accept(kb_queue);
- kb_queue = kb_queue->postqueue_next;
- }
+ postqueue_pop(&kb_queue, accept);
}
}
}
@@ -85,10 +79,7 @@ enum {
static void read_backlog(struct vfs_request *req, ring_t *r, struct vfs_request **queue) {
if (ring_used(r) == 0) {
- /* nothing to read, join queue */
- assert(!req->postqueue_next);
- while (*queue) queue = &(*queue)->postqueue_next;
- *queue = req;
+ postqueue_join(queue, req);
} else if (req->caller) {
int len = req->output.len;
if (len < 0) len = 0;