diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-10 23:28:33 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-12 10:45:08 -0400 |
commit | 1a5b951f256d772a4ab758bda3a0667b788c0d2a (patch) | |
tree | 7e73b3a2ee63c0450c77cf34681f52ba6b0cc5b4 /drivers/crypto | |
parent | 72071fe43e8dad13f2a30897876d72463d46d065 (diff) |
crypto: picoxcell - Make use of sg_nents_for_len
This patch makes use of the new sg_nents_for_len helper to replace
the custom sg_count function.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/picoxcell_crypto.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c index aabf9d4f8e2e..9eb27c71cedf 100644 --- a/drivers/crypto/picoxcell_crypto.c +++ b/drivers/crypto/picoxcell_crypto.c | |||
@@ -262,18 +262,9 @@ static unsigned spacc_load_ctx(struct spacc_generic_ctx *ctx, | |||
262 | } | 262 | } |
263 | 263 | ||
264 | /* Count the number of scatterlist entries in a scatterlist. */ | 264 | /* Count the number of scatterlist entries in a scatterlist. */ |
265 | static int sg_count(struct scatterlist *sg_list, int nbytes) | 265 | static inline int sg_count(struct scatterlist *sg_list, int nbytes) |
266 | { | 266 | { |
267 | struct scatterlist *sg = sg_list; | 267 | return sg_nents_for_len(sg_list, nbytes); |
268 | int sg_nents = 0; | ||
269 | |||
270 | while (nbytes > 0) { | ||
271 | ++sg_nents; | ||
272 | nbytes -= sg->length; | ||
273 | sg = sg_next(sg); | ||
274 | } | ||
275 | |||
276 | return sg_nents; | ||
277 | } | 268 | } |
278 | 269 | ||
279 | static inline void ddt_set(struct spacc_ddt *ddt, dma_addr_t phys, size_t len) | 270 | static inline void ddt_set(struct spacc_ddt *ddt, dma_addr_t phys, size_t len) |