crypto: picoxcell - Make use of sg_nents_for_len
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 11 Jun 2015 03:28:33 +0000 (11:28 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Jun 2015 14:45:08 +0000 (22:45 +0800)
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>
drivers/crypto/picoxcell_crypto.c

index aabf9d4f8e2eeb4cfb7af8f0948ae97357de3e46..9eb27c71cedf5fb081d396a8e64a0aef0e0dad82 100644 (file)
@@ -262,18 +262,9 @@ static unsigned spacc_load_ctx(struct spacc_generic_ctx *ctx,
 }
 
 /* Count the number of scatterlist entries in a scatterlist. */
-static int sg_count(struct scatterlist *sg_list, int nbytes)
+static inline int sg_count(struct scatterlist *sg_list, int nbytes)
 {
-       struct scatterlist *sg = sg_list;
-       int sg_nents = 0;
-
-       while (nbytes > 0) {
-               ++sg_nents;
-               nbytes -= sg->length;
-               sg = sg_next(sg);
-       }
-
-       return sg_nents;
+       return sg_nents_for_len(sg_list, nbytes);
 }
 
 static inline void ddt_set(struct spacc_ddt *ddt, dma_addr_t phys, size_t len)