aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto/scatterwalk.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/crypto/scatterwalk.h')
-rw-r--r--include/crypto/scatterwalk.h28
1 files changed, 3 insertions, 25 deletions
diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 4fd95a323beb..3744d2a642df 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -25,28 +25,6 @@
25#include <linux/scatterlist.h> 25#include <linux/scatterlist.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27 27
28static inline enum km_type crypto_kmap_type(int out)
29{
30 enum km_type type;
31
32 if (in_softirq())
33 type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0;
34 else
35 type = out * (KM_USER1 - KM_USER0) + KM_USER0;
36
37 return type;
38}
39
40static inline void *crypto_kmap(struct page *page, int out)
41{
42 return kmap_atomic(page, crypto_kmap_type(out));
43}
44
45static inline void crypto_kunmap(void *vaddr, int out)
46{
47 kunmap_atomic(vaddr, crypto_kmap_type(out));
48}
49
50static inline void crypto_yield(u32 flags) 28static inline void crypto_yield(u32 flags)
51{ 29{
52 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP) 30 if (flags & CRYPTO_TFM_REQ_MAY_SLEEP)
@@ -121,15 +99,15 @@ static inline struct page *scatterwalk_page(struct scatter_walk *walk)
121 return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); 99 return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
122} 100}
123 101
124static inline void scatterwalk_unmap(void *vaddr, int out) 102static inline void scatterwalk_unmap(void *vaddr)
125{ 103{
126 crypto_kunmap(vaddr, out); 104 kunmap_atomic(vaddr);
127} 105}
128 106
129void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); 107void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg);
130void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, 108void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
131 size_t nbytes, int out); 109 size_t nbytes, int out);
132void *scatterwalk_map(struct scatter_walk *walk, int out); 110void *scatterwalk_map(struct scatter_walk *walk);
133void scatterwalk_done(struct scatter_walk *walk, int out, int more); 111void scatterwalk_done(struct scatter_walk *walk, int out, int more);
134 112
135void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, 113void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,