CAPI: Rework locking of controller data structures