loop: replace linked list of allocated devices with an idr index