/* spu_acquire_saved - lock spu contex and make sure it is in saved state @ctx: spu contex to lock  */
int spu_acquire_saved(struct spu_context *ctx)
/* spu_acquire_saved - lock spu contex and make sure it is in saved state @ctx: spu contex to lock  */
int spu_acquire_saved(struct spu_context *ctx)
{
	int ret;
	spu_context_nospu_trace(spu_acquire_saved__enter, ctx);
	ret = spu_acquire(ctx);
	if (ret)
		return ret;
	if (ctx->state != SPU_STATE_SAVED) {
		set_bit(SPU_SCHED_WAS_ACTIVE, &ctx->sched_flags);
		spu_deactivate(ctx);
	}
	return 0;
}