~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/powerpc/include/asm/bitops.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
                return BITS_PER_LONG;
210
210
 
211
211
        /*
212
 
         * Calculate the bit position of the least signficant '1' bit in x
213
 
         * (since x has been changed this will actually be the least signficant
 
212
         * Calculate the bit position of the least significant '1' bit in x
 
213
         * (since x has been changed this will actually be the least significant
214
214
         * '0' bit in * the original x).  Note: (x & -x) gives us a mask that
215
215
         * is the least significant * (RIGHT-most) 1-bit of the value in x.
216
216
         */
281
281
 
282
282
/* Little-endian versions */
283
283
 
284
 
static __inline__ int test_le_bit(unsigned long nr,
285
 
                                  __const__ unsigned long *addr)
 
284
static __inline__ int test_bit_le(unsigned long nr,
 
285
                                  __const__ void *addr)
286
286
{
287
287
        __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
288
288
        return (tmp[nr >> 3] >> (nr & 7)) & 1;
289
289
}
290
290
 
291
 
#define __set_le_bit(nr, addr) \
292
 
        __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
293
 
#define __clear_le_bit(nr, addr) \
294
 
        __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
295
 
 
296
 
#define test_and_set_le_bit(nr, addr) \
297
 
        test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
298
 
#define test_and_clear_le_bit(nr, addr) \
299
 
        test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
300
 
 
301
 
#define __test_and_set_le_bit(nr, addr) \
302
 
        __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
303
 
#define __test_and_clear_le_bit(nr, addr) \
304
 
        __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
305
 
 
306
 
#define find_first_zero_le_bit(addr, size) generic_find_next_zero_le_bit((addr), (size), 0)
307
 
unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
 
291
static inline void __set_bit_le(int nr, void *addr)
 
292
{
 
293
        __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 
294
}
 
295
 
 
296
static inline void __clear_bit_le(int nr, void *addr)
 
297
{
 
298
        __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 
299
}
 
300
 
 
301
static inline int test_and_set_bit_le(int nr, void *addr)
 
302
{
 
303
        return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 
304
}
 
305
 
 
306
static inline int test_and_clear_bit_le(int nr, void *addr)
 
307
{
 
308
        return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 
309
}
 
310
 
 
311
static inline int __test_and_set_bit_le(int nr, void *addr)
 
312
{
 
313
        return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 
314
}
 
315
 
 
316
static inline int __test_and_clear_bit_le(int nr, void *addr)
 
317
{
 
318
        return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 
319
}
 
320
 
 
321
#define find_first_zero_bit_le(addr, size) \
 
322
        find_next_zero_bit_le((addr), (size), 0)
 
323
unsigned long find_next_zero_bit_le(const void *addr,
308
324
                                    unsigned long size, unsigned long offset);
309
325
 
310
 
unsigned long generic_find_next_le_bit(const unsigned long *addr,
 
326
unsigned long find_next_bit_le(const void *addr,
311
327
                                    unsigned long size, unsigned long offset);
312
328
/* Bitmap functions for the ext2 filesystem */
313
329
 
314
 
#define ext2_set_bit(nr,addr) \
315
 
        __test_and_set_le_bit((nr), (unsigned long*)addr)
316
 
#define ext2_clear_bit(nr, addr) \
317
 
        __test_and_clear_le_bit((nr), (unsigned long*)addr)
318
 
 
319
330
#define ext2_set_bit_atomic(lock, nr, addr) \
320
 
        test_and_set_le_bit((nr), (unsigned long*)addr)
 
331
        test_and_set_bit_le((nr), (unsigned long*)addr)
321
332
#define ext2_clear_bit_atomic(lock, nr, addr) \
322
 
        test_and_clear_le_bit((nr), (unsigned long*)addr)
323
 
 
324
 
#define ext2_test_bit(nr, addr)      test_le_bit((nr),(unsigned long*)addr)
325
 
 
326
 
#define ext2_find_first_zero_bit(addr, size) \
327
 
        find_first_zero_le_bit((unsigned long*)addr, size)
328
 
#define ext2_find_next_zero_bit(addr, size, off) \
329
 
        generic_find_next_zero_le_bit((unsigned long*)addr, size, off)
330
 
 
331
 
#define ext2_find_next_bit(addr, size, off) \
332
 
        generic_find_next_le_bit((unsigned long *)addr, size, off)
333
 
/* Bitmap functions for the minix filesystem.  */
334
 
 
335
 
#define minix_test_and_set_bit(nr,addr) \
336
 
        __test_and_set_le_bit(nr, (unsigned long *)addr)
337
 
#define minix_set_bit(nr,addr) \
338
 
        __set_le_bit(nr, (unsigned long *)addr)
339
 
#define minix_test_and_clear_bit(nr,addr) \
340
 
        __test_and_clear_le_bit(nr, (unsigned long *)addr)
341
 
#define minix_test_bit(nr,addr) \
342
 
        test_le_bit(nr, (unsigned long *)addr)
343
 
 
344
 
#define minix_find_first_zero_bit(addr,size) \
345
 
        find_first_zero_le_bit((unsigned long *)addr, size)
 
333
        test_and_clear_bit_le((nr), (unsigned long*)addr)
346
334
 
347
335
#include <asm-generic/bitops/sched.h>
348
336