Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-19 Thread Evgeniy Dushistov
On Tue, Feb 19, 2008 at 06:45:42PM +0100, Marcin Slusarz wrote:
> On Tue, Feb 19, 2008 at 12:22:19AM +0100, Roel Kluin wrote:
> > Andrew Morton wrote:
> > > On Wed, 13 Feb 2008 10:41:44 +0100 Roel Kluin <[EMAIL PROTECTED]> wrote:
> > > 
> > >> you may also want these:
> > >> ---
> > >> [bl]e_add_cpu conversion in return
> > 
> > > upsets powerpc (at least):
> > > 
> > > fs/ufs/swab.h: In function `fs64_add':
> > > fs/ufs/swab.h:47: warning: passing arg 1 of `le64_add_cpu' from 
> > > incompatible pointer type
> > > fs/ufs/swab.h:49: warning: passing arg 1 of `be64_add_cpu' from 
> > > incompatible pointer type
> > > fs/ufs/swab.h: In function `fs64_sub':
> > > fs/ufs/swab.h:58: warning: passing arg 1 of `le64_add_cpu' from 
> > > incompatible pointer type
> > > fs/ufs/swab.h:60: warning: passing arg 1 of `be64_add_cpu' from 
> > > incompatible pointer type
> > 
> > sorry for this. Is it correct to cast like the patch below does?
> I don't think so. Their prototypes are wrong. We can:
> a) remove fs64_add and fs64_sub as nobody use them
> b) fix them - change second parameter do __fs64 (and convert to 
> [bl]e64_add_cpu)
> 
> Evgeniy?
> 

I vote for removing unused code.

-- 
/Evgeniy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-19 Thread Marcin Slusarz
On Tue, Feb 19, 2008 at 12:22:19AM +0100, Roel Kluin wrote:
> Andrew Morton wrote:
> > On Wed, 13 Feb 2008 10:41:44 +0100 Roel Kluin <[EMAIL PROTECTED]> wrote:
> > 
> >> you may also want these:
> >> ---
> >> [bl]e_add_cpu conversion in return
> 
> > upsets powerpc (at least):
> > 
> > fs/ufs/swab.h: In function `fs64_add':
> > fs/ufs/swab.h:47: warning: passing arg 1 of `le64_add_cpu' from 
> > incompatible pointer type
> > fs/ufs/swab.h:49: warning: passing arg 1 of `be64_add_cpu' from 
> > incompatible pointer type
> > fs/ufs/swab.h: In function `fs64_sub':
> > fs/ufs/swab.h:58: warning: passing arg 1 of `le64_add_cpu' from 
> > incompatible pointer type
> > fs/ufs/swab.h:60: warning: passing arg 1 of `be64_add_cpu' from 
> > incompatible pointer type
> 
> sorry for this. Is it correct to cast like the patch below does?
I don't think so. Their prototypes are wrong. We can:
a) remove fs64_add and fs64_sub as nobody use them
b) fix them - change second parameter do __fs64 (and convert to [bl]e64_add_cpu)

Evgeniy?

> If not (anyone) feel free to correct and send a patch yourself.
> The patch below was *not* tested
> ---
> [bl]e_add_cpu conversion in return (with cast)
> 
> Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
> ---
> diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
> index 1683d2b..594d6e8 100644
> --- a/fs/ufs/swab.h
> +++ b/fs/ufs/swab.h
> @@ -44,18 +44,22 @@ static __inline u32
>  fs64_add(struct super_block *sbp, u32 *n, int d)
>  {
>   if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
> - return *n = cpu_to_le64(le64_to_cpu(*n)+d);
> + le64_add_cpu((__le64 *)n, d);
>   else
> - return *n = cpu_to_be64(be64_to_cpu(*n)+d);
> + be64_add_cpu((__le64 *)n, d);
> +
> + return *n;
>  }
>  
>  static __inline u32
>  fs64_sub(struct super_block *sbp, u32 *n, int d)
>  {
>   if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
> - return *n = cpu_to_le64(le64_to_cpu(*n)-d);
> + le64_add_cpu((__le64 *)n, -d);
>   else
> - return *n = cpu_to_be64(be64_to_cpu(*n)-d);
> + be64_add_cpu((__le64 *)n, -d);
> +
> + return *n;
>  }
>  
>  static __inline u32
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-19 Thread Marcin Slusarz
On Tue, Feb 19, 2008 at 12:22:19AM +0100, Roel Kluin wrote:
 Andrew Morton wrote:
  On Wed, 13 Feb 2008 10:41:44 +0100 Roel Kluin [EMAIL PROTECTED] wrote:
  
  you may also want these:
  ---
  [bl]e_add_cpu conversion in return
 
  upsets powerpc (at least):
  
  fs/ufs/swab.h: In function `fs64_add':
  fs/ufs/swab.h:47: warning: passing arg 1 of `le64_add_cpu' from 
  incompatible pointer type
  fs/ufs/swab.h:49: warning: passing arg 1 of `be64_add_cpu' from 
  incompatible pointer type
  fs/ufs/swab.h: In function `fs64_sub':
  fs/ufs/swab.h:58: warning: passing arg 1 of `le64_add_cpu' from 
  incompatible pointer type
  fs/ufs/swab.h:60: warning: passing arg 1 of `be64_add_cpu' from 
  incompatible pointer type
 
 sorry for this. Is it correct to cast like the patch below does?
