Skip to content

Commit ee7b9e3

Browse files
Michal SchmidtLinus Torvalds
authored andcommitted
Fix compilation of drivers with -O0
It is sometimes useful to compile individual drivers with optimization disabled for easier debugging. Currently drivers which use htonl() and similar functions don't compile with -O0. This patch fixes it. It also removes obsolete and misleading comments. This header is not for userspace, so we don't have to care about strange programs these comments mention. (akpm: -O0 probably isn't a good idea, but this code looks pretty crufty and unuseful) Signed-off-by: Michal Schmidt <mschmidt@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4659539 commit ee7b9e3

1 file changed

Lines changed: 0 additions & 25 deletions

File tree

include/linux/byteorder/generic.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,8 @@
124124
#define be32_to_cpus __be32_to_cpus
125125
#define cpu_to_be16s __cpu_to_be16s
126126
#define be16_to_cpus __be16_to_cpus
127-
#endif
128127

129-
130-
#if defined(__KERNEL__)
131128
/*
132-
* Handle ntohl and suches. These have various compatibility
133-
* issues - like we want to give the prototype even though we
134-
* also have a macro for them in case some strange program
135-
* wants to take the address of the thing or something..
136-
*
137-
* Note that these used to return a "long" in libc5, even though
138-
* long is often 64-bit these days.. Thus the casts.
139-
*
140129
* They have to be macros in order to do the constant folding
141130
* correctly - if the argument passed into a inline function
142131
* it is no longer constant according to gcc..
@@ -147,17 +136,6 @@
147136
#undef htonl
148137
#undef htons
149138

150-
/*
151-
* Do the prototypes. Somebody might want to take the
152-
* address or some such sick thing..
153-
*/
154-
extern __u32 ntohl(__be32);
155-
extern __be32 htonl(__u32);
156-
extern __u16 ntohs(__be16);
157-
extern __be16 htons(__u16);
158-
159-
#if defined(__GNUC__) && defined(__OPTIMIZE__)
160-
161139
#define ___htonl(x) __cpu_to_be32(x)
162140
#define ___htons(x) __cpu_to_be16(x)
163141
#define ___ntohl(x) __be32_to_cpu(x)
@@ -168,9 +146,6 @@ extern __be16 htons(__u16);
168146
#define htons(x) ___htons(x)
169147
#define ntohs(x) ___ntohs(x)
170148

171-
#endif /* OPTIMIZE */
172-
173149
#endif /* KERNEL */
174150

175-
176151
#endif /* _LINUX_BYTEORDER_GENERIC_H */

0 commit comments

Comments
 (0)