habanalabs: add return code field to module iterator
authorOhad Sharabi <osharabi@habana.ai>
Wed, 13 Jul 2022 10:47:23 +0000 (13:47 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Sun, 18 Sep 2022 10:29:49 +0000 (13:29 +0300)
commit913bd4179b82adfeece29243711ccaf4330772b6
tree8c066704bb3d4523af4a46c472c8a1b14c3822e0
parent28742772a0bb798f67a774e91172e06a18cd9855
habanalabs: add return code field to module iterator

Up until now the module iterator called void callback functions
and so caller activating callback that may fail suffered from 2 issues:
1. The need to "plant" return called in the private data. This is a
   drawback since the iterator itself should not be aware of the private
   data of the caller.
2. Due to 1 even in a failure the iterator would keep iterating instead
   of break upon error.

To overcome this an optional rc field added to the iterator context.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/habanalabs.h
drivers/misc/habanalabs/gaudi2/gaudi2.c
drivers/misc/habanalabs/gaudi2/gaudi2_security.c