Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: s5p-sss - use the new scatterwalk functions

s5p_sg_copy_buf() open-coded a copy from/to a scatterlist using
scatterwalk_* functions that are planned for removal. Replace it with
the new functions memcpy_from_sglist() and memcpy_to_sglist() instead.
Also take the opportunity to replace calls to scatterwalk_map_and_copy()
in the same file; this eliminates the confusing 'out' argument.

Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
323abf25 e7d5d8a8

+11 -27
+11 -27
drivers/crypto/s5p-sss.c
··· 458 458 *sg = NULL; 459 459 } 460 460 461 - static void s5p_sg_copy_buf(void *buf, struct scatterlist *sg, 462 - unsigned int nbytes, int out) 463 - { 464 - struct scatter_walk walk; 465 - 466 - if (!nbytes) 467 - return; 468 - 469 - scatterwalk_start(&walk, sg); 470 - scatterwalk_copychunks(buf, &walk, nbytes, out); 471 - scatterwalk_done(&walk, out, 0); 472 - } 473 - 474 461 static void s5p_sg_done(struct s5p_aes_dev *dev) 475 462 { 476 463 struct skcipher_request *req = dev->req; ··· 467 480 dev_dbg(dev->dev, 468 481 "Copying %d bytes of output data back to original place\n", 469 482 dev->req->cryptlen); 470 - s5p_sg_copy_buf(sg_virt(dev->sg_dst_cpy), dev->req->dst, 471 - dev->req->cryptlen, 1); 483 + memcpy_to_sglist(dev->req->dst, 0, sg_virt(dev->sg_dst_cpy), 484 + dev->req->cryptlen); 472 485 } 473 486 s5p_free_sg_cpy(dev, &dev->sg_src_cpy); 474 487 s5p_free_sg_cpy(dev, &dev->sg_dst_cpy); ··· 513 526 return -ENOMEM; 514 527 } 515 528 516 - s5p_sg_copy_buf(pages, src, dev->req->cryptlen, 0); 529 + memcpy_from_sglist(pages, src, 0, dev->req->cryptlen); 517 530 518 531 sg_init_table(*dst, 1); 519 532 sg_set_buf(*dst, pages, len); ··· 1022 1035 if (ctx->bufcnt) 1023 1036 memcpy(buf, ctx->dd->xmit_buf, ctx->bufcnt); 1024 1037 1025 - scatterwalk_map_and_copy(buf + ctx->bufcnt, sg, ctx->skip, 1026 - new_len, 0); 1038 + memcpy_from_sglist(buf + ctx->bufcnt, sg, ctx->skip, new_len); 1027 1039 sg_init_table(ctx->sgl, 1); 1028 1040 sg_set_buf(ctx->sgl, buf, len); 1029 1041 ctx->sg = ctx->sgl; ··· 1215 1229 if (len > nbytes) 1216 1230 len = nbytes; 1217 1231 1218 - scatterwalk_map_and_copy(ctx->buffer + ctx->bufcnt, req->src, 1219 - 0, len, 0); 1232 + memcpy_from_sglist(ctx->buffer + ctx->bufcnt, req->src, 0, len); 1220 1233 ctx->bufcnt += len; 1221 1234 nbytes -= len; 1222 1235 ctx->skip = len; ··· 1238 1253 hash_later = ctx->total - xmit_len; 1239 1254 /* copy hash_later bytes from end of req->src */ 1240 1255 /* previous bytes are in xmit_buf, so no overwrite */ 1241 - scatterwalk_map_and_copy(ctx->buffer, req->src, 1242 - req->nbytes - hash_later, 1243 - hash_later, 0); 1256 + memcpy_from_sglist(ctx->buffer, req->src, 1257 + req->nbytes - hash_later, hash_later); 1244 1258 } 1245 1259 1246 1260 if (xmit_len > BUFLEN) { ··· 1251 1267 /* have buffered data only */ 1252 1268 if (unlikely(!ctx->bufcnt)) { 1253 1269 /* first update didn't fill up buffer */ 1254 - scatterwalk_map_and_copy(ctx->dd->xmit_buf, req->src, 1255 - 0, xmit_len, 0); 1270 + memcpy_from_sglist(ctx->dd->xmit_buf, req->src, 1271 + 0, xmit_len); 1256 1272 } 1257 1273 1258 1274 sg_init_table(ctx->sgl, 1); ··· 1490 1506 return 0; 1491 1507 1492 1508 if (ctx->bufcnt + req->nbytes <= BUFLEN) { 1493 - scatterwalk_map_and_copy(ctx->buffer + ctx->bufcnt, req->src, 1494 - 0, req->nbytes, 0); 1509 + memcpy_from_sglist(ctx->buffer + ctx->bufcnt, req->src, 1510 + 0, req->nbytes); 1495 1511 ctx->bufcnt += req->nbytes; 1496 1512 return 0; 1497 1513 }