diff options
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/ramster/xvmalloc.c | 39 | ||||
-rw-r--r-- | drivers/staging/ramster/zcache-main.c | 20 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/cipher.c | 8 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/digest.c | 8 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/internal.h | 17 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/kmap_types.h | 20 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/scatterwalk.c | 19 | ||||
-rw-r--r-- | drivers/staging/zcache/zcache-main.c | 12 | ||||
-rw-r--r-- | drivers/staging/zram/zram_drv.c | 32 |
9 files changed, 64 insertions, 111 deletions
diff --git a/drivers/staging/ramster/xvmalloc.c b/drivers/staging/ramster/xvmalloc.c index 1f9c5082b6d5..93ba8e9407aa 100644 --- a/drivers/staging/ramster/xvmalloc.c +++ b/drivers/staging/ramster/xvmalloc.c @@ -56,17 +56,17 @@ static void clear_flag(struct block_header *block, enum blockflags flag) * This is called from xv_malloc/xv_free path, so it * needs to be fast. */ -static void *get_ptr_atomic(struct page *page, u16 offset, enum km_type type) +static void *get_ptr_atomic(struct page *page, u16 offset) { unsigned char *base; - base = kmap_atomic(page, type); + base = kmap_atomic(page); return base + offset; } -static void put_ptr_atomic(void *ptr, enum km_type type) +static void put_ptr_atomic(void *ptr) { - kunmap_atomic(ptr, type); + kunmap_atomic(ptr); } static u32 get_blockprev(struct block_header *block) @@ -202,10 +202,10 @@ static void insert_block(struct xv_pool *pool, struct page *page, u32 offset, if (block->link.next_page) { nextblock = get_ptr_atomic(block->link.next_page, - block->link.next_offset, KM_USER1); + block->link.next_offset); nextblock->link.prev_page = page; nextblock->link.prev_offset = offset; - put_ptr_atomic(nextblock, KM_USER1); + put_ptr_atomic(nextblock); /* If there was a next page then the free bits are set. */ return; } @@ -225,18 +225,18 @@ static void remove_block(struct xv_pool *pool, struct page *page, u32 offset, if (block->link.prev_page) { tmpblock = get_ptr_atomic(block->link.prev_page, - block->link.prev_offset, KM_USER1); + block->link.prev_offset); tmpblock->link.next_page = block->link.next_page; tmpblock->link.next_offset = block->link.next_offset; - put_ptr_atomic(tmpblock, KM_USER1); + put_ptr_atomic(tmpblock); } if (block->link.next_page) { tmpblock = get_ptr_atomic(block->link.next_page, - block->link.next_offset, KM_USER1); + block->link.next_offset); tmpblock->link.prev_page = block->link.prev_page; tmpblock->link.prev_offset = block->link.prev_offset; - put_ptr_atomic(tmpblock, KM_USER1); + put_ptr_atomic(tmpblock); } /* Is this block is at the head of the freelist? */ @@ -249,11 +249,10 @@ static void remove_block(struct xv_pool *pool, struct page *page, u32 offset, if (pool->freelist[slindex].page) { struct block_header *tmpblock; tmpblock = get_ptr_atomic(pool->freelist[slindex].page, - pool->freelist[slindex].offset, - KM_USER1); + pool->freelist[slindex].offset); tmpblock->link.prev_page = NULL; tmpblock->link.prev_offset = 0; - put_ptr_atomic(tmpblock, KM_USER1); + put_ptr_atomic(tmpblock); } else { /* This freelist bucket is empty */ __clear_bit(slindex % BITS_PER_LONG, @@ -284,7 +283,7 @@ static int grow_pool(struct xv_pool *pool, gfp_t flags) stat_inc(&pool->total_pages); spin_lock(&pool->lock); - block = get_ptr_atomic(page, 0, KM_USER0); + block = get_ptr_atomic(page, 0); block->size = PAGE_SIZE - XV_ALIGN; set_flag(block, BLOCK_FREE); @@ -293,7 +292,7 @@ static int grow_pool(struct xv_pool *pool, gfp_t flags) insert_block(pool, page, 0, block); - put_ptr_atomic(block, KM_USER0); + put_ptr_atomic(block); spin_unlock(&pool->lock); return 0; @@ -375,7 +374,7 @@ int xv_malloc(struct xv_pool *pool, u32 size, struct page **page, return -ENOMEM; } - block = get_ptr_atomic(*page, *offset, KM_USER0); + block = get_ptr_atomic(*page, *offset); remove_block(pool, *page, *offset, block, index); @@ -405,7 +404,7 @@ int xv_malloc(struct xv_pool *pool, u32 size, struct page **page, block->size = origsize; clear_flag(block, BLOCK_FREE); - put_ptr_atomic(block, KM_USER0); + put_ptr_atomic(block); spin_unlock(&pool->lock); *offset += XV_ALIGN; @@ -426,7 +425,7 @@ void xv_free(struct xv_pool *pool, struct page *page, u32 offset) spin_lock(&pool->lock); - page_start = get_ptr_atomic(page, 0, KM_USER0); + page_start = get_ptr_atomic(page, 0); block = (struct block_header *)((char *)page_start + offset); /* Catch double free bugs */ @@ -468,7 +467,7 @@ void xv_free(struct xv_pool *pool, struct page *page, u32 offset) /* No used objects in this page. Free it. */ if (block->size == PAGE_SIZE - XV_ALIGN) { - put_ptr_atomic(page_start, KM_USER0); + put_ptr_atomic(page_start); spin_unlock(&pool->lock); __free_page(page); @@ -486,7 +485,7 @@ void xv_free(struct xv_pool *pool, struct page *page, u32 offset) set_blockprev(tmpblock, offset); } - put_ptr_atomic(page_start, KM_USER0); + put_ptr_atomic(page_start); spin_unlock(&pool->lock); } EXPORT_SYMBOL_GPL(xv_free); diff --git a/drivers/staging/ramster/zcache-main.c b/drivers/staging/ramster/zcache-main.c index 36d53ed9d71a..68b2e053a0e6 100644 --- a/drivers/staging/ramster/zcache-main.c +++ b/drivers/staging/ramster/zcache-main.c @@ -496,13 +496,13 @@ static int zbud_decompress(struct page *page, struct zbud_hdr *zh) } ASSERT_SENTINEL(zh, ZBH); BUG_ON(zh->size == 0 || zh->size > zbud_max_buddy_size()); - to_va = kmap_atomic(page, KM_USER0); + to_va = kmap_atomic(page); size = zh->size; from_va = zbud_data(zh, size); ret = lzo1x_decompress_safe(from_va, size, to_va, &out_len); BUG_ON(ret != LZO_E_OK); BUG_ON(out_len != PAGE_SIZE); - kunmap_atomic(to_va, KM_USER0); + kunmap_atomic(to_va); out: spin_unlock(&zbpg->lock); return ret; @@ -1109,7 +1109,7 @@ static struct zv_hdr *zv_create(struct zcache_client *cli, uint32_t pool_id, goto out; atomic_inc(&zv_curr_dist_counts[chunks]); atomic_inc(&zv_cumul_dist_counts[chunks]); - zv = kmap_atomic(page, KM_USER0) + offset; + zv = kmap_atomic(page) + offset; zv->index = index; zv->oid = *oid; zv->pool_id = pool_id; @@ -1123,7 +1123,7 @@ static struct zv_hdr *zv_create(struct zcache_client *cli, uint32_t pool_id, spin_unlock(&zcache_rem_op_list_lock); } memcpy((char *)zv + sizeof(struct zv_hdr), cdata, clen); - kunmap_atomic(zv, KM_USER0); + kunmap_atomic(zv); out: return zv; } @@ -1145,7 +1145,7 @@ static struct zv_hdr *zv_alloc(struct tmem_pool *pool, &page, &offset, ZCACHE_GFP_MASK); if (unlikely(ret)) goto out; - zv = kmap_atomic(page, KM_USER0) + offset; + zv = kmap_atomic(page) + offset; SET_SENTINEL(zv, ZVH); INIT_LIST_HEAD(&zv->rem_op.list); zv->client_id = LOCAL_CLIENT; @@ -1153,7 +1153,7 @@ static struct zv_hdr *zv_alloc(struct tmem_pool *pool, zv->index = index; zv->oid = *oid; zv->pool_id = pool->pool_id; - kunmap_atomic(zv, KM_USER0); + kunmap_atomic(zv); out: return zv; } @@ -1194,10 +1194,10 @@ static void zv_decompress(struct page *page, struct zv_hdr *zv) ASSERT_SENTINEL(zv, ZVH); size = xv_get_object_size(zv) - sizeof(*zv); BUG_ON(size == 0); - to_va = kmap_atomic(page, KM_USER0); + to_va = kmap_atomic(page); ret = lzo1x_decompress_safe((char *)zv + sizeof(*zv), size, to_va, &clen); - kunmap_atomic(to_va, KM_USER0); + kunmap_atomic(to_va); BUG_ON(ret != LZO_E_OK); BUG_ON(clen != PAGE_SIZE); } @@ -2203,12 +2203,12 @@ static int zcache_compress(struct page *from, void **out_va, size_t *out_len) BUG_ON(!irqs_disabled()); if (unlikely(dmem == NULL || wmem == NULL)) goto out; /* no buffer, so can't compress */ - from_va = kmap_atomic(from, KM_USER0); + from_va = kmap_atomic(from); mb(); ret = lzo1x_1_compress(from_va, PAGE_SIZE, dmem, out_len, wmem); BUG_ON(ret != LZO_E_OK); *out_va = dmem; - kunmap_atomic(from_va, KM_USER0); + kunmap_atomic(from_va); ret = 1; out: return ret; diff --git a/drivers/staging/rtl8192u/ieee80211/cipher.c b/drivers/staging/rtl8192u/ieee80211/cipher.c index 69dcc3176ebc..d47345c4adcf 100644 --- a/drivers/staging/rtl8192u/ieee80211/cipher.c +++ b/drivers/staging/rtl8192u/ieee80211/cipher.c @@ -71,8 +71,8 @@ static int crypt(struct crypto_tfm *tfm, u8 *src_p, *dst_p; int in_place; - scatterwalk_map(&walk_in, 0); - scatterwalk_map(&walk_out, 1); + scatterwalk_map(&walk_in); + scatterwalk_map(&walk_out); src_p = scatterwalk_whichbuf(&walk_in, bsize, tmp_src); dst_p = scatterwalk_whichbuf(&walk_out, bsize, tmp_dst); in_place = scatterwalk_samebuf(&walk_in, &walk_out, @@ -84,10 +84,10 @@ static int crypt(struct crypto_tfm *tfm, prfn(tfm, dst_p, src_p, crfn, enc, info, in_place); - scatterwalk_done(&walk_in, 0, nbytes); + scatterwalk_done(&walk_in, nbytes); scatterwalk_copychunks(dst_p, &walk_out, bsize, 1); - scatterwalk_done(&walk_out, 1, nbytes); + scatterwalk_done(&walk_out, nbytes); if (!nbytes) return 0; diff --git a/drivers/staging/rtl8192u/ieee80211/digest.c b/drivers/staging/rtl8192u/ieee80211/digest.c index 301ed514ac9e..05e7497fd106 100644 --- a/drivers/staging/rtl8192u/ieee80211/digest.c +++ b/drivers/staging/rtl8192u/ieee80211/digest.c @@ -39,12 +39,12 @@ static void update(struct crypto_tfm *tfm, unsigned int bytes_from_page = min(l, ((unsigned int) (PAGE_SIZE)) - offset); - char *p = crypto_kmap(pg, 0) + offset; + char *p = kmap_atomic(pg) + offset; tfm->__crt_alg->cra_digest.dia_update (crypto_tfm_ctx(tfm), p, bytes_from_page); - crypto_kunmap(p, 0); + kunmap_atomic(p); crypto_yield(tfm); offset = 0; pg++; @@ -75,10 +75,10 @@ static void digest(struct crypto_tfm *tfm, tfm->crt_digest.dit_init(tfm); for (i = 0; i < nsg; i++) { - char *p = crypto_kmap(sg[i].page, 0) + sg[i].offset; + char *p = kmap_atomic(sg[i].page) + sg[i].offset; tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm), p, sg[i].length); - crypto_kunmap(p, 0); + kunmap_atomic(p); crypto_yield(tfm); } crypto_digest_final(tfm, out); diff --git a/drivers/staging/rtl8192u/ieee80211/internal.h b/drivers/staging/rtl8192u/ieee80211/internal.h index a7c096eb269f..bebe13ac53b7 100644 --- a/drivers/staging/rtl8192u/ieee80211/internal.h +++ b/drivers/staging/rtl8192u/ieee80211/internal.h @@ -23,23 +23,6 @@ #include <asm/kmap_types.h> -extern enum km_type crypto_km_types[]; - -static inline enum km_type crypto_kmap_type(int out) -{ - return crypto_km_types[(in_softirq() ? 2 : 0) + out]; -} - -static inline void *crypto_kmap(struct page *page, int out) -{ - return kmap_atomic(page, crypto_kmap_type(out)); -} - -static inline void crypto_kunmap(void *vaddr, int out) -{ - kunmap_atomic(vaddr, crypto_kmap_type(out)); -} - static inline void crypto_yield(struct crypto_tfm *tfm) { if (!in_softirq()) diff --git a/drivers/staging/rtl8192u/ieee80211/kmap_types.h b/drivers/staging/rtl8192u/ieee80211/kmap_types.h deleted file mode 100644 index de67bb01b5f5..000000000000 --- a/drivers/staging/rtl8192u/ieee80211/kmap_types.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __KMAP_TYPES_H - -#define __KMAP_TYPES_H - - -enum km_type { - KM_BOUNCE_READ, - KM_SKB_SUNRPC_DATA, - KM_SKB_DATA_SOFTIRQ, - KM_USER0, - KM_USER1, - KM_BH_IRQ, - KM_SOFTIRQ0, - KM_SOFTIRQ1, - KM_TYPE_NR -}; - -#define _ASM_KMAP_TYPES_H - -#endif diff --git a/drivers/staging/rtl8192u/ieee80211/scatterwalk.c b/drivers/staging/rtl8192u/ieee80211/scatterwalk.c index 3543a6145046..8b73f6cefcf9 100644 --- a/drivers/staging/rtl8192u/ieee80211/scatterwalk.c +++ b/drivers/staging/rtl8192u/ieee80211/scatterwalk.c @@ -13,8 +13,6 @@ * any later version. * */ -#include "kmap_types.h" - #include <linux/kernel.h> #include <linux/mm.h> #include <linux/pagemap.h> @@ -23,13 +21,6 @@ #include "internal.h" #include "scatterwalk.h" -enum km_type crypto_km_types[] = { - KM_USER0, - KM_USER1, - KM_SOFTIRQ0, - KM_SOFTIRQ1, -}; - void *scatterwalk_whichbuf(struct scatter_walk *walk, unsigned int nbytes, void *scratch) { if (nbytes <= walk->len_this_page && @@ -62,9 +53,9 @@ void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg) walk->offset = sg->offset; } -void scatterwalk_map(struct scatter_walk *walk, int out) +void scatterwalk_map(struct scatter_walk *walk) { - walk->data = crypto_kmap(walk->page, out) + walk->offset; + walk->data = kmap_atomic(walk->page) + walk->offset; } static void scatterwalk_pagedone(struct scatter_walk *walk, int out, @@ -103,7 +94,7 @@ void scatterwalk_done(struct scatter_walk *walk, int out, int more) * has been verified as multiple of the block size. */ int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, - size_t nbytes, int out) + size_t nbytes) { if (buf != walk->data) { while (nbytes > walk->len_this_page) { @@ -111,9 +102,9 @@ int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, buf += walk->len_this_page; nbytes -= walk->len_this_page; - crypto_kunmap(walk->data, out); + kunmap_atomic(walk->data); scatterwalk_pagedone(walk, out, 1); - scatterwalk_map(walk, out); + scatterwalk_map(walk); } memcpy_dir(buf, walk->data, nbytes, out); diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 70734652f724..ed2c800b3a7e 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -455,14 +455,14 @@ static int zbud_decompress(struct page *page, struct zbud_hdr *zh) } ASSERT_SENTINEL(zh, ZBH); BUG_ON(zh->size == 0 || zh->size > zbud_max_buddy_size()); - to_va = kmap_atomic(page, KM_USER0); + to_va = kmap_atomic(page); size = zh->size; from_va = zbud_data(zh, size); ret = zcache_comp_op(ZCACHE_COMPOP_DECOMPRESS, from_va, size, to_va, &out_len); BUG_ON(ret); BUG_ON(out_len != PAGE_SIZE); - kunmap_atomic(to_va, KM_USER0); + kunmap_atomic(to_va); out: spin_unlock(&zbpg->lock); return ret; @@ -753,10 +753,10 @@ static void zv_decompress(struct page *page, void *handle) zv = zs_map_object(zcache_host.zspool, handle); BUG_ON(zv->size == 0); ASSERT_SENTINEL(zv, ZVH); - to_va = kmap_atomic(page, KM_USER0); + to_va = kmap_atomic(page); ret = zcache_comp_op(ZCACHE_COMPOP_DECOMPRESS, (char *)zv + sizeof(*zv), zv->size, to_va, &clen); - kunmap_atomic(to_va, KM_USER0); + kunmap_atomic(to_va); zs_unmap_object(zcache_host.zspool, handle); BUG_ON(ret); BUG_ON(clen != PAGE_SIZE); @@ -1334,13 +1334,13 @@ static int zcache_compress(struct page *from, void **out_va, unsigned *out_len) if (unlikely(dmem == NULL)) goto out; /* no buffer or no compressor so can't compress */ *out_len = PAGE_SIZE << ZCACHE_DSTMEM_ORDER; - from_va = kmap_atomic(from, KM_USER0); + from_va = kmap_atomic(from); mb(); ret = zcache_comp_op(ZCACHE_COMPOP_COMPRESS, from_va, PAGE_SIZE, dmem, out_len); BUG_ON(ret); *out_va = dmem; - kunmap_atomic(from_va, KM_USER0); + kunmap_atomic(from_va); ret = 1; out: return ret; diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 7f138196b3c9..685d612a627b 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -175,9 +175,9 @@ static void handle_zero_page(struct bio_vec *bvec) struct page *page = bvec->bv_page; void *user_mem; - user_mem = kmap_atomic(page, KM_USER0); + user_mem = kmap_atomic(page); memset(user_mem + bvec->bv_offset, 0, bvec->bv_len); - kunmap_atomic(user_mem, KM_USER0); + kunmap_atomic(user_mem); flush_dcache_page(page); } @@ -188,12 +188,12 @@ static void handle_uncompressed_page(struct zram *zram, struct bio_vec *bvec, struct page *page = bvec->bv_page; unsigned char *user_mem, *cmem; - user_mem = kmap_atomic(page, KM_USER0); - cmem = kmap_atomic(zram->table[index].handle, KM_USER1); + user_mem = kmap_atomic(page); + cmem = kmap_atomic(zram->table[index].handle); memcpy(user_mem + bvec->bv_offset, cmem + offset, bvec->bv_len); - kunmap_atomic(cmem, KM_USER1); - kunmap_atomic(user_mem, KM_USER0); + kunmap_atomic(cmem); + kunmap_atomic(user_mem); flush_dcache_page(page); } @@ -242,7 +242,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, } } - user_mem = kmap_atomic(page, KM_USER0); + user_mem = kmap_atomic(page); if (!is_partial_io(bvec)) uncmem = user_mem; clen = PAGE_SIZE; @@ -260,7 +260,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, } zs_unmap_object(zram->mem_pool, zram->table[index].handle); - kunmap_atomic(user_mem, KM_USER0); + kunmap_atomic(user_mem); /* Should NEVER happen. Return bio error if it does. */ if (unlikely(ret != LZO_E_OK)) { @@ -292,7 +292,7 @@ static int zram_read_before_write(struct zram *zram, char *mem, u32 index) /* Page is stored uncompressed since it's incompressible */ if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { memcpy(mem, cmem, PAGE_SIZE); - kunmap_atomic(cmem, KM_USER0); + kunmap_atomic(cmem); return 0; } @@ -351,7 +351,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, zram_test_flag(zram, index, ZRAM_ZERO)) zram_free_page(zram, index); - user_mem = kmap_atomic(page, KM_USER0); + user_mem = kmap_atomic(page); if (is_partial_io(bvec)) memcpy(uncmem + offset, user_mem + bvec->bv_offset, @@ -360,7 +360,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, uncmem = user_mem; if (page_zero_filled(uncmem)) { - kunmap_atomic(user_mem, KM_USER0); + kunmap_atomic(user_mem); if (is_partial_io(bvec)) kfree(uncmem); zram_stat_inc(&zram->stats.pages_zero); @@ -372,7 +372,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen, zram->compress_workmem); - kunmap_atomic(user_mem, KM_USER0); + kunmap_atomic(user_mem); if (is_partial_io(bvec)) kfree(uncmem); @@ -400,8 +400,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, zram_set_flag(zram, index, ZRAM_UNCOMPRESSED); zram_stat_inc(&zram->stats.pages_expand); handle = page_store; - src = kmap_atomic(page, KM_USER0); - cmem = kmap_atomic(page_store, KM_USER1); + src = kmap_atomic(page); + cmem = kmap_atomic(page_store); goto memstore; } @@ -427,8 +427,8 @@ memstore: memcpy(cmem, src, clen); if (unlikely(zram_test_flag(zram, index, ZRAM_UNCOMPRESSED))) { - kunmap_atomic(cmem, KM_USER1); - kunmap_atomic(src, KM_USER0); + kunmap_atomic(cmem); + kunmap_atomic(src); } else { zs_unmap_object(zram->mem_pool, handle); } |