diff options
author | Fabian Frederick <fabf@skynet.be> | 2015-02-20 13:12:53 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-03-25 01:53:28 -0400 |
commit | 111fbc68fd895ba437bcb03d5dcc4dd21bc61df8 (patch) | |
tree | e1d46889e5888dc4c9ef8da7b96bffd14355cf08 /drivers/macintosh/via-pmu.c | |
parent | 1f8c82ab1b0bc7e24601c0fca411fd27b9c883ef (diff) |
powerpc/pmac: replace current->state by set_current_state()
Use helper functions to access current->state.
Direct assignments are prone to races and therefore buggy.
current->state = TASK_RUNNING can be replaced by __set_current_state()
Thanks to Peter Zijlstra for the exact definition of the problem.
Suggested-By: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh/via-pmu.c')
-rw-r--r-- | drivers/macintosh/via-pmu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index aed3cb07a6fa..f9512bfa6c3c 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -2112,7 +2112,7 @@ pmu_read(struct file *file, char __user *buf, | |||
2112 | 2112 | ||
2113 | spin_lock_irqsave(&pp->lock, flags); | 2113 | spin_lock_irqsave(&pp->lock, flags); |
2114 | add_wait_queue(&pp->wait, &wait); | 2114 | add_wait_queue(&pp->wait, &wait); |
2115 | current->state = TASK_INTERRUPTIBLE; | 2115 | set_current_state(TASK_INTERRUPTIBLE); |
2116 | 2116 | ||
2117 | for (;;) { | 2117 | for (;;) { |
2118 | ret = -EAGAIN; | 2118 | ret = -EAGAIN; |
@@ -2141,7 +2141,7 @@ pmu_read(struct file *file, char __user *buf, | |||
2141 | schedule(); | 2141 | schedule(); |
2142 | spin_lock_irqsave(&pp->lock, flags); | 2142 | spin_lock_irqsave(&pp->lock, flags); |
2143 | } | 2143 | } |
2144 | current->state = TASK_RUNNING; | 2144 | __set_current_state(TASK_RUNNING); |
2145 | remove_wait_queue(&pp->wait, &wait); | 2145 | remove_wait_queue(&pp->wait, &wait); |
2146 | spin_unlock_irqrestore(&pp->lock, flags); | 2146 | spin_unlock_irqrestore(&pp->lock, flags); |
2147 | 2147 | ||