[PATCHSET] [bl]e*_add_cpu conversions

From: marcin . slusarz
Date: Tue Feb 12 2008 - 18:07:00 EST


From: Marcin Slusarz <marcin.slusarz@xxxxxxxxx>

Hi

This patchset converts

big/little_endian_variable = cpu_to_[bl]eX([bl]eX_to_cpu(big/little_endian_variable) +
expression_in_cpu_byteorder);
to:
[bl]eX_add_cpu(&big/little_endian_variable, expression_in_cpu_byteorder);

All patches were generated by spatch, then reviewed and fixed to follow coding style.

Semantic patch:
@@
expression *X;
expression Y;
@@
(
- *X = cpu_to_le64(le64_to_cpu(*X) + Y);
+ le64_add_cpu(X, Y);
|
- *X = cpu_to_le32(le32_to_cpu(*X) + Y);
+ le32_add_cpu(X, Y);
|
- *X = cpu_to_le16(le16_to_cpu(*X) + Y);
+ le16_add_cpu(X, Y);
|
- *X = cpu_to_be64(be64_to_cpu(*X) + Y);
+ be64_add_cpu(X, Y);
|
- *X = cpu_to_be32(be32_to_cpu(*X) + Y);
+ be32_add_cpu(X, Y);
|
- *X = cpu_to_be16(be16_to_cpu(*X) + Y);
+ be16_add_cpu(X, Y);
|
- *X = cpu_to_le64(le64_to_cpu(*X) - Y);
+ le64_add_cpu(X, -Y);
|
- *X = cpu_to_le32(le32_to_cpu(*X) - Y);
+ le32_add_cpu(X, -Y);
|
- *X = cpu_to_le16(le16_to_cpu(*X) - Y);
+ le16_add_cpu(X, -Y);
|
- *X = cpu_to_be64(be64_to_cpu(*X) - Y);
+ be64_add_cpu(X, -Y);
|
- *X = cpu_to_be32(be32_to_cpu(*X) - Y);
+ be32_add_cpu(X, -Y);
|
- *X = cpu_to_be16(be16_to_cpu(*X) - Y);
+ be16_add_cpu(X, -Y);
)
@@ expression X, Y; @@
(
- X = cpu_to_le64(le64_to_cpu(X) + Y);
+ le64_add_cpu(&X, Y);
|
- X = cpu_to_le32(le32_to_cpu(X) + Y);
+ le32_add_cpu(&X, Y);
|
- X = cpu_to_le16(le16_to_cpu(X) + Y);
+ le16_add_cpu(&X, Y);
|
- X = cpu_to_be64(be64_to_cpu(X) + Y);
+ be64_add_cpu(&X, Y);
|
- X = cpu_to_be32(be32_to_cpu(X) + Y);
+ be32_add_cpu(&X, Y);
|
- X = cpu_to_be16(be16_to_cpu(X) + Y);
+ be16_add_cpu(&X, Y);
|
- X = cpu_to_le64(le64_to_cpu(X) - Y);
+ le64_add_cpu(&X, -Y);
|
- X = cpu_to_le32(le32_to_cpu(X) - Y);
+ le32_add_cpu(&X, -Y);
|
- X = cpu_to_le16(le16_to_cpu(X) - Y);
+ le16_add_cpu(&X, -Y);
|
- X = cpu_to_be64(be64_to_cpu(X) - Y);
+ be64_add_cpu(&X, -Y);
|
- X = cpu_to_be32(be32_to_cpu(X) - Y);
+ be32_add_cpu(&X, -Y);
|
- X = cpu_to_be16(be16_to_cpu(X) - Y);
+ be16_add_cpu(&X, -Y);
)

diffstat:
crypto/lrw.c | 2 +-
drivers/ieee1394/csr.c | 6 ++----
drivers/infiniband/hw/mthca/mthca_cq.c | 2 +-
drivers/net/wireless/ipw2200.c | 4 +---
drivers/scsi/aacraid/commsup.c | 2 +-
drivers/scsi/ips.c | 8 ++------
fs/affs/file.c | 4 ++--
fs/ext2/ialloc.c | 12 ++++--------
fs/ext2/super.c | 2 +-
fs/ext2/xattr.c | 9 +++------
fs/ext4/balloc.c | 7 ++-----
fs/ext4/extents.c | 20 +++++++++-----------
fs/ext4/ialloc.c | 12 ++++--------
fs/ext4/mballoc.c | 7 ++-----
fs/ext4/resize.c | 6 ++----
fs/ext4/super.c | 2 +-
fs/ext4/xattr.c | 6 ++----
fs/gfs2/dir.c | 6 +++---
fs/hfs/mdb.c | 2 +-
fs/hfsplus/super.c | 2 +-
fs/jfs/jfs_dmap.c | 11 +++++------
fs/jfs/jfs_imap.c | 15 ++++++---------
fs/jfs/jfs_xtree.c | 26 ++++++++------------------
fs/ntfs/upcase.c | 5 ++---
fs/ocfs2/dir.c | 5 ++---
fs/ocfs2/localalloc.c | 3 +--
fs/quota_v2.c | 4 ++--
fs/reiserfs/objectid.c | 5 ++---
fs/reiserfs/stree.c | 3 +--
fs/sysv/sysv.h | 8 ++++----
fs/ufs/swab.h | 16 ++++++++--------
31 files changed, 86 insertions(+), 136 deletions(-)

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