LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Roel Kluin <12o3l@tiscali.nl>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] crypto: be*_add_cpu conversion
Date: Wed, 13 Feb 2008 19:36:49 +0100	[thread overview]
Message-ID: <20080213183628.GB6150@joi> (raw)
In-Reply-To: <47B2A98B.4050408@tiscali.nl>

On Wed, Feb 13, 2008 at 09:25:47AM +0100, Roel Kluin wrote:
> marcin.slusarz@gmail.com wrote:
> > From: Marcin Slusarz <marcin.slusarz@gmail.com>
> > 
> > replace all:
> > big_endian_variable = cpu_to_beX(beX_to_cpu(big_endian_variable) +
> > 					expression_in_cpu_byteorder);
> > with:
> > 	beX_add_cpu(&big_endian_variable, expression_in_cpu_byteorder);
> > generated with semantic patch
> > 
> > Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> > Cc: Herbert Xu <herbert@gondor.apana.org.au>
> > Cc: David S. Miller <davem@davemloft.net>
> > ---
> >  crypto/lrw.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/crypto/lrw.c b/crypto/lrw.c
> > index 9d52e58..4d93928 100644
> > --- a/crypto/lrw.c
> > +++ b/crypto/lrw.c
> > @@ -92,7 +92,7 @@ struct sinfo {
> >  static inline void inc(be128 *iv)
> >  {
> >  	if (!(iv->b = cpu_to_be64(be64_to_cpu(iv->b) + 1)))
> 
> maybe you also want instead of the line above:
> 
> 	be64_add_cpu(&iv->b, 1);
> 	if (!iv->b)
> 
> > -		iv->a = cpu_to_be64(be64_to_cpu(iv->a) + 1);
> > +		be64_add_cpu(&iv->a, 1);
> >  }
> >  
> >  static inline void lrw_round(struct sinfo *s, void *dst, const void *src)
> 
I'm a bit ashamed... but here is updated patch:
---
crypto: replace all adds to big endians variables with be*_add_cpu

replace all:
big_endian_variable = cpu_to_beX(beX_to_cpu(big_endian_variable) +
					expression_in_cpu_byteorder);
with:
	beX_add_cpu(&big_endian_variable, expression_in_cpu_byteorder);

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Roel Kluin <12o3l@tiscali.nl>
---
 crypto/lrw.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/crypto/lrw.c b/crypto/lrw.c
index 9d52e58..8ef664e 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -91,8 +91,9 @@ struct sinfo {
 
 static inline void inc(be128 *iv)
 {
-	if (!(iv->b = cpu_to_be64(be64_to_cpu(iv->b) + 1)))
-		iv->a = cpu_to_be64(be64_to_cpu(iv->a) + 1);
+	be64_add_cpu(&iv->b, 1);
+	if (!iv->b)
+		be64_add_cpu(&iv->a, 1);
 }
 
 static inline void lrw_round(struct sinfo *s, void *dst, const void *src)
-- 
1.5.3.7


  reply	other threads:[~2008-02-13 18:37 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-12 23:06 [PATCHSET] [bl]e*_add_cpu conversions marcin.slusarz
2008-02-12 23:06 ` [PATCH] crypto: be*_add_cpu conversion marcin.slusarz
2008-02-13  8:25   ` Roel Kluin
2008-02-13 18:36     ` Marcin Slusarz [this message]
2008-03-14  8:24       ` Herbert Xu
2008-02-12 23:06 ` [PATCH] ieee 1394: " marcin.slusarz
2008-02-16 16:54   ` Stefan Richter
2008-02-12 23:06 ` [PATCH] infiniband: " marcin.slusarz
2008-02-13  0:32   ` Roland Dreier
2008-02-12 23:06 ` [PATCH] affs: " marcin.slusarz
2008-02-12 23:06 ` [PATCH] gfs2: " marcin.slusarz
2008-02-13  9:55   ` Steven Whitehouse
2008-02-12 23:06 ` [PATCH] hfs/hfsplus: " marcin.slusarz
2008-02-12 23:06 ` [PATCH] ipw2200: le*_add_cpu conversion marcin.slusarz
2008-02-13 16:54   ` Chatre, Reinette
2008-02-12 23:06 ` [PATCH] scsi: " marcin.slusarz
2008-02-13 14:06   ` Salyzyn, Mark
2008-02-12 23:06 ` [PATCH] ext2: " marcin.slusarz
2008-02-12 23:06 ` [PATCH] ext4: " marcin.slusarz
2008-02-12 23:06 ` [PATCH] jfs: " marcin.slusarz
2008-02-13 21:51   ` Dave Kleikamp
2008-02-12 23:06 ` [PATCH] ntfs: " marcin.slusarz
2008-02-12 23:06 ` [PATCH] ocfs2: " marcin.slusarz
2008-02-18 21:03   ` Mark Fasheh
2008-02-12 23:06 ` [PATCH] quota: " marcin.slusarz
2008-02-13  9:52   ` Jan Kara
2008-02-12 23:06 ` [PATCH] reiserfs: " marcin.slusarz
2008-02-12 23:06 ` [PATCH] sysv: [bl]e*_add_cpu conversion marcin.slusarz
2008-02-14  7:04   ` Christoph Hellwig
2008-02-16 13:31     ` Christoph Hellwig
2008-02-12 23:06 ` [PATCH] ufs: " marcin.slusarz
2008-02-13  9:41   ` Roel Kluin
2008-02-13 18:21     ` Marcin Slusarz
2008-02-16  5:28     ` Andrew Morton
2008-02-18 23:22       ` Roel Kluin
2008-02-19 17:45         ` Marcin Slusarz
2008-02-19 19:16           ` Evgeniy Dushistov
2008-03-09 10:21             ` Marcin Slusarz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080213183628.GB6150@joi \
    --to=marcin.slusarz@gmail.com \
    --cc=12o3l@tiscali.nl \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] crypto: be*_add_cpu conversion' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).