/* pm8001_tag_alloc - allocate a empty tag for task used. @pm8001_ha: our hba struct @tag_out: the found empty tag .  */
int pm8001_tag_alloc(struct pm8001_hba_info *pm8001_ha, u32 *tag_out)
/* pm8001_tag_alloc - allocate a empty tag for task used. @pm8001_ha: our hba struct @tag_out: the found empty tag .  */
int pm8001_tag_alloc(struct pm8001_hba_info *pm8001_ha, u32 *tag_out)
{
	unsigned int index, tag;
	void *bitmap = pm8001_ha->tags;
	index = find_first_zero_bit(bitmap, pm8001_ha->tags_num);
	tag = index;
	if (tag >= pm8001_ha->tags_num)
		return -SAS_QUEUE_FULL;
	pm8001_tag_set(pm8001_ha, tag);
	*tag_out = tag;
	return 0;
}