/* affinity_check is called each time a context is going to be scheduled. It returns the spu ptr on which the context must run.  */
static int has_affinity(struct spu_context *ctx)
/* affinity_check is called each time a context is going to be scheduled. It returns the spu ptr on which the context must run.  */
static int has_affinity(struct spu_context *ctx)
{
	struct spu_gang *gang = ctx->gang;
	if (list_empty(&ctx->aff_list))
		return 0;
	if (atomic_read(&ctx->gang->aff_sched_count) == 0)
		ctx->gang->aff_ref_spu = NULL;
	if (!gang->aff_ref_spu) {
		if (!(gang->aff_flags & AFF_MERGED))
			aff_merge_remaining_ctxs(gang);
		if (!(gang->aff_flags & AFF_OFFSETS_SET))
			aff_set_offsets(gang);
		aff_set_ref_point_location(gang);
	}
	return gang->aff_ref_spu != NULL;
}