]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/batman-adv/bitarray.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / net / batman-adv / bitarray.c
similarity index 91%
rename from drivers/staging/batman-adv/bitarray.c
rename to net/batman-adv/bitarray.c
index 814274fbaa2fc278efdf1bafdff8673506fc00f1..bbcd8f744cdd402bb13ed2a71a969ec9b1220ff6 100644 (file)
@@ -26,7 +26,7 @@
 
 /* returns true if the corresponding bit in the given seq_bits indicates true
  * and curr_seqno is within range of last_seqno */
-uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint32_t last_seqno,
+uint8_t get_bit_status(unsigned long *seq_bits, uint32_t last_seqno,
                       uint32_t curr_seqno)
 {
        int32_t diff, word_offset, word_num;
@@ -40,7 +40,7 @@ uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint32_t last_seqno,
                /* which position in the selected word */
                word_offset = (last_seqno - curr_seqno) % WORD_BIT_SIZE;
 
-               if (seq_bits[word_num] & 1 << word_offset)
+               if (test_bit(word_offset, &seq_bits[word_num]))
                        return 1;
                else
                        return 0;
@@ -48,7 +48,7 @@ uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint32_t last_seqno,
 }
 
 /* turn corresponding bit on, so we can remember that we got the packet */
-void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n)
+void bit_mark(unsigned long *seq_bits, int32_t n)
 {
        int32_t word_offset, word_num;
 
@@ -61,11 +61,11 @@ void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n)
        /* which position in the selected word */
        word_offset = n % WORD_BIT_SIZE;
 
-       seq_bits[word_num] |= 1 << word_offset; /* turn the position on */
+       set_bit(word_offset, &seq_bits[word_num]); /* turn the position on */
 }
 
 /* shift the packet array by n places. */
-static void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n)
+static void bit_shift(unsigned long *seq_bits, int32_t n)
 {
        int32_t word_offset, word_num;
        int32_t i;
@@ -113,7 +113,7 @@ static void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n)
                seq_bits[i] = 0;
 }
 
-static void bit_reset_window(TYPE_OF_WORD *seq_bits)
+static void bit_reset_window(unsigned long *seq_bits)
 {
        int i;
        for (i = 0; i < NUM_WORDS; i++)
@@ -127,7 +127,7 @@ static void bit_reset_window(TYPE_OF_WORD *seq_bits)
  *  1 if the window was moved (either new or very old)
  *  0 if the window was not moved/shifted.
  */
-char bit_get_packet(void *priv, TYPE_OF_WORD *seq_bits,
+char bit_get_packet(void *priv, unsigned long *seq_bits,
                    int32_t seq_num_diff, int8_t set_mark)
 {
        struct bat_priv *bat_priv = (struct bat_priv *)priv;
@@ -190,7 +190,7 @@ char bit_get_packet(void *priv, TYPE_OF_WORD *seq_bits,
 /* count the hamming weight, how many good packets did we receive? just count
  * the 1's.
  */
-int bit_packet_count(TYPE_OF_WORD *seq_bits)
+int bit_packet_count(unsigned long *seq_bits)
 {
        int i, hamming = 0;