I don't think so. Their prototypes are wrong. We can:
a) remove fs64_add and fs64_sub as nobody use them
b) fix them - change second parameter do __fs64 (and convert to [bl]e64_add_cpu)

Evgeniy?

 If not (anyone) feel free to correct and send a patch yourself.
 The patch below was *not* tested
 ---
 [bl]e_add_cpu conversion in return (with cast)
 
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
 ---
 diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
 index 1683d2b..594d6e8 100644
 --- a/fs/ufs/swab.h
 +++ b/fs/ufs/swab.h
 @@ -44,18 +44,22 @@ static __inline u32
  fs64_add(struct super_block *sbp, u32 *n, int d)
  {
   if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
 - return *n = cpu_to_le64(le64_to_cpu(*n)+d);
 + le64_add_cpu((__le64 *)n, d);
   else
 - return *n = cpu_to_be64(be64_to_cpu(*n)+d);
 + be64_add_cpu((__le64 *)n, d);
 +
 + return *n;
  }
  
  static __inline u32
  fs64_sub(struct super_block *sbp, u32 *n, int d)
  {
   if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
 - return *n = cpu_to_le64(le64_to_cpu(*n)-d);
 + le64_add_cpu((__le64 *)n, -d);
   else
 - return *n = cpu_to_be64(be64_to_cpu(*n)-d);
 + be64_add_cpu((__le64 *)n, -d);
 +
 + return *n;
  }
  
  static __inline u32
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-19 Thread Evgeniy Dushistov
On Tue, Feb 19, 2008 at 06:45:42PM +0100, Marcin Slusarz wrote:
 On Tue, Feb 19, 2008 at 12:22:19AM +0100, Roel Kluin wrote:
  Andrew Morton wrote:
   On Wed, 13 Feb 2008 10:41:44 +0100 Roel Kluin [EMAIL PROTECTED] wrote:
   
   you may also want these:
   ---
   [bl]e_add_cpu conversion in return
  
   upsets powerpc (at least):
   
   fs/ufs/swab.h: In function `fs64_add':
   fs/ufs/swab.h:47: warning: passing arg 1 of `le64_add_cpu' from 
   incompatible pointer type
   fs/ufs/swab.h:49: warning: passing arg 1 of `be64_add_cpu' from 
   incompatible pointer type
   fs/ufs/swab.h: In function `fs64_sub':
   fs/ufs/swab.h:58: warning: passing arg 1 of `le64_add_cpu' from 
   incompatible pointer type
   fs/ufs/swab.h:60: warning: passing arg 1 of `be64_add_cpu' from 
   incompatible pointer type
  
  sorry for this. Is it correct to cast like the patch below does?
 I don't think so. Their prototypes are wrong. We can:
 a) remove fs64_add and fs64_sub as nobody use them
 b) fix them - change second parameter do __fs64 (and convert to 
 [bl]e64_add_cpu)
 
 Evgeniy?
 

I vote for removing unused code.

-- 
/Evgeniy

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-18 Thread Roel Kluin
Andrew Morton wrote:
> On Wed, 13 Feb 2008 10:41:44 +0100 Roel Kluin <[EMAIL PROTECTED]> wrote:
> 
>> you may also want these:
>> ---
>> [bl]e_add_cpu conversion in return

