3 * (C) COPYRIGHT 2008-2010 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
8 * A copy of the licence is included with the program, and can also be obtained from Free Software
9 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #include <osk/mali_osk.h>
18 unsigned long osk_bitarray_find_first_zero_bit(const unsigned long *addr, unsigned long maxbit)
22 OSK_ASSERT(NULL != addr);
24 for ( total = 0; total < maxbit; total += OSK_BITS_PER_LONG, ++addr )
26 if (OSK_ULONG_MAX != *addr)
29 result = oskp_find_first_zero_bit( *addr );
30 /* non-negative signifies the bit was found */
33 total += (unsigned long)result;
39 /* Now check if we reached maxbit or above */
40 if ( total >= maxbit )
45 return total; /* either the found bit nr, or maxbit if not found */