v4l2-event: Remove pending events from fh event queue when unsubscribing
Hi,
Quoted 5 lines · hverkuil
Quoted 2 lines
This patch fixes these dangling pointers in the available queue by removing all matching pending events on unsubscription.
The idea is fine, but the implementation is inefficient.
Quoted 8 lines
Instead of the
list_for_each_entry_safeyou can just do:for (i = 0; i < sev->in_use; i++) { list_del(&sev->events[sev_pos(sev, i)].list); fh->navailable--; }It's untested, but this should do the trick.
Agreed, I've modified my patch to use this construction instead.
Regards,
Hans