From 168cd4216dcd5641be57abb7e0519d40a2c426fa Mon Sep 17 00:00:00 2001
From: Petr Zejdl <petr.zejdl@cern.ch>
Date: Thu, 17 Nov 2022 15:59:19 +0100
Subject: [PATCH] Fixing the inconsistency in the variable names

---
 src/wz_dma.c | 10 +++++-----
 src/wz_dma.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/wz_dma.c b/src/wz_dma.c
index 5a4dedba..c2f18d5c 100644
--- a/src/wz_dma.c
+++ b/src/wz_dma.c
@@ -17,10 +17,10 @@
 
 /*
  * Open necessary devices and map DMAable memory.
- * Variable user_regs_size is the size (in power of 2) of the user memory space that should be allocated for I/O communication with the hardware.
+ * Variable usr_regs_size is the size (in power of 2) of the user memory space that should be allocated for I/O communication with the hardware.
  * Set to 0 if not necessary.
  */
-int wz_init(struct wz_private* wz, size_t user_regs_size)
+int wz_init(struct wz_private* wz, size_t usr_regs_size)
 {
 	int res;
 
@@ -28,7 +28,7 @@ int wz_init(struct wz_private* wz, size_t user_regs_size)
 	wz->fd_control = -1;
 	wz->fd_memory = -1;
 	wz->fd_memory_is_allocated = 0;
-	wz->user_regs_size = user_regs_size;
+	wz->usr_regs_size = usr_regs_size;
 	wz->usr_regs = NULL;
 	wz->data_buf = NULL;
 
@@ -62,7 +62,7 @@ int wz_init(struct wz_private* wz, size_t user_regs_size)
 	wz->fd_memory_is_allocated = 1;
 
 	//Now mmap the user registers
-	if (user_regs_size && ((wz->usr_regs = (volatile uint32_t *) mmap(NULL, wz->user_regs_size, PROT_READ | PROT_WRITE, MAP_SHARED, wz->fd_user, 0)) == MAP_FAILED)) {
+	if (wz->usr_regs_size && ((wz->usr_regs = (volatile uint32_t *) mmap(NULL, wz->usr_regs_size, PROT_READ | PROT_WRITE, MAP_SHARED, wz->fd_user, 0)) == MAP_FAILED)) {
 		wz->usr_regs = NULL;
 		PERROR("Can't mmap user registers");
 		wz_close(wz);
@@ -95,7 +95,7 @@ int wz_close(struct wz_private* wz)
 		munmap((void *)wz->data_buf, TOT_BUF_LEN);
 	}
 	if (wz->usr_regs) {
-		munmap((void *)wz->usr_regs, wz->user_regs_size);
+		munmap((void *)wz->usr_regs, wz->usr_regs_size);
 	}
 	if (wz->fd_memory_is_allocated) {
 		ioctl(wz->fd_memory, IOCTL_XDMA_WZ_FREE_BUFFERS, 0L);
diff --git a/src/wz_dma.h b/src/wz_dma.h
index 01844c43..2fe79239 100644
--- a/src/wz_dma.h
+++ b/src/wz_dma.h
@@ -12,7 +12,7 @@ struct wz_private {
   int fd_control;
   int fd_memory;
   int fd_memory_is_allocated;
-  size_t user_regs_size;
+  size_t usr_regs_size;
   volatile uint32_t *usr_regs;
   volatile char *data_buf;
 };
-- 
GitLab