Commit 1a5b951f authored by Herbert Xu's avatar Herbert Xu

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 72071fe4
...@@ -262,18 +262,9 @@ static unsigned spacc_load_ctx(struct spacc_generic_ctx *ctx, ...@@ -262,18 +262,9 @@ static unsigned spacc_load_ctx(struct spacc_generic_ctx *ctx,
} }
/* Count the number of scatterlist entries in a scatterlist. */ /* 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; return sg_nents_for_len(sg_list, nbytes);
int sg_nents = 0;
while (nbytes > 0) {
++sg_nents;
nbytes -= sg->length;
sg = sg_next(sg);
}
return sg_nents;
} }
static inline void ddt_set(struct spacc_ddt *ddt, dma_addr_t phys, size_t len) static inline void ddt_set(struct spacc_ddt *ddt, dma_addr_t phys, size_t len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment