qemu-usb: use Mutex

Issue #3801
This commit is contained in:
Alexander Boettcher 2020-07-06 10:35:24 +02:00 committed by Norman Feske
parent 5936d00b5e
commit 6d653b3c0f
2 changed files with 9 additions and 9 deletions

View File

@ -24,7 +24,7 @@ using namespace Genode;
static bool const verbose_devices = false; static bool const verbose_devices = false;
static bool const verbose_host = false; static bool const verbose_host = false;
static bool const verbose_warnings = false; static bool const verbose_warnings = false;
Lock _lock; Mutex _mutex;
static void update_ep(USBDevice *); static void update_ep(USBDevice *);
static bool claim_interfaces(USBDevice *dev); static bool claim_interfaces(USBDevice *dev);
@ -302,7 +302,7 @@ struct Usb_host_device : List<Usb_host_device>::Element
void ack_avail() void ack_avail()
{ {
Lock::Guard g(_lock); Mutex::Guard guard(_mutex);
/* we are already dead, do nothing */ /* we are already dead, do nothing */
if (deleted == true) return; if (deleted == true) return;
@ -463,7 +463,7 @@ struct Usb_host_device : List<Usb_host_device>::Element
void state_change() void state_change()
{ {
Lock::Guard g(_lock); Mutex::Guard guard(_mutex);
if (usb_raw.plugged()) if (usb_raw.plugged())
return; return;
@ -472,7 +472,7 @@ struct Usb_host_device : List<Usb_host_device>::Element
void destroy() void destroy()
{ {
Lock::Guard g(_lock); Mutex::Guard guard(_mutex);
_release_interfaces(); _release_interfaces();
@ -905,7 +905,7 @@ struct Usb_devices : List<Usb_host_device>
void _devices_update() void _devices_update()
{ {
Lock::Guard g(_lock); Mutex::Guard guard(_mutex);
_garbage_collect(); _garbage_collect();

View File

@ -40,7 +40,7 @@ extern "C" void _type_init_usb_host_register_types(Genode::Entrypoint*,
Genode::Env *); Genode::Env *);
extern "C" void _type_init_xhci_register_types(); extern "C" void _type_init_xhci_register_types();
extern Genode::Lock _lock; extern Genode::Mutex _mutex;
Qemu::Controller *qemu_controller(); Qemu::Controller *qemu_controller();
@ -81,7 +81,7 @@ void Qemu::usb_update_devices() {
void Qemu::usb_timer_callback(void (*cb)(void*), void *data) void Qemu::usb_timer_callback(void (*cb)(void*), void *data)
{ {
Genode::Lock::Guard g(_lock); Genode::Mutex::Guard guard(_mutex);
cb(data); cb(data);
} }
@ -545,7 +545,7 @@ struct Controller : public Qemu::Controller
int mmio_read(Genode::off_t offset, void *buf, Genode::size_t size) int mmio_read(Genode::off_t offset, void *buf, Genode::size_t size)
{ {
Genode::Lock::Guard g(_lock); Genode::Mutex::Guard guard(_mutex);
Mmio &mmio = find_region(offset); Mmio &mmio = find_region(offset);
Genode::off_t reg = offset - mmio.offset; Genode::off_t reg = offset - mmio.offset;
@ -571,7 +571,7 @@ struct Controller : public Qemu::Controller
int mmio_write(Genode::off_t offset, void const *buf, Genode::size_t size) int mmio_write(Genode::off_t offset, void const *buf, Genode::size_t size)
{ {
Genode::Lock::Guard g(_lock); Genode::Mutex::Guard guard(_mutex);
Mmio &mmio = find_region(offset); Mmio &mmio = find_region(offset);
Genode::off_t reg = offset - mmio.offset; Genode::off_t reg = offset - mmio.offset;
void *ptr = Object_pool::p()->xhci_state(); void *ptr = Object_pool::p()->xhci_state();