habanalabs: unify code for memory access from debugfs
authorDafna Hirschfeld <dhirschfeld@habana.ai>
Wed, 23 Mar 2022 15:21:56 +0000 (17:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 May 2022 19:01:16 +0000 (21:01 +0200)
commitee8a10c833c4a49720055f23eeb215352b969bda
tree70852319f6a8e7c49d097f5cb21d5a91217d6a36
parent234366d3b6dac33dc6f78abf0fbc4abe9bae986b
habanalabs: unify code for memory access from debugfs

Currently each asic version implements 4 callbacks:
'debugfs_{read32/write32/read64/write64}'
There is a lot of code duplication among the different
callbacks of all asic versions.
This patch unify the code in order to avoid the code
duplication by iterating the pci_mem_region array
in hl_device and use its fields instead of macros.

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/habanalabs/common/debugfs.c