Re: [linux-sunxi] Re: [PATCH v6 18/18] crypto: sun8i-ce: fix some style issue

2020-09-07 Thread Herbert Xu
On Mon, Sep 07, 2020 at 09:16:17AM +0200, Corentin Labbe wrote:
>
> Oh I saw the increase in checkpatch.pl but didnt saw that it was still 80 in 
> coding-style.rst.
> Anyway as maintainer of this driver, I prefer unwrapped lines.
> 
> I let Herbert to choose to apply the serie without this last patch or not.

While lines beyond 80 characters are allowed, please don't send
patches that simply rewrite existing lines as longer ones.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [linux-sunxi] Re: [PATCH v6 18/18] crypto: sun8i-ce: fix some style issue

2020-09-07 Thread Corentin Labbe
On Fri, Sep 04, 2020 at 12:37:19PM -0700, Joe Perches wrote:
> On Fri, 2020-09-04 at 11:10 +, Corentin Labbe wrote:
> > This patch fix a double empty line issue reported by checkpatch.
> > While at it, since now the maximum line length is now 100, reorder some
> > wrapped line.
> []
> > diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c 
> > b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
> []
> > @@ -164,12 +164,10 @@ static int sun8i_ce_cipher_prepare(struct 
> > crypto_engine *engine, void *async_req
> > goto theend_key;
> > }
> > offset = areq->cryptlen - ivsize;
> > -   scatterwalk_map_and_copy(rctx->backup_iv, areq->src,
> > -offset, ivsize, 0);
> > +   scatterwalk_map_and_copy(rctx->backup_iv, areq->src, 
> > offset, ivsize, 0);
> > }
> > memcpy(rctx->bounce_iv, areq->iv, ivsize);
> > -   addr_iv = dma_map_single(ce->dev, rctx->bounce_iv, rctx->ivlen,
> > -DMA_TO_DEVICE);
> > +   addr_iv = dma_map_single(ce->dev, rctx->bounce_iv, rctx->ivlen, 
> > DMA_TO_DEVICE);
> 
> coding-style.rst:
> 
>Statements longer than 80 columns should be broken into sensible chunks,
>unless exceeding 80 columns significantly increases readability and does
>not hide information.
> 
> Do these longer lines make the code significantly more readable?
> I don't think they do.
> 

Oh I saw the increase in checkpatch.pl but didnt saw that it was still 80 in 
coding-style.rst.
Anyway as maintainer of this driver, I prefer unwrapped lines.

I let Herbert to choose to apply the serie without this last patch or not.


Re: [PATCH v6 18/18] crypto: sun8i-ce: fix some style issue

2020-09-04 Thread Joe Perches
On Fri, 2020-09-04 at 11:10 +, Corentin Labbe wrote:
> This patch fix a double empty line issue reported by checkpatch.
> While at it, since now the maximum line length is now 100, reorder some
> wrapped line.
[]
> diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c 
> b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
[]
> @@ -164,12 +164,10 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine 
> *engine, void *async_req
>   goto theend_key;
>   }
>   offset = areq->cryptlen - ivsize;
> - scatterwalk_map_and_copy(rctx->backup_iv, areq->src,
> -  offset, ivsize, 0);
> + scatterwalk_map_and_copy(rctx->backup_iv, areq->src, 
> offset, ivsize, 0);
>   }
>   memcpy(rctx->bounce_iv, areq->iv, ivsize);
> - addr_iv = dma_map_single(ce->dev, rctx->bounce_iv, rctx->ivlen,
> -  DMA_TO_DEVICE);
> + addr_iv = dma_map_single(ce->dev, rctx->bounce_iv, rctx->ivlen, 
> DMA_TO_DEVICE);

coding-style.rst:

   Statements longer than 80 columns should be broken into sensible chunks,
   unless exceeding 80 columns significantly increases readability and does
   not hide information.

Do these longer lines make the code significantly more readable?
I don't think they do.




[PATCH v6 18/18] crypto: sun8i-ce: fix some style issue

2020-09-04 Thread Corentin Labbe
This patch fix a double empty line issue reported by checkpatch.
While at it, since now the maximum line length is now 100, reorder some
wrapped line.

