diff options
author | Arnd Bergmann <arnd@arndb.de> | 2006-01-04 14:31:28 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 23:44:43 -0500 |
commit | 8837d9216f99048636fbb2c11347358e99e06181 (patch) | |
tree | 26e5cab20e59879f5e3271ea73c0320ae31da140 /arch/powerpc/platforms/cell | |
parent | 3f51dd91c80746a5cf76f8c4a77bfc88aa82bb9e (diff) |
[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')
-rw-r--r-- | arch/powerpc/platforms/cell/spu_base.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/sched.c | 8 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/spufs.h | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/switch.c | 8 |
4 files changed, 12 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 3a5302151e09..ae8354740721 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -63,7 +63,7 @@ static void spu_restart_dma(struct spu *spu) | |||
63 | { | 63 | { |
64 | struct spu_priv2 __iomem *priv2 = spu->priv2; | 64 | struct spu_priv2 __iomem *priv2 = spu->priv2; |
65 | 65 | ||
66 | if (!test_bit(SPU_CONTEXT_SWITCH_PENDING_nr, &spu->flags)) | 66 | if (!test_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags)) |
67 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND); | 67 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND); |
68 | } | 68 | } |
69 | 69 | ||
@@ -75,7 +75,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea) | |||
75 | 75 | ||
76 | pr_debug("%s\n", __FUNCTION__); | 76 | pr_debug("%s\n", __FUNCTION__); |
77 | 77 | ||
78 | if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags)) { | 78 | if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) { |
79 | /* SLBs are pre-loaded for context switch, so | 79 | /* SLBs are pre-loaded for context switch, so |
80 | * we should never get here! | 80 | * we should never get here! |
81 | */ | 81 | */ |
@@ -122,7 +122,7 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr) | |||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags)) { | 125 | if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) { |
126 | printk("%s: invalid access during switch!\n", __func__); | 126 | printk("%s: invalid access during switch!\n", __func__); |
127 | return 1; | 127 | return 1; |
128 | } | 128 | } |
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) | |||
214 | 214 | ||
215 | down_write(&ctx->state_sema); | 215 | down_write(&ctx->state_sema); |
216 | spu = ctx->spu; | 216 | spu = ctx->spu; |
217 | if (spu && (ctx->flags & SPU_CONTEXT_PREEMPT)) { | 217 | if (spu && test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) { |
218 | if (atomic_read(&spu->rq->prio.nr_blocked)) { | 218 | if (atomic_read(&spu->rq->prio.nr_blocked)) { |
219 | pr_debug("%s: spu=%d\n", __func__, spu->number); | 219 | pr_debug("%s: spu=%d\n", __func__, spu->number); |
220 | ctx->ops->runcntl_stop(ctx); | 220 | ctx->ops->runcntl_stop(ctx); |
221 | spu_deactivate(ctx); | 221 | spu_deactivate(ctx); |
222 | wake_up_all(&ctx->stop_wq); | 222 | wake_up_all(&ctx->stop_wq); |
223 | } else { | 223 | } else { |
224 | clear_bit(SPU_CONTEXT_PREEMPT_nr, &ctx->flags); | 224 | clear_bit(SPU_CONTEXT_PREEMPT, &ctx->flags); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | up_write(&ctx->state_sema); | 227 | up_write(&ctx->state_sema); |
@@ -234,7 +234,7 @@ static void schedule_spu_reaper(struct spu_runqueue *rq, struct spu *spu) | |||
234 | unsigned long now = jiffies; | 234 | unsigned long now = jiffies; |
235 | unsigned long expire = spu->timestamp + SPU_MIN_TIMESLICE; | 235 | unsigned long expire = spu->timestamp + SPU_MIN_TIMESLICE; |
236 | 236 | ||
237 | set_bit(SPU_CONTEXT_PREEMPT_nr, &ctx->flags); | 237 | set_bit(SPU_CONTEXT_PREEMPT, &ctx->flags); |
238 | INIT_WORK(&ctx->reap_work, spu_reaper, ctx); | 238 | INIT_WORK(&ctx->reap_work, spu_reaper, ctx); |
239 | if (time_after(now, expire)) | 239 | if (time_after(now, expire)) |
240 | schedule_work(&ctx->reap_work); | 240 | schedule_work(&ctx->reap_work); |
@@ -250,7 +250,7 @@ static void check_preempt_active(struct spu_runqueue *rq) | |||
250 | list_for_each(p, &rq->active_list) { | 250 | list_for_each(p, &rq->active_list) { |
251 | struct spu *spu = list_entry(p, struct spu, sched_list); | 251 | struct spu *spu = list_entry(p, struct spu, sched_list); |
252 | struct spu_context *ctx = spu->ctx; | 252 | struct spu_context *ctx = spu->ctx; |
253 | if (!(ctx->flags & SPU_CONTEXT_PREEMPT)) { | 253 | if (!test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) { |
254 | if (!worst || (spu->prio > worst->prio)) { | 254 | if (!worst || (spu->prio > worst->prio)) { |
255 | worst = spu; | 255 | worst = spu; |
256 | } | 256 | } |
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 { | |||
37 | 37 | ||
38 | struct spu_context_ops; | 38 | struct spu_context_ops; |
39 | 39 | ||
40 | #define SPU_CONTEXT_PREEMPT_nr 0UL | 40 | #define SPU_CONTEXT_PREEMPT 0UL |
41 | #define SPU_CONTEXT_PREEMPT (1UL << SPU_CONTEXT_PREEMPT_nr) | ||
42 | 41 | ||
43 | struct spu_context { | 42 | struct spu_context { |
44 | struct spu *spu; /* pointer to a physical SPU */ | 43 | 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) | |||
165 | * Restore, Step 5: | 165 | * Restore, Step 5: |
166 | * Set a software context switch pending flag. | 166 | * Set a software context switch pending flag. |
167 | */ | 167 | */ |
168 | set_bit(SPU_CONTEXT_SWITCH_PENDING_nr, &spu->flags); | 168 | set_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); |
169 | mb(); | 169 | mb(); |
170 | } | 170 | } |
171 | 171 | ||
@@ -767,8 +767,8 @@ static inline void set_switch_active(struct spu_state *csa, struct spu *spu) | |||
767 | * Change the software context switch pending flag | 767 | * Change the software context switch pending flag |
768 | * to context switch active. | 768 | * to context switch active. |
769 | */ | 769 | */ |
770 | set_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags); | 770 | set_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags); |
771 | clear_bit(SPU_CONTEXT_SWITCH_PENDING_nr, &spu->flags); | 771 | clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags); |
772 | mb(); | 772 | mb(); |
773 | } | 773 | } |
774 | 774 | ||
@@ -1786,7 +1786,7 @@ static inline void reset_switch_active(struct spu_state *csa, struct spu *spu) | |||
1786 | /* Restore, Step 74: | 1786 | /* Restore, Step 74: |
1787 | * Reset the "context switch active" flag. | 1787 | * Reset the "context switch active" flag. |
1788 | */ | 1788 | */ |
1789 | clear_bit(SPU_CONTEXT_SWITCH_ACTIVE_nr, &spu->flags); | 1789 | clear_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags); |
1790 | mb(); | 1790 | mb(); |
1791 | } | 1791 | } |
1792 | 1792 | ||