summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spufs
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2006-01-04 20:31:28 +0100
committerPaul Mackerras <paulus@samba.org>2006-01-09 05:44:43 +0100
commit8837d9216f99048636fbb2c11347358e99e06181 (patch)
tree26e5cab20e59879f5e3271ea73c0320ae31da140 /arch/powerpc/platforms/cell/spufs
parent[PATCH] spufs: fix spufs_fill_dir error path (diff)
downloadlinux-8837d9216f99048636fbb2c11347358e99e06181.tar.xz
linux-8837d9216f99048636fbb2c11347358e99e06181.zip
[PATCH] spufs: clean up use of bitops
checking bits manually might not be synchonized with the use of set_bit/clear_bit. Make sure we always use the correct bitops by removing the unnecessary identifiers. Signed-off-by: Arnd Bergmann <arndb@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spufs')
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h3
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c8
3 files changed, 9 insertions, 10 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 719ff27ce73e..c34198c29159 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -214,14 +214,14 @@ static void spu_reaper(void *data)
down_write(&ctx->state_sema);
spu = ctx->spu;
- if (spu && (ctx->flags & SPU_CONTEXT_PREEMPT)) {
+ if (spu && test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) {
if (atomic_read(&spu->rq->prio.nr_blocked)) {
pr_debug("%s: spu=%d\n", __func__, spu->number);
ctx->ops->runcntl_stop(ctx);
spu_deactivate(ctx);
wake_up_all(&ctx->stop_wq);
} else {
- clear_bit(SPU_CONTEXT_PREEMPT_nr, &ctx->flags);
+ clear_bit(SPU_CONTEXT_PREEMPT, &ctx->flags);
}
}
up_write(&ctx->state_sema);
@@ -234,7 +234,7 @@ static void schedule_spu_reaper(struct spu_runqueue *rq, struct spu *spu)
unsigned long now = jiffies;
unsigned long expire = spu->timestamp + SPU_MIN_TIMESLICE;
- set_bit(SPU_CONTEXT_PREEMPT_nr, &ctx->flags);
+ set_bit(SPU_CONTEXT_PREEMPT, &ctx->flags);
INIT_WORK(&ctx->reap_work, spu_reaper, ctx);
if (time_after(now, expire))
schedule_work(&ctx->reap_work);
@@ -250,7 +250,7 @@ static void check_preempt_active(struct spu_runqueue *rq)
list_for_each(p, &rq->active_list) {
struct spu *spu = list_entry(p, struct spu, sched_list);
struct spu_context *ctx = spu->ctx;
- if (!(ctx->flags & SPU_CONTEXT_PREEMPT)) {
+ if (!test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) {
if (!worst || (spu->prio > worst->prio)) {
worst = spu;
}
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index b50474450819..48961ac584a1 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -37,8 +37,7 @@ enum {
struct spu_context_ops;
-#define SPU_CONTEXT_PREEMPT_nr 0UL
-#define SPU_CONTEXT_PREEMPT (1UL << SPU_CONTEXT_PREEMPT_nr)
+#define SPU_CONTEXT_PREEMPT 0UL
struct spu_context {
struct spu *spu; /* pointer to a physical SPU */
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 010a9fe55ef8..de1ad146fc63 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -165,7 +165,7 @@ static inline void set_switch_pending(struct spu_state *csa, struct spu *spu)
* Restore, Step 5:
* Set a software context switch pending flag.
*/
- set_bit(SPU_CONTEXT_SWITCH_PENDING_nr, &spu->flags);
+ set_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags);
mb();
}
@@ -767,8 +767,8 @@ static inline void set_switch_active(struct spu_state *csa, struct spu *spu)
* Change the software context switch pending flag
* to context switch active.
*/
- set_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags);
- clear_bit(SPU_CONTEXT_SWITCH_PENDING_nr, &spu->flags);
+ set_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
+ clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags);
mb();
}
@@ -1786,7 +1786,7 @@ static inline void reset_switch_active(struct spu_state *csa, struct spu *spu)
/* Restore, Step 74:
* Reset the "context switch active" flag.
*/
- clear_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags);
+ clear_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
mb();
}