/* Returns a vector_desc entry for an source, the cpu parameter is used to tell GPIO_INT and GPIO_NMI from different CPUs  */
static struct vector_desc_t* find_desc_for_source(int source, int cpu)
/* Returns a vector_desc entry for an source, the cpu parameter is used to tell GPIO_INT and GPIO_NMI from different CPUs  */
static struct vector_desc_t* find_desc_for_source(int source, int cpu)
{
	struct vector_desc_t *vd = vector_desc_head;
	while (vd != NULL) {
		if (!(vd->flags & VECDESC_FL_SHARED)) {
			if (vd->source == source && cpu == vd->cpu) {
				break;
			}
		} else if (vd->cpu == cpu) {
			bool found = false;
			struct shared_vector_desc_t *svd = vd->shared_vec_info;
			assert(svd != NULL);
			while (svd) {
				if (svd->source == source) {
					found = true;
					break;
				}
				svd = svd->next;
			}
			if (found) {
				break;
			}
		}
		vd = vd->next;
	}
	return vd;
}