Skip to contentSkip to conversation

__likely -> likely conversion

PATCH New Hannes Reinecke 1 participant 1 message Jul 7, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 __likely -> likely conversion

Hi hpa,

the following patch corrects the usage of '__likely', which has been replaced by 'likely()' in recent kernels. Plus it adds a missing include 'klibc/compiler.h' for sys/types.h as the bitops on S/390 insist on using 'likely'.

Please apply.

THX,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux AG				S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de
klibc/include/klibc/compiler.h renamed from klibc/include/klibc/compiler.h.orig +4 -4
@@ -94,11 +94,11 @@
 
 /* likely/unlikely */
 #if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95))
-# define __likely(x)   __builtin_expect((x), 1)
-# define __unlikely(x) __builtin_expect((x), 0)
+# define likely(x)   __builtin_expect((x), 1)
+# define unlikely(x) __builtin_expect((x), 0)
 #else
-# define __likely(x)   (x)
-# define __unlikely(x) (x)
+# define likely(x)   (x)
+# define unlikely(x) (x)
 #endif
 
 /* Possibly unused function */
klibc/getpagesize.c renamed from klibc/getpagesize.c.orig +1 -1
@@ -13,7 +13,7 @@
   struct sysinfo si;
   int rv;
 
-  if ( __likely(page_size) )
+  if ( likely(page_size) )
     return page_size;
 
   rv = sysinfo(&si);
klibc/getpageshift.c renamed from klibc/getpageshift.c.orig +1 -1
@@ -13,7 +13,7 @@
   static int page_shift;
   int page_size;
 
-  if ( __likely(page_shift) )
+  if ( likely(page_shift) )
     return page_shift;
 
   page_size = getpagesize();
klibc/include/sys/types.h renamed from klibc/include/sys/types.h.orig +1 -0
@@ -11,6 +11,7 @@
 #define _SSIZE_T
 typedef ptrdiff_t ssize_t;
 
+#include <klibc/compiler.h>
 #include <linux/posix_types.h>
 #include <asm/types.h>