1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

Kernel: Rename ScopedSpinlock => SpinlockLocker

This matches MutexLocker, and doesn't sound like it's a lock itself.
This commit is contained in:
Andreas Kling 2021-08-22 01:49:22 +02:00
parent 55adace359
commit c922a7da09
78 changed files with 365 additions and 366 deletions

View file

@ -18,7 +18,7 @@ AsyncDeviceRequest::AsyncDeviceRequest(Device& device)
AsyncDeviceRequest::~AsyncDeviceRequest()
{
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
VERIFY(is_completed_result(m_result));
VERIFY(m_sub_requests_pending.is_empty());
}
@ -63,7 +63,7 @@ auto AsyncDeviceRequest::wait(Time* timeout) -> RequestWaitResult
auto AsyncDeviceRequest::get_request_result() const -> RequestResult
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
return m_result;
}
@ -74,7 +74,7 @@ void AsyncDeviceRequest::add_sub_request(NonnullRefPtr<AsyncDeviceRequest> sub_r
VERIFY(sub_request->m_parent_request == nullptr);
sub_request->m_parent_request = this;
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
VERIFY(!is_completed_result(m_result));
m_sub_requests_pending.append(sub_request);
if (m_result == Started)
@ -85,7 +85,7 @@ void AsyncDeviceRequest::sub_request_finished(AsyncDeviceRequest& sub_request)
{
bool all_completed;
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
VERIFY(m_result == Started);
if (m_sub_requests_pending.contains(sub_request)) {
@ -131,7 +131,7 @@ void AsyncDeviceRequest::complete(RequestResult result)
VERIFY(result == Success || result == Failure || result == MemoryFault);
ScopedCritical critical;
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
VERIFY(m_result == Started);
m_result = result;
}

View file

@ -61,7 +61,7 @@ public:
[[nodiscard]] RequestWaitResult wait(Time* = nullptr);
void do_start(ScopedSpinlock<Spinlock<u8>>&& requests_lock)
void do_start(SpinlockLocker<Spinlock<u8>>&& requests_lock)
{
if (is_completed_result(m_result))
return;

View file

@ -62,7 +62,7 @@ String Device::absolute_path(const FileDescription&) const
void Device::process_next_queued_request(Badge<AsyncDeviceRequest>, const AsyncDeviceRequest& completed_request)
{
ScopedSpinlock lock(m_requests_lock);
SpinlockLocker lock(m_requests_lock);
VERIFY(!m_requests.is_empty());
VERIFY(m_requests.first().ptr() == &completed_request);
m_requests.remove(m_requests.begin());

View file

@ -52,7 +52,7 @@ public:
NonnullRefPtr<AsyncRequestType> make_request(Args&&... args)
{
auto request = adopt_ref(*new AsyncRequestType(*this, forward<Args>(args)...));
ScopedSpinlock lock(m_requests_lock);
SpinlockLocker lock(m_requests_lock);
bool was_empty = m_requests.is_empty();
m_requests.append(request);
if (was_empty)

View file

@ -35,7 +35,7 @@ UNMAP_AFTER_INIT void I8042Controller::detect_devices()
{
u8 configuration;
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
// Disable devices
do_wait_then_write(I8042_STATUS, 0xad);
do_wait_then_write(I8042_STATUS, 0xa7); // ignored if it doesn't exist
@ -103,7 +103,7 @@ UNMAP_AFTER_INIT void I8042Controller::detect_devices()
m_first_port_available = false;
configuration &= ~1;
configuration |= 1 << 4;
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
do_wait_then_write(I8042_STATUS, 0x60);
do_wait_then_write(I8042_BUFFER, configuration);
}
@ -116,7 +116,7 @@ UNMAP_AFTER_INIT void I8042Controller::detect_devices()
dbgln("I8042: Mouse device failed to initialize, disable");
m_second_port_available = false;
configuration |= 1 << 5;
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
do_wait_then_write(I8042_STATUS, 0x60);
do_wait_then_write(I8042_BUFFER, configuration);
}

View file

@ -53,36 +53,36 @@ public:
bool reset_device(HIDDevice::Type device)
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
return do_reset_device(device);
}
u8 send_command(HIDDevice::Type device, u8 command)
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
return do_send_command(device, command);
}
u8 send_command(HIDDevice::Type device, u8 command, u8 data)
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
return do_send_command(device, command, data);
}
u8 read_from_device(HIDDevice::Type device)
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
return do_read_from_device(device);
}
void wait_then_write(u8 port, u8 data)
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
do_wait_then_write(port, data);
}
u8 wait_then_read(u8 port)
{
ScopedSpinlock lock(m_lock);
SpinlockLocker lock(m_lock);
return do_wait_then_read(port);
}

