astlpc: Remove redundant lpc_map_base member from context struct
We only make use of lpc_map once we've established where the structure
lives in the LPC FW address space; there's no need to carry lpc_map_base
around beyond this initial calculation.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ib341643b936c10e386d67934a5d92fb59dd5b477
diff --git a/astlpc.c b/astlpc.c
index 320be6a..6abb123 100644
--- a/astlpc.c
+++ b/astlpc.c
@@ -61,9 +61,8 @@
void *ops_data;
/* fileio ops data */
- void *lpc_map_base;
- int kcs_fd;
- uint8_t kcs_status;
+ int kcs_fd;
+ uint8_t kcs_status;
bool running;
};
@@ -623,6 +622,7 @@
.offset = 0,
.size = 0
};
+ void *lpc_map_base;
int fd, rc;
fd = open(lpc_path, O_RDWR | O_SYNC);
@@ -638,14 +638,13 @@
return -1;
}
- astlpc->lpc_map_base = mmap(NULL, map.size, PROT_READ | PROT_WRITE,
- MAP_SHARED, fd, 0);
- if (astlpc->lpc_map_base == MAP_FAILED) {
+ lpc_map_base =
+ mmap(NULL, map.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (lpc_map_base == MAP_FAILED) {
astlpc_prwarn(astlpc, "LPC mmap failed");
rc = -1;
} else {
- astlpc->lpc_map = astlpc->lpc_map_base +
- map.size - LPC_WIN_SIZE;
+ astlpc->lpc_map = lpc_map_base + map.size - LPC_WIN_SIZE;
}
close(fd);