compat: update bitops.h and wireless.h
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 6 Jun 2010 09:12:24 +0000 (11:12 +0200)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Sun, 6 Jun 2010 09:19:49 +0000 (02:19 -0700)
copy files from linux-next next-20100604

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
include/linux/bitops.h
include/linux/compat-2.6.35.h
include/linux/wireless.h

index b62de8c59dd4af01d4c5ba11f64a940b58307e1a..679369be321003ff77c2ca064474173cf6170a0f 100644 (file)
 #endif
 #endif
 
+extern unsigned int __sw_hweight8(unsigned int w);
+extern unsigned int __sw_hweight16(unsigned int w);
+extern unsigned int __sw_hweight32(unsigned int w);
+extern unsigned long __sw_hweight64(__u64 w);
+
 /*
  * Include this here because some architectures need generic_ffs/fls in
  * scope
@@ -23,9 +28,6 @@
             (bit) < (size); \
             (bit) = find_next_bit((addr), (size), (bit) + 1))
 
-/* Temporary */
-#define for_each_bit(bit, addr, size) for_each_set_bit(bit, addr, size)
-
 static __inline__ int get_bitmask_order(unsigned int count)
 {
        int order;
@@ -49,31 +51,6 @@ static inline unsigned long hweight_long(unsigned long w)
        return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
 }
 
-/*
- * Clearly slow versions of the hweightN() functions, their benefit is
- * of course compile time evaluation of constant arguments.
- */
-#define HWEIGHT8(w)                                    \
-      (        BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) +   \
-       (!!((w) & (1ULL << 0))) +                       \
-       (!!((w) & (1ULL << 1))) +                       \
-       (!!((w) & (1ULL << 2))) +                       \
-       (!!((w) & (1ULL << 3))) +                       \
-       (!!((w) & (1ULL << 4))) +                       \
-       (!!((w) & (1ULL << 5))) +                       \
-       (!!((w) & (1ULL << 6))) +                       \
-       (!!((w) & (1ULL << 7))) )
-
-#define HWEIGHT16(w) (HWEIGHT8(w)  + HWEIGHT8((w) >> 8))
-#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16))
-#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32))
-
-/*
- * Type invariant version that simply casts things to the
- * largest type.
- */
-#define HWEIGHT(w)   HWEIGHT64((u64)(w))
-
 /**
  * rol32 - rotate a 32-bit value left
  * @word: value to rotate
index 7091f7ccf0e76ee3df8f57e3a3426613fff5e142..b38d6deff4a112f8f0434c5fad16fbb5c6180977 100644 (file)
@@ -13,9 +13,6 @@
 #define SHRT_MAX       ((s16)(USHRT_MAX>>1))
 #define SHRT_MIN       ((s16)(-SHRT_MAX - 1))
 
-#define IW_HANDLER(id, func)                   \
-       [IW_IOCTL_IDX(id)] = func
-
 #define  SDIO_BUS_ECSI         0x20    /* Enable continuous SPI interrupt */
 #define  SDIO_BUS_SCSI         0x40    /* Support continuous SPI interrupt */
 
index 5b4c6c772a9b1ac53926d27250d0d11cb033f560..e6827eedf18bc4934f0f6b47e7b7a7c4de76f0df 100644 (file)
 #define SIOCIWFIRST    0x8B00
 #define SIOCIWLAST     SIOCIWLASTPRIV          /* 0x8BFF */
 #define IW_IOCTL_IDX(cmd)      ((cmd) - SIOCIWFIRST)
+#define IW_HANDLER(id, func)                   \
+       [IW_IOCTL_IDX(id)] = func
 
 /* Odd : get (world access), even : set (root access) */
 #define IW_IS_SET(cmd) (!((cmd) & 0x1))
  * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
 #define IW_EVENT_CAPA_BASE(cmd)                ((cmd >= SIOCIWFIRSTPRIV) ? \
                                         (cmd - SIOCIWFIRSTPRIV + 0x60) : \
-                                        (cmd - SIOCSIWCOMMIT))
+                                        (cmd - SIOCIWFIRST))
 #define IW_EVENT_CAPA_INDEX(cmd)       (IW_EVENT_CAPA_BASE(cmd) >> 5)
 #define IW_EVENT_CAPA_MASK(cmd)                (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
 /* Event capability constants - event autogenerated by the kernel