[klibc] [patch] bitops.h don't use likely/unlikely outside __KERNEL__

maximilian attems maks at sternwelten.at
Tue Jun 20 15:03:27 PDT 2006


On Tue, Jun 20, 2006 at 02:38:56PM -0700, H. Peter Anvin wrote:
> 
> NAK.  This patch is wrong.  likely() and unlikely() don't belong in 
> userspace without the underscores, for namespace reasons.
> 
> 	-hpa

ok patch was motivated due to the abundance of klibc warnings of s390 build:
In file included from linux/include/asm/posix_types.h:82,
                 from linux/include/linux/posix_types.h:47,
                 from usr/klibc/../include/sys/types.h:15,
                 from usr/klibc/../include/signal.h:12,
                 from usr/klibc/socketcalls/socketcommon.h:9,
                 from usr/klibc/socketcalls/getpeername.c:1:
linux/include/asm/bitops.h: In function 'ffz':
linux/include/asm/bitops.h:544: warning: implicit declaration of function 'likely'

belows patchs fixes s390 ffz() and ffs() to not use likely.

Signed-off-by: maximilian attems <maks at sternwelten.at>

diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index ca092ff..0752fb2 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -536,16 +536,16 @@ static inline unsigned long ffz(unsigned
         unsigned long bit = 0;
 
 #ifdef __s390x__
-	if (likely((word & 0xffffffff) == 0xffffffff)) {
+	if ((word & 0xffffffff) == 0xffffffff) {
 		word >>= 32;
 		bit += 32;
 	}
 #endif
-	if (likely((word & 0xffff) == 0xffff)) {
+	if ((word & 0xffff) == 0xffff) {
 		word >>= 16;
 		bit += 16;
 	}
-	if (likely((word & 0xff) == 0xff)) {
+	if ((word & 0xff) == 0xff) {
 		word >>= 8;
 		bit += 8;
 	}
@@ -561,16 +561,16 @@ static inline unsigned long __ffs (unsig
 	unsigned long bit = 0;
 
 #ifdef __s390x__
-	if (likely((word & 0xffffffff) == 0)) {
+	if ((word & 0xffffffff) == 0) {
 		word >>= 32;
 		bit += 32;
 	}
 #endif
-	if (likely((word & 0xffff) == 0)) {
+	if ((word & 0xffff) == 0) {
 		word >>= 16;
 		bit += 16;
 	}
-	if (likely((word & 0xff) == 0)) {
+	if ((word & 0xff) == 0) {
 		word >>= 8;
 		bit += 8;
 	}



More information about the klibc mailing list