mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
Kernel: Stop lock & unlock repeatedly while reading from a mouse device
This was a thing we needed to do in the days where we didn't have safe_memcpy and some wrappers around it to handle possible page faults safely.
This commit is contained in:
parent
d8cbda6950
commit
3a261f5ee8
1 changed files with 0 additions and 3 deletions
|
@ -30,7 +30,6 @@ ErrorOr<size_t> MouseDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer&
|
||||||
SpinlockLocker lock(m_queue_lock);
|
SpinlockLocker lock(m_queue_lock);
|
||||||
while (!m_queue.is_empty() && remaining_space_in_buffer) {
|
while (!m_queue.is_empty() && remaining_space_in_buffer) {
|
||||||
auto packet = m_queue.dequeue();
|
auto packet = m_queue.dequeue();
|
||||||
lock.unlock();
|
|
||||||
|
|
||||||
dbgln_if(MOUSE_DEBUG, "Mouse Read: Buttons {:x}", packet.buttons);
|
dbgln_if(MOUSE_DEBUG, "Mouse Read: Buttons {:x}", packet.buttons);
|
||||||
dbgln_if(MOUSE_DEBUG, "PS2 Mouse: X {}, Y {}, Z {}, W {}, Relative {}", packet.x, packet.y, packet.z, packet.w, packet.buttons);
|
dbgln_if(MOUSE_DEBUG, "PS2 Mouse: X {}, Y {}, Z {}, W {}, Relative {}", packet.x, packet.y, packet.z, packet.w, packet.buttons);
|
||||||
|
@ -40,8 +39,6 @@ ErrorOr<size_t> MouseDevice::read(OpenFileDescription&, u64, UserOrKernelBuffer&
|
||||||
TRY(buffer.write(&packet, nread, bytes_read_from_packet));
|
TRY(buffer.write(&packet, nread, bytes_read_from_packet));
|
||||||
nread += bytes_read_from_packet;
|
nread += bytes_read_from_packet;
|
||||||
remaining_space_in_buffer -= bytes_read_from_packet;
|
remaining_space_in_buffer -= bytes_read_from_packet;
|
||||||
|
|
||||||
lock.lock();
|
|
||||||
}
|
}
|
||||||
return nread;
|
return nread;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue