dde_linux: decouple Lx_kit::Irq and Platform::Device

Follow-up commit to fix the old usb_drv. Under rpi one and the
same irq can be requested several times. Therefore, we've to track
the Irq_connection objects.

Ref #3865
This commit is contained in:
Stefan Kalkowski 2020-08-25 15:13:41 +02:00 committed by Christian Helmuth
parent ace172ebf3
commit e29485fa59

View File

@ -47,9 +47,20 @@ void Lx::backend_free(Genode::Ram_dataspace_capability cap) {
extern "C" int request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
const char *name, void *dev)
{
Genode::Irq_connection * irq_con = new (Lx_kit::env().heap())
Genode::Irq_connection(Lx_kit::env().env(), irq);
Lx::Irq::irq().request_irq(irq_con->cap(), irq, handler, dev);
struct Irq : Genode::List<Irq>::Element {
unsigned const nr;
Genode::Irq_connection irq_con { Lx_kit::env().env(), nr };
Irq(unsigned const irq, Genode::List<Irq> & list)
: nr(irq) { list.insert(this); }
};
static Genode::List<Irq> irq_list;
Irq * i = irq_list.first();
for (; i; i = i->next()) { if (i->nr == irq) break; }
if (!i) i = new (Lx_kit::env().heap()) Irq(irq, irq_list);
Lx::Irq::irq().request_irq(i->irq_con.cap(), irq, handler, dev);
return 0;
}