• Nick Crews's avatar
    platform/chrome: wilco_ec: Add circular buffer as event queue · 1d333ef3
    Nick Crews authored
    The current implementation of the event queue both
    wastes space using a doubly linked list and isn't super
    obvious in how it behaves. This converts the queue to an
    actual circular buffer. The size of the queue is a
    tunable module parameter. This also fixes a few other things:
    
    - A memory leak that occurred when the ACPI device was
      removed, but the events were not freed from the queue.
    - Now kfree() the oldest event from outside all locks.
    - Add newline to logging messages.
    - Add helper macros to calculate size of events.
    - Remove unneeded lock around a check for dev_data->exist
      in hangup_device().
    - Remove an unneeded null event pointer check in enqueue_events().
    - Correct some comments.
    Signed-off-by: default avatarNick Crews <ncrews@chromium.org>
    Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
    1d333ef3
event.c 16.5 KB