From 96a1be7e79704d3d60324547b689f8dcdc357524 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 28 Aug 2022 14:53:48 +0200 Subject: kernel/driver: add postqueue_join / postqueue_pop --- src/kernel/arch/amd64/driver/ps2.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/kernel/arch/amd64/driver/ps2.c') 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; -- cgit v1.2.3