Commit 70dec235d8ac8cfb56ed2a3597e7d6c5b801f018
Committed by
David S. Miller
1 parent
3c09f17c3d
Exists in
master
and in
4 other branches
[CRYPTO] api: Kill crypto_km_types
When scatterwalk is built as a module digest.c was broken because it requires the crypto_km_types structure which is in scatterwalk. This patch removes the crypto_km_types structure by encoding the logic into crypto_kmap_type directly. In fact, this even saves a few bytes of code (not to mention the data structure itself) on i386 which is about the only place where it's needed. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Showing 2 changed files with 8 additions and 11 deletions Side-by-side Diff
crypto/internal.h
... | ... | @@ -50,11 +50,16 @@ |
50 | 50 | extern struct rw_semaphore crypto_alg_sem; |
51 | 51 | extern struct blocking_notifier_head crypto_chain; |
52 | 52 | |
53 | -extern enum km_type crypto_km_types[]; | |
54 | - | |
55 | 53 | static inline enum km_type crypto_kmap_type(int out) |
56 | 54 | { |
57 | - return crypto_km_types[(in_softirq() ? 2 : 0) + out]; | |
55 | + enum km_type type; | |
56 | + | |
57 | + if (in_softirq()) | |
58 | + type = out * (KM_SOFTIRQ1 - KM_SOFTIRQ0) + KM_SOFTIRQ0; | |
59 | + else | |
60 | + type = out * (KM_USER1 - KM_USER0) + KM_USER0; | |
61 | + | |
62 | + return type; | |
58 | 63 | } |
59 | 64 | |
60 | 65 | static inline void *crypto_kmap(struct page *page, int out) |
crypto/scatterwalk.c
... | ... | @@ -23,14 +23,6 @@ |
23 | 23 | #include "internal.h" |
24 | 24 | #include "scatterwalk.h" |
25 | 25 | |
26 | -enum km_type crypto_km_types[] = { | |
27 | - KM_USER0, | |
28 | - KM_USER1, | |
29 | - KM_SOFTIRQ0, | |
30 | - KM_SOFTIRQ1, | |
31 | -}; | |
32 | -EXPORT_SYMBOL_GPL(crypto_km_types); | |
33 | - | |
34 | 26 | static inline void memcpy_dir(void *buf, void *sgdata, size_t nbytes, int out) |
35 | 27 | { |
36 | 28 | void *src = out ? buf : sgdata; |