Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17224
b: refs/heads/master
c: 762cf6d
h: refs/heads/master
v: v3
  • Loading branch information
Arnd Bergmann authored and Paul Mackerras committed Jan 9, 2006
1 parent 04360eb commit 0ca276d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c902be71dc6d5e8473bd021feafc8c3608e2b82a
refs/heads/master: 762cf6dac2623473e83bb271f2bbe97d2355c64d
10 changes: 6 additions & 4 deletions trunk/arch/powerpc/platforms/cell/spufs/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,27 +120,29 @@ int spu_acquire_runnable(struct spu_context *ctx)
ctx->spu->prio = current->prio;
return 0;
}
up_read(&ctx->state_sema);

down_write(&ctx->state_sema);
/* ctx is about to be freed, can't acquire any more */
if (!ctx->owner) {
ret = -EINVAL;
goto out;
}
up_read(&ctx->state_sema);

down_write(&ctx->state_sema);
if (ctx->state == SPU_STATE_SAVED) {
ret = spu_activate(ctx, 0);
ctx->state = SPU_STATE_RUNNABLE;
}
downgrade_write(&ctx->state_sema);
if (ret)
goto out;

downgrade_write(&ctx->state_sema);
/* On success, we return holding the lock */

return ret;
out:
/* Release here, to simplify calling code. */
up_read(&ctx->state_sema);
up_write(&ctx->state_sema);

return ret;
}
Expand Down

0 comments on commit 0ca276d

Please sign in to comment.