mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 05:38:21 +00:00
keyboard: fix poll
This commit is contained in:
@@ -190,12 +190,10 @@ static int poll(int minor, polldata_t *data, int events) {
|
||||
if (kb == NULL)
|
||||
return POLLERR;
|
||||
|
||||
long ipl = interrupt_raiseipl(IPL_KEYBOARD);
|
||||
spinlock_acquire(&kb->lock);
|
||||
if (events & POLLIN) {
|
||||
long ipl = interrupt_raiseipl(IPL_KEYBOARD);
|
||||
spinlock_acquire(&kb->lock);
|
||||
size_t dataleft = RINGBUFFER_DATACOUNT(&kb->packetbuffer);
|
||||
spinlock_release(&kb->lock);
|
||||
interrupt_loweripl(ipl);
|
||||
if (dataleft)
|
||||
revents |= POLLIN;
|
||||
}
|
||||
@@ -203,6 +201,9 @@ static int poll(int minor, polldata_t *data, int events) {
|
||||
if (revents == 0 && data)
|
||||
poll_add(&kb->pollheader, data, events);
|
||||
|
||||
spinlock_release(&kb->lock);
|
||||
interrupt_loweripl(ipl);
|
||||
|
||||
return revents;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user