> upsets powerpc (at least):
> 
> fs/ufs/swab.h: In function `fs64_add':
> fs/ufs/swab.h:47: warning: passing arg 1 of `le64_add_cpu' from incompatible 
> pointer type
> fs/ufs/swab.h:49: warning: passing arg 1 of `be64_add_cpu' from incompatible 
> pointer type
> fs/ufs/swab.h: In function `fs64_sub':
> fs/ufs/swab.h:58: warning: passing arg 1 of `le64_add_cpu' from incompatible 
> pointer type
> fs/ufs/swab.h:60: warning: passing arg 1 of `be64_add_cpu' from incompatible 
> pointer type

sorry for this. Is it correct to cast like the patch below does?
If not (anyone) feel free to correct and send a patch yourself.
The patch below was *not* tested
---
[bl]e_add_cpu conversion in return (with cast)

Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
---
diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
index 1683d2b..594d6e8 100644
--- a/fs/ufs/swab.h
+++ b/fs/ufs/swab.h
@@ -44,18 +44,22 @@ static __inline u32
 fs64_add(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)+d);
+   le64_add_cpu((__le64 *)n, d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)+d);
+   be64_add_cpu((__le64 *)n, d);
+
+   return *n;
 }
 
 static __inline u32
 fs64_sub(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)-d);
+   le64_add_cpu((__le64 *)n, -d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)-d);
+   be64_add_cpu((__le64 *)n, -d);
+
+   return *n;
 }
 
 static __inline u32
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-15 Thread Andrew Morton
On Wed, 13 Feb 2008 10:41:44 +0100 Roel Kluin <[EMAIL PROTECTED]> wrote:

> you may also want these:
> ---
> [bl]e_add_cpu conversion in return
> 
> Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
> ---
> diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
> index 1683d2b..a1e3000 100644
> --- a/fs/ufs/swab.h
> +++ b/fs/ufs/swab.h
> @@ -44,18 +44,22 @@ static __inline u32
>  fs64_add(struct super_block *sbp, u32 *n, int d)
>  {
>   if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
> - return *n = cpu_to_le64(le64_to_cpu(*n)+d);
> + le64_add_cpu(n, d);
>   else
> - return *n = cpu_to_be64(be64_to_cpu(*n)+d);
> + be64_add_cpu(n, d);
> +
> + return *n;
>  }
>  
>  static __inline u32
>  fs64_sub(struct super_block *sbp, u32 *n, int d)
>  {
>   if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
> - return *n = cpu_to_le64(le64_to_cpu(*n)-d);
> + le64_add_cpu(n, -d);
>   else
> - return *n = cpu_to_be64(be64_to_cpu(*n)-d);
> + be64_add_cpu(n, -d);
> +
> + return *n;
>  }
>  
>  static __inline u32

upsets powerpc (at least):

fs/ufs/swab.h: In function `fs64_add':
fs/ufs/swab.h:47: warning: passing arg 1 of `le64_add_cpu' from incompatible 
pointer type
fs/ufs/swab.h:49: warning: passing arg 1 of `be64_add_cpu' from incompatible 
pointer type
fs/ufs/swab.h: In function `fs64_sub':
fs/ufs/swab.h:58: warning: passing arg 1 of `le64_add_cpu' from incompatible 
pointer type
fs/ufs/swab.h:60: warning: passing arg 1 of `be64_add_cpu' from incompatible 
pointer type
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-15 Thread Andrew Morton
On Wed, 13 Feb 2008 10:41:44 +0100 Roel Kluin [EMAIL PROTECTED] wrote:

 you may also want these:
 ---
 [bl]e_add_cpu conversion in return
 
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
 ---
 diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
 index 1683d2b..a1e3000 100644
 --- a/fs/ufs/swab.h
 +++ b/fs/ufs/swab.h
 @@ -44,18 +44,22 @@ static __inline u32
  fs64_add(struct super_block *sbp, u32 *n, int d)
  {
   if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
 - return *n = cpu_to_le64(le64_to_cpu(*n)+d);
 + le64_add_cpu(n, d);
   else
 - return *n = cpu_to_be64(be64_to_cpu(*n)+d);
 + be64_add_cpu(n, d);
 +
 + return *n;
  }
  
  static __inline u32
  fs64_sub(struct super_block *sbp, u32 *n, int d)
  {
   if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
 - return *n = cpu_to_le64(le64_to_cpu(*n)-d);
 + le64_add_cpu(n, -d);
   else
 - return *n = cpu_to_be64(be64_to_cpu(*n)-d);
 + be64_add_cpu(n, -d);
 +
 + return *n;
  }
  
  static __inline u32

