mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-02 07:28: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)
|
if (kb == NULL)
|
||||||
return POLLERR;
|
return POLLERR;
|
||||||
|
|
||||||
if (events & POLLIN) {
|
|
||||||
long ipl = interrupt_raiseipl(IPL_KEYBOARD);
|
long ipl = interrupt_raiseipl(IPL_KEYBOARD);
|
||||||
spinlock_acquire(&kb->lock);
|
spinlock_acquire(&kb->lock);
|
||||||
|
if (events & POLLIN) {
|
||||||
size_t dataleft = RINGBUFFER_DATACOUNT(&kb->packetbuffer);
|
size_t dataleft = RINGBUFFER_DATACOUNT(&kb->packetbuffer);
|
||||||
spinlock_release(&kb->lock);
|
|
||||||
interrupt_loweripl(ipl);
|
|
||||||
if (dataleft)
|
if (dataleft)
|
||||||
revents |= POLLIN;
|
revents |= POLLIN;
|
||||||
}
|
}
|
||||||
@@ -203,6 +201,9 @@ static int poll(int minor, polldata_t *data, int events) {
|
|||||||
if (revents == 0 && data)
|
if (revents == 0 && data)
|
||||||
poll_add(&kb->pollheader, data, events);
|
poll_add(&kb->pollheader, data, events);
|
||||||
|
|
||||||
|
spinlock_release(&kb->lock);
|
||||||
|
interrupt_loweripl(ipl);
|
||||||
|
|
||||||
return revents;
|
return revents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user