View file

@ -251,7 +251,7 @@ void KeyboardDevice::key_state_changed(u8 scan_code, bool pressed)
HIDManagement::the().m_client->on_key_pressed(event);
{
ScopedSpinlock lock(m_queue_lock);
SpinlockLocker lock(m_queue_lock);
m_queue.enqueue(event);
}
@ -281,7 +281,7 @@ bool KeyboardDevice::can_read(const FileDescription&, size_t) const
KResultOr<size_t> KeyboardDevice::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t size)
{
size_t nread = 0;
ScopedSpinlock lock(m_queue_lock);
SpinlockLocker lock(m_queue_lock);
while (nread < size) {
if (m_queue.is_empty())
break;

View file

@ -20,7 +20,7 @@ MouseDevice::~MouseDevice()
bool MouseDevice::can_read(const FileDescription&, size_t) const
{
ScopedSpinlock lock(m_queue_lock);
SpinlockLocker lock(m_queue_lock);
return !m_queue.is_empty();
}
@ -29,7 +29,7 @@ KResultOr<size_t> MouseDevice::read(FileDescription&, u64, UserOrKernelBuffer& b
VERIFY(size > 0);
size_t nread = 0;
size_t remaining_space_in_buffer = static_cast<size_t>(size) - nread;
ScopedSpinlock lock(m_queue_lock);
SpinlockLocker lock(m_queue_lock);
while (!m_queue.is_empty() && remaining_space_in_buffer) {
auto packet = m_queue.dequeue();
lock.unlock();

View file

@ -60,7 +60,7 @@ void PS2MouseDevice::irq_handle_byte_read(u8 byte)
m_entropy_source.add_random_event(m_data.dword);
{
ScopedSpinlock lock(m_queue_lock);
SpinlockLocker lock(m_queue_lock);
m_queue.enqueue(parse_data_packet(m_data));
}
evaluate_block_conditions();

View file

@ -36,7 +36,7 @@ void VMWareMouseDevice::irq_handle_byte_read(u8)
if (mouse_packet.has_value()) {
m_entropy_source.add_random_event(mouse_packet.value());
{
ScopedSpinlock lock(m_queue_lock);
SpinlockLocker lock(m_queue_lock);
m_queue.enqueue(mouse_packet.value());
}
evaluate_block_conditions();

View file

@ -84,7 +84,7 @@ KResult KCOVDevice::ioctl(FileDescription&, unsigned request, Userspace<void*> a
return ENXIO; // This proc hasn't opened the kcov dev yet
auto kcov_instance = maybe_kcov_instance.value();
ScopedSpinlock lock(kcov_instance->lock);
SpinlockLocker lock(kcov_instance->lock);
switch (request) {
case KCOV_SETBUFSIZE: {
if (kcov_instance->state >= KCOVInstance::TRACING) {

View file

@ -59,7 +59,7 @@ KResultOr<size_t> SerialDevice::read(FileDescription&, u64, UserOrKernelBuffer&
if (!size)
return 0;
ScopedSpinlock lock(m_serial_lock);
SpinlockLocker lock(m_serial_lock);
if (!(get_line_status() & DataReady))
return 0;
@ -80,7 +80,7 @@ KResultOr<size_t> SerialDevice::write(FileDescription& description, u64, const U
if (!size)
return 0;
ScopedSpinlock lock(m_serial_lock);
SpinlockLocker lock(m_serial_lock);
if (!can_write(description, size))
return EAGAIN;