/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/locking.c

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-04 15:43:14 UTC
  • Revision ID: csa@suren.me-20160304154314-uor59rrkaw2hexm7
RPM generation

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
    if ((reused & PCILIB_KMEM_REUSE_REUSED) == 0) {
45
45
        for (i = 0; i < PCILIB_LOCK_PAGES; i++) {
46
 
            void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
 
46
            void *addr = (void*)pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
47
47
            memset(addr, 0, PCILIB_KMEM_PAGE_SIZE);
48
48
        }
49
49
    }
95
95
pcilib_lock_t *pcilib_get_lock_by_id(pcilib_t *ctx, pcilib_lock_id_t id) {
96
96
    int page = id / PCILIB_LOCKS_PER_PAGE;
97
97
    int offset = id - page * PCILIB_LOCKS_PER_PAGE;
98
 
    void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, page);
 
98
    volatile void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, page);
99
99
    pcilib_lock_t *lock = (pcilib_lock_t*)(addr + offset * PCILIB_LOCK_SIZE);
100
100
 
101
101
    return lock;
308
308
    }
309
309
 
310
310
    for (i = 0; i < PCILIB_LOCK_PAGES; i++) {
311
 
        void *addr = pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
 
311
        void *addr = (void*)pcilib_kmem_get_block_ua(ctx, ctx->locks.kmem, i);
312
312
        memset(addr, 0, PCILIB_KMEM_PAGE_SIZE);
313
313
    }
314
314