Skip to content

Commit

Permalink
byteorder: only use linux/swab.h
Browse files Browse the repository at this point in the history
The first step to make swab.h a regular header that will
include an asm/swab.h with arch overrides.

Avoid the gratuitous differences introduced in the new
linux/swab.h by naming the ___constant_swabXX bits and
__fswabXX bits exactly as found in the old implementation
in byteorder/swab[b].h

Use this new swab.h in byteorder/[big|little]_endian.h and
remove the two old swab headers.

Although the inclusion of asm/byteorder.h looks strange in
linux/swab.h, this will allow each arch to move the actual
arch overrides for the swab bits in an asm file and then
the includes can be cleaned up without requiring a flag day
for all arches at once.

Keep providing __fswabXX in case some userspace was using them
directly, but the revised __swabXX should be used instead in
any new code and will always do constant folding not dependent
on the optimization level, which means the __constant versions
can be phased out in-kernel.

Arches that use the old-style arch macros will lose their
optimized versions until they move to the new style, but at
least they will still compile.  Many arches have already moved
and the patches to move the remaining arches are trivial.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Harvey Harrison authored and Linus Torvalds committed Jan 7, 2009
1 parent c89a9f5 commit 991c0e6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 388 deletions.
2 changes: 0 additions & 2 deletions include/linux/byteorder/Kbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
unifdef-y += big_endian.h
unifdef-y += little_endian.h
unifdef-y += swab.h
unifdef-y += swabb.h
3 changes: 1 addition & 2 deletions include/linux/byteorder/big_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#endif

#include <linux/types.h>
#include <linux/byteorder/swab.h>
#include <linux/byteorder/swabb.h>
#include <linux/swab.h>

#define __constant_htonl(x) ((__force __be32)(__u32)(x))
#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
Expand Down
3 changes: 1 addition & 2 deletions include/linux/byteorder/little_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#endif

#include <linux/types.h>
#include <linux/byteorder/swab.h>
#include <linux/byteorder/swabb.h>
#include <linux/swab.h>

#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
Expand Down
222 changes: 0 additions & 222 deletions include/linux/byteorder/swab.h

This file was deleted.

135 changes: 0 additions & 135 deletions include/linux/byteorder/swabb.h

This file was deleted.

Loading

0 comments on commit 991c0e6

Please sign in to comment.