astlpc: Avoid requiring off_t
off_t is spec'ed to be defined in sys/types.h, however not all
environments define it. The LPC FW address space is only 27 bits, so a
long will be more than sufficient.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I44af91b8a98a08daace05e41f4928832bbdde5b7
diff --git a/libmctp-astlpc.h b/libmctp-astlpc.h
index 9759ff1..7ac8ca5 100644
--- a/libmctp-astlpc.h
+++ b/libmctp-astlpc.h
@@ -7,7 +7,6 @@
extern "C" {
#endif
-#include <unistd.h>
#include <libmctp.h>
struct mctp_binding_astlpc;
@@ -22,8 +21,8 @@
uint8_t *val);
int (*kcs_write)(void *data, enum mctp_binding_astlpc_kcs_reg reg,
uint8_t val);
- int (*lpc_read)(void *data, void *buf, off_t offset, size_t len);
- int (*lpc_write)(void *data, void *buf, off_t offset, size_t len);
+ int (*lpc_read)(void *data, void *buf, long offset, size_t len);
+ int (*lpc_write)(void *data, void *buf, long offset, size_t len);
};
struct mctp_binding_astlpc *mctp_astlpc_init_ops(
diff --git a/tests/test_astlpc.c b/tests/test_astlpc.c
index 17651e0..efa38ab 100644
--- a/tests/test_astlpc.c
+++ b/tests/test_astlpc.c
@@ -98,28 +98,30 @@
return 0;
}
-int mctp_astlpc_mmio_lpc_read(void *data, void *buf, off_t offset, size_t len)
+int mctp_astlpc_mmio_lpc_read(void *data, void *buf, long offset, size_t len)
{
struct mctp_binding_astlpc_mmio *mmio = binding_to_mmio(data);
+ assert(offset >= 0L);
assert(offset + len < mmio->lpc_size);
memcpy(buf, mmio->lpc + offset, len);
- mctp_prdebug("%s: %zu bytes from 0x%zx", __func__, len, offset);
+ mctp_prdebug("%s: %zu bytes from 0x%lx", __func__, len, offset);
return 0;
}
-int mctp_astlpc_mmio_lpc_write(void *data, void *buf, off_t offset, size_t len)
+int mctp_astlpc_mmio_lpc_write(void *data, void *buf, long offset, size_t len)
{
struct mctp_binding_astlpc_mmio *mmio = binding_to_mmio(data);
+ assert(offset >= 0L);
assert(offset + len < mmio->lpc_size);
memcpy(mmio->lpc + offset, buf, len);
- mctp_prdebug("%s: %zu bytes to 0x%zx", __func__, len, offset);
+ mctp_prdebug("%s: %zu bytes to 0x%lx", __func__, len, offset);
return 0;
}