All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix compilation of drivers with -O0
@ 2007-02-23 15:57 Michal Schmidt
  2007-02-23 16:03 ` Michal Schmidt
  2007-02-23 16:11 ` Michal Schmidt
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Schmidt @ 2007-02-23 15:57 UTC (permalink / raw)
  To: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.


Signed-off-by: Michal Schmidt <mschmidt@redhat.com>

diff --git a/include/linux/byteorder/generic.h
b/include/linux/byteorder/generic.h
index e86e4a9..3dc715b 100644
- --- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -124,19 +124,8 @@
 #define be32_to_cpus __be32_to_cpus
 #define cpu_to_be16s __cpu_to_be16s
 #define be16_to_cpus __be16_to_cpus
- -#endif
 
- -
- -#if defined(__KERNEL__)
 /*
- - * Handle ntohl and suches. These have various compatibility
- - * issues - like we want to give the prototype even though we
- - * also have a macro for them in case some strange program
- - * wants to take the address of the thing or something..
- - *
- - * Note that these used to return a "long" in libc5, even though
- - * long is often 64-bit these days.. Thus the casts.
- - *
  * They have to be macros in order to do the constant folding
  * correctly - if the argument passed into a inline function
  * it is no longer constant according to gcc..
@@ -147,17 +136,6 @@
 #undef htonl
 #undef htons
 
- -/*
- - * Do the prototypes. Somebody might want to take the
- - * address or some such sick thing..
- - */
- -extern __u32            ntohl(__be32);
- -extern __be32            htonl(__u32);
- -extern __u16            ntohs(__be16);
- -extern __be16            htons(__u16);
- -
- -#if defined(__GNUC__) && defined(__OPTIMIZE__)
- -
 #define ___htonl(x) __cpu_to_be32(x)
 #define ___htons(x) __cpu_to_be16(x)
 #define ___ntohl(x) __be32_to_cpu(x)
@@ -168,9 +146,6 @@ extern __be16            htons(__u16);
 #define htons(x) ___htons(x)
 #define ntohs(x) ___ntohs(x)
 
- -#endif /* OPTIMIZE */
- -
 #endif /* KERNEL */
 
- -
 #endif /* _LINUX_BYTEORDER_GENERIC_H */
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org

iD8DBQFF3w75abKV90ewf0QRAi+iAJ4g/NZXKdspLSi5wiRlzu5U0ytJFwCdEKD9
RUDYj69LURttm8qyCUCHz3k=
=73ft
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix compilation of drivers with -O0
  2007-02-23 15:57 [PATCH] Fix compilation of drivers with -O0 Michal Schmidt
@ 2007-02-23 16:03 ` Michal Schmidt
  2007-02-23 16:11 ` Michal Schmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Schmidt @ 2007-02-23 16:03 UTC (permalink / raw)
  To: linux-kernel

[Sorry, the patch was corrupted by the mailer. Hopefully it's ok this time.]

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.


Signed-off-by: Michal Schmidt <mschmidt@redhat.com>

diff --git a/include/linux/byteorder/generic.h
b/include/linux/byteorder/generic.h
index e86e4a9..3dc715b 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -124,19 +124,8 @@
 #define be32_to_cpus __be32_to_cpus
 #define cpu_to_be16s __cpu_to_be16s
 #define be16_to_cpus __be16_to_cpus
-#endif

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

-/*
- * Do the prototypes. Somebody might want to take the
- * address or some such sick thing..
- */
-extern __u32            ntohl(__be32);
-extern __be32            htonl(__u32);
-extern __u16            ntohs(__be16);
-extern __be16            htons(__u16);
-
-#if defined(__GNUC__) && defined(__OPTIMIZE__)
-
 #define ___htonl(x) __cpu_to_be32(x)
 #define ___htons(x) __cpu_to_be16(x)
 #define ___ntohl(x) __be32_to_cpu(x)
@@ -168,9 +146,6 @@ extern __be16            htons(__u16);
 #define htons(x) ___htons(x)
 #define ntohs(x) ___ntohs(x)

-#endif /* OPTIMIZE */
-
 #endif /* KERNEL */

-
 #endif /* _LINUX_BYTEORDER_GENERIC_H */



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix compilation of drivers with -O0
  2007-02-23 15:57 [PATCH] Fix compilation of drivers with -O0 Michal Schmidt
  2007-02-23 16:03 ` Michal Schmidt
@ 2007-02-23 16:11 ` Michal Schmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Schmidt @ 2007-02-23 16:11 UTC (permalink / raw)
  To: linux-kernel

[that still wasn't right, here's for the 3rd and final time.]

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.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>

diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index e86e4a9..3dc715b 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -124,19 +124,8 @@
 #define be32_to_cpus __be32_to_cpus
 #define cpu_to_be16s __cpu_to_be16s
 #define be16_to_cpus __be16_to_cpus
-#endif
 
-
-#if defined(__KERNEL__)
 /*
- * Handle ntohl and suches. These have various compatibility
- * issues - like we want to give the prototype even though we
- * also have a macro for them in case some strange program
- * wants to take the address of the thing or something..
- *
- * Note that these used to return a "long" in libc5, even though
- * long is often 64-bit these days.. Thus the casts.
- *
  * They have to be macros in order to do the constant folding
  * correctly - if the argument passed into a inline function
  * it is no longer constant according to gcc..
@@ -147,17 +136,6 @@
 #undef htonl
 #undef htons
 
-/*
- * Do the prototypes. Somebody might want to take the
- * address or some such sick thing..
- */
-extern __u32			ntohl(__be32);
-extern __be32			htonl(__u32);
-extern __u16			ntohs(__be16);
-extern __be16			htons(__u16);
-
-#if defined(__GNUC__) && defined(__OPTIMIZE__)
-
 #define ___htonl(x) __cpu_to_be32(x)
 #define ___htons(x) __cpu_to_be16(x)
 #define ___ntohl(x) __be32_to_cpu(x)
@@ -168,9 +146,6 @@ extern __be16			htons(__u16);
 #define htons(x) ___htons(x)
 #define ntohs(x) ___ntohs(x)
 
-#endif /* OPTIMIZE */
-
 #endif /* KERNEL */
 
-
 #endif /* _LINUX_BYTEORDER_GENERIC_H */



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-23 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-23 15:57 [PATCH] Fix compilation of drivers with -O0 Michal Schmidt
2007-02-23 16:03 ` Michal Schmidt
2007-02-23 16:11 ` Michal Schmidt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.