mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
platform_drv: do not return cap of device twice
When a device got already acquired by a platform session client, do not return the same capability again, even if the same platform session client requested it. Therefore, make doubtful behaviour of client components visible, and do not have to struggle with Platform::Device instances instantiated multiple times, which care of the lifetime of the device capability internally. Fix genodelabs/genode#4379
This commit is contained in:
parent
e595b0b782
commit
b5e327e3e9
@ -132,15 +132,6 @@ Session_component::acquire_device(Platform::Session::Device_name const &name)
|
||||
{
|
||||
Capability<Platform::Device_interface> cap;
|
||||
|
||||
/* Search for existing, aquired device session */
|
||||
_device_registry.for_each([&] (Device_component & dc) {
|
||||
if (dc.device() == name)
|
||||
cap = dc.cap();
|
||||
});
|
||||
|
||||
if (cap.valid())
|
||||
return cap;
|
||||
|
||||
_devices.for_each([&] (Device & dev)
|
||||
{
|
||||
if (dev.name() != name || !matches(dev))
|
||||
@ -160,13 +151,6 @@ Session_component::acquire_single_device()
|
||||
{
|
||||
Capability<Platform::Device_interface> cap;
|
||||
|
||||
/* Search for existing, aquired device session */
|
||||
_device_registry.for_each([&] (Device_component & dc) {
|
||||
cap = dc.cap(); });
|
||||
|
||||
if (cap.valid())
|
||||
return cap;
|
||||
|
||||
_devices.for_each([&] (Device & dev) {
|
||||
if (matches(dev) && !dev.owner().valid())
|
||||
cap = _acquire(dev); });
|
||||
|
Loading…
Reference in New Issue
Block a user