/* __vxge_hw_blockpool_block_allocate - Allocates a block from block pool This function allocates a block from block pool or from the system  */
struct __vxge_hw_blockpool_entry* __vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *devh, u32 size)
/* __vxge_hw_blockpool_block_allocate - Allocates a block from block pool This function allocates a block from block pool or from the system  */
struct __vxge_hw_blockpool_entry* __vxge_hw_blockpool_block_allocate(struct __vxge_hw_device *devh, u32 size)
{
	struct __vxge_hw_blockpool_entry *entry = NULL;
	struct __vxge_hw_blockpool  *blockpool;
	blockpool = &devh->block_pool;
	if (size == blockpool->block_size) {
		if (!list_empty(&blockpool->free_block_list))
			entry = (struct __vxge_hw_blockpool_entry *)
				list_first_entry(&blockpool->free_block_list,
					struct __vxge_hw_blockpool_entry,
					item);
		if (entry != NULL) {
			list_del(&entry->item);
			blockpool->pool_size--;
		}
	}
	if (entry != NULL)
		__vxge_hw_blockpool_blocks_add(blockpool);
	return entry;
}