summaryrefslogtreecommitdiffstats
path: root/pcilib/bar.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcilib/bar.c')
-rw-r--r--pcilib/bar.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pcilib/bar.c b/pcilib/bar.c
index 17828a8..418f864 100644
--- a/pcilib/bar.c
+++ b/pcilib/bar.c
@@ -80,7 +80,7 @@ void *pcilib_map_bar(pcilib_t *ctx, pcilib_bar_t bar) {
if (ctx->bar_space[bar]) return ctx->bar_space[bar];
- err = pcilib_lock(ctx->locks.mmap);
+ err = pcilib_lock_global(ctx);
if (err) {
pcilib_error("Error (%i) acquiring mmap lock", err);
return NULL;
@@ -88,14 +88,14 @@ void *pcilib_map_bar(pcilib_t *ctx, pcilib_bar_t bar) {
ret = ioctl( ctx->handle, PCIDRIVER_IOC_MMAP_MODE, PCIDRIVER_MMAP_PCI );
if (ret) {
- pcilib_unlock(ctx->locks.mmap);
+ pcilib_unlock_global(ctx);
pcilib_error("PCIDRIVER_IOC_MMAP_MODE ioctl have failed", bar);
return NULL;
}
ret = ioctl( ctx->handle, PCIDRIVER_IOC_MMAP_AREA, PCIDRIVER_BAR0 + bar );
if (ret) {
- pcilib_unlock(ctx->locks.mmap);
+ pcilib_unlock_global(ctx);
pcilib_error("PCIDRIVER_IOC_MMAP_AREA ioctl have failed for bank %i", bar);
return NULL;
}
@@ -106,7 +106,8 @@ void *pcilib_map_bar(pcilib_t *ctx, pcilib_bar_t bar) {
#else
res = mmap( 0, board_info->bar_length[bar], PROT_WRITE | PROT_READ, MAP_SHARED, ctx->handle, 0 );
#endif
- pcilib_unlock(ctx->locks.mmap);
+
+ pcilib_unlock_global(ctx);
if ((!res)||(res == MAP_FAILED)) {
pcilib_error("Failed to mmap data bank %i", bar);