diff options
author | Cristian Stoica <cristian.stoica@freescale.com> | 2015-01-20 03:06:16 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-01-25 19:34:22 -0500 |
commit | 5be4d4c94b1f98b839344fda7a8752a4a09d0ef5 (patch) | |
tree | 7af802fd927fea331cfb43c9b4d7978b5a607fda /drivers/crypto | |
parent | 088f628cc0898c4f0da7e91945f9f43a0b18a3bf (diff) |
crypto: replace scatterwalk_sg_next with sg_next
Modify crypto drivers to use the generic SG helper since
both of them are equivalent and the one from crypto is redundant.
See also:
468577abe37ff7b453a9ac613e0ea155349203ae reverted in
b2ab4a57b018aafbba35bff088218f5cc3d2142e
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/bfin_crc.c | 2 | ||||
-rw-r--r-- | drivers/crypto/caam/sg_sw_sec4.h | 8 | ||||
-rw-r--r-- | drivers/crypto/ixp4xx_crypto.c | 4 | ||||
-rw-r--r-- | drivers/crypto/nx/nx.c | 6 | ||||
-rw-r--r-- | drivers/crypto/omap-aes.c | 4 | ||||
-rw-r--r-- | drivers/crypto/omap-des.c | 4 | ||||
-rw-r--r-- | drivers/crypto/qce/dma.c | 6 | ||||
-rw-r--r-- | drivers/crypto/qce/sha.c | 2 | ||||
-rw-r--r-- | drivers/crypto/sahara.c | 2 | ||||
-rw-r--r-- | drivers/crypto/talitos.c | 8 | ||||
-rw-r--r-- | drivers/crypto/ux500/cryp/cryp_core.c | 2 |
11 files changed, 24 insertions, 24 deletions
diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c index 33cf9eb87344..d9af9403ab6c 100644 --- a/drivers/crypto/bfin_crc.c +++ b/drivers/crypto/bfin_crc.c | |||
@@ -110,7 +110,7 @@ static int sg_count(struct scatterlist *sg_list) | |||
110 | 110 | ||
111 | while (!sg_is_last(sg)) { | 111 | while (!sg_is_last(sg)) { |
112 | sg_nents++; | 112 | sg_nents++; |
113 | sg = scatterwalk_sg_next(sg); | 113 | sg = sg_next(sg); |
114 | } | 114 | } |
115 | 115 | ||
116 | return sg_nents; | 116 | return sg_nents; |
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h index ce28a563effc..3b918218aa4c 100644 --- a/drivers/crypto/caam/sg_sw_sec4.h +++ b/drivers/crypto/caam/sg_sw_sec4.h | |||
@@ -37,7 +37,7 @@ sg_to_sec4_sg(struct scatterlist *sg, int sg_count, | |||
37 | dma_to_sec4_sg_one(sec4_sg_ptr, sg_dma_address(sg), | 37 | dma_to_sec4_sg_one(sec4_sg_ptr, sg_dma_address(sg), |
38 | sg_dma_len(sg), offset); | 38 | sg_dma_len(sg), offset); |
39 | sec4_sg_ptr++; | 39 | sec4_sg_ptr++; |
40 | sg = scatterwalk_sg_next(sg); | 40 | sg = sg_next(sg); |
41 | sg_count--; | 41 | sg_count--; |
42 | } | 42 | } |
43 | return sec4_sg_ptr - 1; | 43 | return sec4_sg_ptr - 1; |
@@ -67,7 +67,7 @@ static inline int __sg_count(struct scatterlist *sg_list, int nbytes, | |||
67 | nbytes -= sg->length; | 67 | nbytes -= sg->length; |
68 | if (!sg_is_last(sg) && (sg + 1)->length == 0) | 68 | if (!sg_is_last(sg) && (sg + 1)->length == 0) |
69 | *chained = true; | 69 | *chained = true; |
70 | sg = scatterwalk_sg_next(sg); | 70 | sg = sg_next(sg); |
71 | } | 71 | } |
72 | 72 | ||
73 | return sg_nents; | 73 | return sg_nents; |
@@ -93,7 +93,7 @@ static int dma_map_sg_chained(struct device *dev, struct scatterlist *sg, | |||
93 | int i; | 93 | int i; |
94 | for (i = 0; i < nents; i++) { | 94 | for (i = 0; i < nents; i++) { |
95 | dma_map_sg(dev, sg, 1, dir); | 95 | dma_map_sg(dev, sg, 1, dir); |
96 | sg = scatterwalk_sg_next(sg); | 96 | sg = sg_next(sg); |
97 | } | 97 | } |
98 | } else { | 98 | } else { |
99 | dma_map_sg(dev, sg, nents, dir); | 99 | dma_map_sg(dev, sg, nents, dir); |
@@ -109,7 +109,7 @@ static int dma_unmap_sg_chained(struct device *dev, struct scatterlist *sg, | |||
109 | int i; | 109 | int i; |
110 | for (i = 0; i < nents; i++) { | 110 | for (i = 0; i < nents; i++) { |
111 | dma_unmap_sg(dev, sg, 1, dir); | 111 | dma_unmap_sg(dev, sg, 1, dir); |
112 | sg = scatterwalk_sg_next(sg); | 112 | sg = sg_next(sg); |
113 | } | 113 | } |
114 | } else { | 114 | } else { |
115 | dma_unmap_sg(dev, sg, nents, dir); | 115 | dma_unmap_sg(dev, sg, nents, dir); |
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index f757a0f428bd..48f453555f1f 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c | |||
@@ -784,7 +784,7 @@ static struct buffer_desc *chainup_buffers(struct device *dev, | |||
784 | struct buffer_desc *buf, gfp_t flags, | 784 | struct buffer_desc *buf, gfp_t flags, |
785 | enum dma_data_direction dir) | 785 | enum dma_data_direction dir) |
786 | { | 786 | { |
787 | for (;nbytes > 0; sg = scatterwalk_sg_next(sg)) { | 787 | for (; nbytes > 0; sg = sg_next(sg)) { |
788 | unsigned len = min(nbytes, sg->length); | 788 | unsigned len = min(nbytes, sg->length); |
789 | struct buffer_desc *next_buf; | 789 | struct buffer_desc *next_buf; |
790 | u32 next_buf_phys; | 790 | u32 next_buf_phys; |
@@ -982,7 +982,7 @@ static int hmac_inconsistent(struct scatterlist *sg, unsigned start, | |||
982 | break; | 982 | break; |
983 | 983 | ||
984 | offset += sg->length; | 984 | offset += sg->length; |
985 | sg = scatterwalk_sg_next(sg); | 985 | sg = sg_next(sg); |
986 | } | 986 | } |
987 | return (start + nbytes > offset + sg->length); | 987 | return (start + nbytes > offset + sg->length); |
988 | } | 988 | } |
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c index a392465d3e3f..1da6dc59d0dd 100644 --- a/drivers/crypto/nx/nx.c +++ b/drivers/crypto/nx/nx.c | |||
@@ -177,7 +177,7 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *nx_dst, | |||
177 | break; | 177 | break; |
178 | 178 | ||
179 | offset += sg_src->length; | 179 | offset += sg_src->length; |
180 | sg_src = scatterwalk_sg_next(sg_src); | 180 | sg_src = sg_next(sg_src); |
181 | } | 181 | } |
182 | 182 | ||
183 | /* start - offset is the number of bytes to advance in the scatterlist | 183 | /* start - offset is the number of bytes to advance in the scatterlist |
@@ -187,9 +187,9 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *nx_dst, | |||
187 | while (len && (nx_sg - nx_dst) < sglen) { | 187 | while (len && (nx_sg - nx_dst) < sglen) { |
188 | n = scatterwalk_clamp(&walk, len); | 188 | n = scatterwalk_clamp(&walk, len); |
189 | if (!n) { | 189 | if (!n) { |
190 | /* In cases where we have scatterlist chain scatterwalk_sg_next | 190 | /* In cases where we have scatterlist chain sg_next |
191 | * handles with it properly */ | 191 | * handles with it properly */ |
192 | scatterwalk_start(&walk, scatterwalk_sg_next(walk.sg)); | 192 | scatterwalk_start(&walk, sg_next(walk.sg)); |
193 | n = scatterwalk_clamp(&walk, len); | 193 | n = scatterwalk_clamp(&walk, len); |
194 | } | 194 | } |
195 | dst = scatterwalk_map(&walk); | 195 | dst = scatterwalk_map(&walk); |
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index f79dd410dede..42f95a4326b0 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c | |||
@@ -994,7 +994,7 @@ static irqreturn_t omap_aes_irq(int irq, void *dev_id) | |||
994 | 994 | ||
995 | scatterwalk_advance(&dd->in_walk, 4); | 995 | scatterwalk_advance(&dd->in_walk, 4); |
996 | if (dd->in_sg->length == _calc_walked(in)) { | 996 | if (dd->in_sg->length == _calc_walked(in)) { |
997 | dd->in_sg = scatterwalk_sg_next(dd->in_sg); | 997 | dd->in_sg = sg_next(dd->in_sg); |
998 | if (dd->in_sg) { | 998 | if (dd->in_sg) { |
999 | scatterwalk_start(&dd->in_walk, | 999 | scatterwalk_start(&dd->in_walk, |
1000 | dd->in_sg); | 1000 | dd->in_sg); |
@@ -1026,7 +1026,7 @@ static irqreturn_t omap_aes_irq(int irq, void *dev_id) | |||
1026 | *dst = omap_aes_read(dd, AES_REG_DATA_N(dd, i)); | 1026 | *dst = omap_aes_read(dd, AES_REG_DATA_N(dd, i)); |
1027 | scatterwalk_advance(&dd->out_walk, 4); | 1027 | scatterwalk_advance(&dd->out_walk, 4); |
1028 | if (dd->out_sg->length == _calc_walked(out)) { | 1028 | if (dd->out_sg->length == _calc_walked(out)) { |
1029 | dd->out_sg = scatterwalk_sg_next(dd->out_sg); | 1029 | dd->out_sg = sg_next(dd->out_sg); |
1030 | if (dd->out_sg) { | 1030 | if (dd->out_sg) { |
1031 | scatterwalk_start(&dd->out_walk, | 1031 | scatterwalk_start(&dd->out_walk, |
1032 | dd->out_sg); | 1032 | dd->out_sg); |
diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c index 0b8dcf5eb74e..46307098f8ba 100644 --- a/drivers/crypto/omap-des.c +++ b/drivers/crypto/omap-des.c | |||
@@ -921,7 +921,7 @@ static irqreturn_t omap_des_irq(int irq, void *dev_id) | |||
921 | 921 | ||
922 | scatterwalk_advance(&dd->in_walk, 4); | 922 | scatterwalk_advance(&dd->in_walk, 4); |
923 | if (dd->in_sg->length == _calc_walked(in)) { | 923 | if (dd->in_sg->length == _calc_walked(in)) { |
924 | dd->in_sg = scatterwalk_sg_next(dd->in_sg); | 924 | dd->in_sg = sg_next(dd->in_sg); |
925 | if (dd->in_sg) { | 925 | if (dd->in_sg) { |
926 | scatterwalk_start(&dd->in_walk, | 926 | scatterwalk_start(&dd->in_walk, |
927 | dd->in_sg); | 927 | dd->in_sg); |
@@ -953,7 +953,7 @@ static irqreturn_t omap_des_irq(int irq, void *dev_id) | |||
953 | *dst = omap_des_read(dd, DES_REG_DATA_N(dd, i)); | 953 | *dst = omap_des_read(dd, DES_REG_DATA_N(dd, i)); |
954 | scatterwalk_advance(&dd->out_walk, 4); | 954 | scatterwalk_advance(&dd->out_walk, 4); |
955 | if (dd->out_sg->length == _calc_walked(out)) { | 955 | if (dd->out_sg->length == _calc_walked(out)) { |
956 | dd->out_sg = scatterwalk_sg_next(dd->out_sg); | 956 | dd->out_sg = sg_next(dd->out_sg); |
957 | if (dd->out_sg) { | 957 | if (dd->out_sg) { |
958 | scatterwalk_start(&dd->out_walk, | 958 | scatterwalk_start(&dd->out_walk, |
959 | dd->out_sg); | 959 | dd->out_sg); |
diff --git a/drivers/crypto/qce/dma.c b/drivers/crypto/qce/dma.c index 0fb21e13f247..378cb768647f 100644 --- a/drivers/crypto/qce/dma.c +++ b/drivers/crypto/qce/dma.c | |||
@@ -64,7 +64,7 @@ int qce_mapsg(struct device *dev, struct scatterlist *sg, int nents, | |||
64 | err = dma_map_sg(dev, sg, 1, dir); | 64 | err = dma_map_sg(dev, sg, 1, dir); |
65 | if (!err) | 65 | if (!err) |
66 | return -EFAULT; | 66 | return -EFAULT; |
67 | sg = scatterwalk_sg_next(sg); | 67 | sg = sg_next(sg); |
68 | } | 68 | } |
69 | } else { | 69 | } else { |
70 | err = dma_map_sg(dev, sg, nents, dir); | 70 | err = dma_map_sg(dev, sg, nents, dir); |
@@ -81,7 +81,7 @@ void qce_unmapsg(struct device *dev, struct scatterlist *sg, int nents, | |||
81 | if (chained) | 81 | if (chained) |
82 | while (sg) { | 82 | while (sg) { |
83 | dma_unmap_sg(dev, sg, 1, dir); | 83 | dma_unmap_sg(dev, sg, 1, dir); |
84 | sg = scatterwalk_sg_next(sg); | 84 | sg = sg_next(sg); |
85 | } | 85 | } |
86 | else | 86 | else |
87 | dma_unmap_sg(dev, sg, nents, dir); | 87 | dma_unmap_sg(dev, sg, nents, dir); |
@@ -100,7 +100,7 @@ int qce_countsg(struct scatterlist *sglist, int nbytes, bool *chained) | |||
100 | nbytes -= sg->length; | 100 | nbytes -= sg->length; |
101 | if (!sg_is_last(sg) && (sg + 1)->length == 0 && chained) | 101 | if (!sg_is_last(sg) && (sg + 1)->length == 0 && chained) |
102 | *chained = true; | 102 | *chained = true; |
103 | sg = scatterwalk_sg_next(sg); | 103 | sg = sg_next(sg); |
104 | } | 104 | } |
105 | 105 | ||
106 | return nents; | 106 | return nents; |
diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c index f3385934eed2..5c5df1d17f90 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c | |||
@@ -285,7 +285,7 @@ static int qce_ahash_update(struct ahash_request *req) | |||
285 | break; | 285 | break; |
286 | len += sg_dma_len(sg); | 286 | len += sg_dma_len(sg); |
287 | sg_last = sg; | 287 | sg_last = sg; |
288 | sg = scatterwalk_sg_next(sg); | 288 | sg = sg_next(sg); |
289 | } | 289 | } |
290 | 290 | ||
291 | if (!sg_last) | 291 | if (!sg_last) |
diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 220b92f7eabc..290a7f0a681f 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c | |||
@@ -940,7 +940,7 @@ static int sahara_walk_and_recalc(struct scatterlist *sg, unsigned int nbytes) | |||
940 | break; | 940 | break; |
941 | } | 941 | } |
942 | nbytes -= sg->length; | 942 | nbytes -= sg->length; |
943 | sg = scatterwalk_sg_next(sg); | 943 | sg = sg_next(sg); |
944 | } | 944 | } |
945 | 945 | ||
946 | return nbytes; | 946 | return nbytes; |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 067ec2193d71..ebbae8d3ce0d 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -743,7 +743,7 @@ static int talitos_map_sg(struct device *dev, struct scatterlist *sg, | |||
743 | if (unlikely(chained)) | 743 | if (unlikely(chained)) |
744 | while (sg) { | 744 | while (sg) { |
745 | dma_map_sg(dev, sg, 1, dir); | 745 | dma_map_sg(dev, sg, 1, dir); |
746 | sg = scatterwalk_sg_next(sg); | 746 | sg = sg_next(sg); |
747 | } | 747 | } |
748 | else | 748 | else |
749 | dma_map_sg(dev, sg, nents, dir); | 749 | dma_map_sg(dev, sg, nents, dir); |
@@ -755,7 +755,7 @@ static void talitos_unmap_sg_chain(struct device *dev, struct scatterlist *sg, | |||
755 | { | 755 | { |
756 | while (sg) { | 756 | while (sg) { |
757 | dma_unmap_sg(dev, sg, 1, dir); | 757 | dma_unmap_sg(dev, sg, 1, dir); |
758 | sg = scatterwalk_sg_next(sg); | 758 | sg = sg_next(sg); |
759 | } | 759 | } |
760 | } | 760 | } |
761 | 761 | ||
@@ -915,7 +915,7 @@ static int sg_to_link_tbl(struct scatterlist *sg, int sg_count, | |||
915 | link_tbl_ptr->j_extent = 0; | 915 | link_tbl_ptr->j_extent = 0; |
916 | link_tbl_ptr++; | 916 | link_tbl_ptr++; |
917 | cryptlen -= sg_dma_len(sg); | 917 | cryptlen -= sg_dma_len(sg); |
918 | sg = scatterwalk_sg_next(sg); | 918 | sg = sg_next(sg); |
919 | } | 919 | } |
920 | 920 | ||
921 | /* adjust (decrease) last one (or two) entry's len to cryptlen */ | 921 | /* adjust (decrease) last one (or two) entry's len to cryptlen */ |
@@ -1102,7 +1102,7 @@ static int sg_count(struct scatterlist *sg_list, int nbytes, bool *chained) | |||
1102 | nbytes -= sg->length; | 1102 | nbytes -= sg->length; |
1103 | if (!sg_is_last(sg) && (sg + 1)->length == 0) | 1103 | if (!sg_is_last(sg) && (sg + 1)->length == 0) |
1104 | *chained = true; | 1104 | *chained = true; |
1105 | sg = scatterwalk_sg_next(sg); | 1105 | sg = sg_next(sg); |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | return sg_nents; | 1108 | return sg_nents; |
diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c index f087f37b2c67..d594ae962ed2 100644 --- a/drivers/crypto/ux500/cryp/cryp_core.c +++ b/drivers/crypto/ux500/cryp/cryp_core.c | |||
@@ -814,7 +814,7 @@ static int get_nents(struct scatterlist *sg, int nbytes) | |||
814 | 814 | ||
815 | while (nbytes > 0) { | 815 | while (nbytes > 0) { |
816 | nbytes -= sg->length; | 816 | nbytes -= sg->length; |
817 | sg = scatterwalk_sg_next(sg); | 817 | sg = sg_next(sg); |
818 | nents++; | 818 | nents++; |
819 | } | 819 | } |
820 | 820 | ||