Signed-off-by: Corentin Labbe 
---
 .../allwinner/sun8i-ce/sun8i-ce-cipher.c  | 34 ++-
 .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c |  9 ++---
 2 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c 
b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
index 2dcf508b0f18..9dae2be26e48 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
@@ -164,12 +164,10 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine 
*engine, void *async_req
goto theend_key;
}
offset = areq->cryptlen - ivsize;
-   scatterwalk_map_and_copy(rctx->backup_iv, areq->src,
-offset, ivsize, 0);
+   scatterwalk_map_and_copy(rctx->backup_iv, areq->src, 
offset, ivsize, 0);
}
memcpy(rctx->bounce_iv, areq->iv, ivsize);
-   addr_iv = dma_map_single(ce->dev, rctx->bounce_iv, rctx->ivlen,
-DMA_TO_DEVICE);
+   addr_iv = dma_map_single(ce->dev, rctx->bounce_iv, rctx->ivlen, 
DMA_TO_DEVICE);
cet->t_iv = cpu_to_le32(addr_iv);
if (dma_mapping_error(ce->dev, addr_iv)) {
dev_err(ce->dev, "Cannot DMA MAP IV\n");
@@ -179,8 +177,7 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine 
*engine, void *async_req
}
 
if (areq->src == areq->dst) {
-   nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src),
-   DMA_BIDIRECTIONAL);
+   nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), 
DMA_BIDIRECTIONAL);
if (nr_sgs <= 0 || nr_sgs > MAX_SG) {
dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs);
err = -EINVAL;
@@ -188,15 +185,13 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine 
*engine, void *async_req
}
nr_sgd = nr_sgs;
} else {
-   nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src),
-   DMA_TO_DEVICE);
+   nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), 
DMA_TO_DEVICE);
if (nr_sgs <= 0 || nr_sgs > MAX_SG) {
dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs);
err = -EINVAL;
goto theend_iv;
}
-   nr_sgd = dma_map_sg(ce->dev, areq->dst, sg_nents(areq->dst),
-   DMA_FROM_DEVICE);
+   nr_sgd = dma_map_sg(ce->dev, areq->dst, sg_nents(areq->dst), 
DMA_FROM_DEVICE);
if (nr_sgd <= 0 || nr_sgd > MAX_SG) {
dev_err(ce->dev, "Invalid sg number %d\n", nr_sgd);
err = -EINVAL;
@@ -251,15 +246,13 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine 
*engine, void *async_req
 theend_iv:
if (areq->iv && ivsize > 0) {
if (addr_iv)
-   dma_unmap_single(ce->dev, addr_iv, rctx->ivlen,
-DMA_TO_DEVICE);
+   dma_unmap_single(ce->dev, addr_iv, rctx->ivlen, 
DMA_TO_DEVICE);
offset = areq->cryptlen - ivsize;
if (rctx->op_dir & CE_DECRYPTION) {
memcpy(areq->iv, rctx->backup_iv, ivsize);
kfree_sensitive(rctx->backup_iv);
} else {
-   scatterwalk_map_and_copy(areq->iv, areq->dst, offset,
-ivsize, 0);
+   scatterwalk_map_and_copy(areq->iv, areq->dst, offset, 
ivsize, 0);
}
kfree(rctx->bounce_iv);
}
@@ -315,15 +308,13 @@ static int sun8i_ce_cipher_unprepare(struct crypto_engine 
*engine, void *async_r
 
if (areq->iv && ivsize > 0) {
if (cet->t_iv)
-   dma_unmap_single(ce->dev, cet->t_iv, rctx->ivlen,
-DMA_TO_DEVICE);
+   dma_unmap_single(ce->dev, cet->t_iv, rctx->ivlen, 
DMA_TO_DEVICE);
offset = areq->cryptlen - ivsize;
if (rctx->op_dir & CE_DECRYPTION) {
memcpy(areq->iv, rctx->backup_iv, ivsize);
kfree_sensitive(rctx->backup_iv);
} else {
-   scatterwalk_map_and_copy(areq->iv, areq->dst, offset,
-ivsize, 0);
+   scatterwalk_map_and_copy(areq->iv, areq->dst, offset,