upsets powerpc (at least):

fs/ufs/swab.h: In function `fs64_add':
fs/ufs/swab.h:47: warning: passing arg 1 of `le64_add_cpu' from incompatible 
pointer type
fs/ufs/swab.h:49: warning: passing arg 1 of `be64_add_cpu' from incompatible 
pointer type
fs/ufs/swab.h: In function `fs64_sub':
fs/ufs/swab.h:58: warning: passing arg 1 of `le64_add_cpu' from incompatible 
pointer type
fs/ufs/swab.h:60: warning: passing arg 1 of `be64_add_cpu' from incompatible 
pointer type
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-13 Thread Marcin Slusarz
On Wed, Feb 13, 2008 at 10:41:44AM +0100, Roel Kluin wrote:
> [EMAIL PROTECTED] wrote:
> > replace all:
> > big/little_endian_variable = 
> > cpu_to_[bl]eX([bl]eX_to_cpu(big/little_endian_variable) +
> > expression_in_cpu_byteorder);
> > with:
> > [bl]eX_add_cpu(/little_endian_variable, 
> > expression_in_cpu_byteorder);
> 
> you may also want these:
> ---
> [bl]e_add_cpu conversion in return
> 
> Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
Acked-by: Marcin Slusarz <[EMAIL PROTECTED]>

> ---
> diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
> index 1683d2b..a1e3000 100644
> --- a/fs/ufs/swab.h
> +++ b/fs/ufs/swab.h
> @@ -44,18 +44,22 @@ static __inline u32
>  fs64_add(struct super_block *sbp, u32 *n, int d)
>  {
>   if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
> - return *n = cpu_to_le64(le64_to_cpu(*n)+d);
> + le64_add_cpu(n, d);
>   else
> - return *n = cpu_to_be64(be64_to_cpu(*n)+d);
> + be64_add_cpu(n, d);
> +
> + return *n;
>  }
>  
>  static __inline u32
>  fs64_sub(struct super_block *sbp, u32 *n, int d)
>  {
>   if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
> - return *n = cpu_to_le64(le64_to_cpu(*n)-d);
> + le64_add_cpu(n, -d);
>   else
> - return *n = cpu_to_be64(be64_to_cpu(*n)-d);
> + be64_add_cpu(n, -d);
> +
> + return *n;
>  }
>  
>  static __inline u32
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-13 Thread Roel Kluin
[EMAIL PROTECTED] wrote:
> replace all:
> big/little_endian_variable = 
> cpu_to_[bl]eX([bl]eX_to_cpu(big/little_endian_variable) +
>   expression_in_cpu_byteorder);
> with:
>   [bl]eX_add_cpu(/little_endian_variable, 
> expression_in_cpu_byteorder);

you may also want these:
---
[bl]e_add_cpu conversion in return

Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
---
diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
index 1683d2b..a1e3000 100644
--- a/fs/ufs/swab.h
+++ b/fs/ufs/swab.h
@@ -44,18 +44,22 @@ static __inline u32
 fs64_add(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)+d);
+   le64_add_cpu(n, d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)+d);
+   be64_add_cpu(n, d);
+
+   return *n;
 }
 
 static __inline u32
 fs64_sub(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)-d);
+   le64_add_cpu(n, -d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)-d);
+   be64_add_cpu(n, -d);
+
+   return *n;
 }
 
 static __inline u32

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-13 Thread Roel Kluin
[EMAIL PROTECTED] wrote:
 replace all:
 big/little_endian_variable = 
 cpu_to_[bl]eX([bl]eX_to_cpu(big/little_endian_variable) +
   expression_in_cpu_byteorder);
 with:
   [bl]eX_add_cpu(big/little_endian_variable, 
 expression_in_cpu_byteorder);

you may also want these:
---
[bl]e_add_cpu conversion in return

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
index 1683d2b..a1e3000 100644
--- a/fs/ufs/swab.h
+++ b/fs/ufs/swab.h
@@ -44,18 +44,22 @@ static __inline u32
 fs64_add(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)+d);
+   le64_add_cpu(n, d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)+d);
+   be64_add_cpu(n, d);
+
+   return *n;
 }
 
 static __inline u32
 fs64_sub(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)-d);
