/* It is required to run memory_bm_position_reset() before the first call to this function.  */
static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
/* It is required to run memory_bm_position_reset() before the first call to this function.  */
static unsigned long memory_bm_next_pfn(struct memory_bitmap *bm)
{
	struct bm_block *bb;
	int bit;
	bb = bm->cur.block;
	do {
		bit = bm->cur.bit;
		bit = find_next_bit(bb->data, bm_block_bits(bb), bit);
		if (bit < bm_block_bits(bb))
			goto Return_pfn;
		bb = list_entry(bb->hook.next, struct bm_block, hook);
		bm->cur.block = bb;
		bm->cur.bit = 0;
	} while (&bb->hook != &bm->blocks);
	memory_bm_position_reset(bm);
	return BM_END_OF_MAP;
 Return_pfn:
	bm->cur.bit = bit + 1;
	return bb->start_pfn + bit;
}