drm: Fix ww mutex crtc locking
commit4a1f0d757dc89c9bbe3a5b0e16c28eb180939912
authorFrançois Tigeot <ftigeot@wolfpond.org>
Thu, 24 Dec 2015 08:56:57 +0000 (24 09:56 +0100)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Thu, 24 Dec 2015 08:56:19 +0000 (24 09:56 +0100)
tree403e0db0327787b2a56d89c0141d4dc8dcb95d61
parent1e621377e89a1c11cf976f1ae7cd097ab7c29aa9
drm: Fix ww mutex crtc locking

* The original code had many problems:
  - the ctx wasn't available to drm_modeset_unlock().
  - 'struct list_head' was used for both the list head AND the list entry
  It's like it was coded to create maximum confusion on top of maximum pain

* drm_modeset_acquire_ctx structure needs a second list which we add
  kmalloc()'d entries to to track the extra locks in the EALREADY case

* Replace the reference from the modeset_lock structure with a pointer
  to an intermediate (kmalloc'd) structure that references both and turn
  the list entry in the lock into a list head

Submitted-by: Matthew Dillon <dillon@apollo.backplane.com>
sys/dev/drm/drm_modeset_lock.c
sys/dev/drm/include/drm/drm_modeset_lock.h