+   le64_add_cpu(n, -d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)-d);
+   be64_add_cpu(n, -d);
+
+   return *n;
 }
 
 static __inline u32

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-12 Thread marcin . slusarz
From: Marcin Slusarz <[EMAIL PROTECTED]>

replace all:
big/little_endian_variable = 
cpu_to_[bl]eX([bl]eX_to_cpu(big/little_endian_variable) +
expression_in_cpu_byteorder);
with:
[bl]eX_add_cpu(/little_endian_variable, 
expression_in_cpu_byteorder);
generated with semantic patch

Signed-off-by: Marcin Slusarz <[EMAIL PROTECTED]>
Cc: Evgeniy Dushistov <[EMAIL PROTECTED]>
---
 fs/ufs/swab.h |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
index 1683d2b..a4340d0 100644
--- a/fs/ufs/swab.h
+++ b/fs/ufs/swab.h
@@ -80,18 +80,18 @@ static inline void
 fs32_add(struct super_block *sbp, __fs32 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)+d);
+   le32_add_cpu((__le32 *)n, d);
else
-   *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)+d);
+   be32_add_cpu((__be32 *)n, d);
 }
 
 static inline void
 fs32_sub(struct super_block *sbp, __fs32 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)-d);
+   le32_add_cpu((__le32 *)n, -d);
else
-   *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)-d);
+   be32_add_cpu((__be32 *)n, -d);
 }
 
 static inline u16
@@ -116,18 +116,18 @@ static inline void
 fs16_add(struct super_block *sbp, __fs16 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)+d);
+   le16_add_cpu((__le16 *)n, d);
else
-   *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)+d);
+   be16_add_cpu((__be16 *)n, d);
 }
 
 static inline void
 fs16_sub(struct super_block *sbp, __fs16 *n, int d)
 {
if (UFS_SB(sbp)->s_bytesex == BYTESEX_LE)
-   *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)-d);
+   le16_add_cpu((__le16 *)n, -d);
else
-   *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)-d);
+   be16_add_cpu((__be16 *)n, -d);
 }
 
 #endif /* _UFS_SWAB_H */
-- 
1.5.3.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ufs: [bl]e*_add_cpu conversion

2008-02-12 Thread marcin . slusarz
From: Marcin Slusarz [EMAIL PROTECTED]

replace all:
big/little_endian_variable = 
cpu_to_[bl]eX([bl]eX_to_cpu(big/little_endian_variable) +
expression_in_cpu_byteorder);
with:
[bl]eX_add_cpu(big/little_endian_variable, 
expression_in_cpu_byteorder);
generated with semantic patch

Signed-off-by: Marcin Slusarz [EMAIL PROTECTED]
Cc: Evgeniy Dushistov [EMAIL PROTECTED]
---
 fs/ufs/swab.h |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
index 1683d2b..a4340d0 100644
--- a/fs/ufs/swab.h
+++ b/fs/ufs/swab.h
@@ -80,18 +80,18 @@ static inline void
 fs32_add(struct super_block *sbp, __fs32 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)+d);
+   le32_add_cpu((__le32 *)n, d);
else
-   *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)+d);
+   be32_add_cpu((__be32 *)n, d);
 }
 
 static inline void
 fs32_sub(struct super_block *sbp, __fs32 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   *(__le32 *)n = cpu_to_le32(le32_to_cpu(*(__le32 *)n)-d);
+   le32_add_cpu((__le32 *)n, -d);
else
-   *(__be32 *)n = cpu_to_be32(be32_to_cpu(*(__be32 *)n)-d);
+   be32_add_cpu((__be32 *)n, -d);
 }
 
 static inline u16
@@ -116,18 +116,18 @@ static inline void
 fs16_add(struct super_block *sbp, __fs16 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)+d);
+   le16_add_cpu((__le16 *)n, d);
else
-   *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)+d);
+   be16_add_cpu((__be16 *)n, d);
 }
 
 static inline void
 fs16_sub(struct super_block *sbp, __fs16 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   *(__le16 *)n = cpu_to_le16(le16_to_cpu(*(__le16 *)n)-d);
+   le16_add_cpu((__le16 *)n, -d);
else
-   *(__be16 *)n = cpu_to_be16(be16_to_cpu(*(__be16 *)n)-d);
+   be16_add_cpu((__be16 *)n, -d);
 }
 
 #endif /* _UFS_SWAB_H */
-- 
1.5.3.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/