habanalabs: maintain a list of file private data objects
authorOded Gabbay <oded.gabbay@gmail.com>
Tue, 30 Jul 2019 08:56:09 +0000 (11:56 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Thu, 5 Sep 2019 11:55:26 +0000 (14:55 +0300)
commiteb7caf84b029387fe5addb484a0fc5792a9058e1
treeef8f47ebec036c8eb39a5a93ebfb95f453b5f856
parent86d5307a6d3507258460939fab040c6aafb506f9
habanalabs: maintain a list of file private data objects

This patch adds a new list to the driver's device structure. The list will
keep the file private data structures that the driver creates when a user
process opens the device.

This change is needed because it is useless to try to count how many FD
are open. Instead, track our own private data structure per open file and
once it is released, remove it from the list. As long as the list is not
empty, it means we have a user that can do something with our device.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/habanalabs/device.c
drivers/misc/habanalabs/goya/goya_hwmgr.c
drivers/misc/habanalabs/habanalabs.h
drivers/misc/habanalabs/habanalabs_drv.c