lkml.org 
[lkml]   [2008]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ufs: [bl]e*_add_cpu conversion
On Wed, Feb 13, 2008 at 10:41:44AM +0100, Roel Kluin wrote:
> marcin.slusarz@gmail.com 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 <12o3l@tiscali.nl>
Acked-by: Marcin Slusarz <marcin.slusarz@gmail.com>

> ---
> 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
>


\
 
 \ /
  Last update: 2008-02-13 19:25    [W:0.049 / U:0.884 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site