public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7 linux-next] swim: replace current->state by set_current_state()
@ 2015-02-20 18:12 Fabian Frederick
  2015-02-20 18:12 ` [PATCH 2/7 linux-next] mISDN: " Fabian Frederick
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Fabian Frederick @ 2015-02-20 18:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Peter Zijlstra, Greg Kroah-Hartman, Fabian Frederick

Use helper function to access current->state.
Direct assignments are prone to races and therefore buggy.

Thanks to Peter Zijlstra for the exact definition of the problem.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 drivers/block/swim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index b5afd49..e9bb759 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -331,7 +331,7 @@ static inline void swim_motor(struct swim __iomem *base,
 			swim_select(base, RELAX);
 			if (swim_readbit(base, MOTOR_ON))
 				break;
-			current->state = TASK_INTERRUPTIBLE;
+			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(1);
 		}
 	} else if (action == OFF) {
@@ -350,7 +350,7 @@ static inline void swim_eject(struct swim __iomem *base)
 		swim_select(base, RELAX);
 		if (!swim_readbit(base, DISK_IN))
 			break;
-		current->state = TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(1);
 	}
 	swim_select(base, RELAX);
@@ -374,7 +374,7 @@ static inline int swim_step(struct swim __iomem *base)
 
 	for (wait = 0; wait < HZ; wait++) {
 
-		current->state = TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(1);
 
 		swim_select(base, RELAX);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-02-22 20:25 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-20 18:12 [PATCH 1/7 linux-next] swim: replace current->state by set_current_state() Fabian Frederick
2015-02-20 18:12 ` [PATCH 2/7 linux-next] mISDN: " Fabian Frederick
2015-02-22 20:24   ` David Miller
2015-02-20 18:12 ` [PATCH 3/7 linux-next] powerpc/pmac: " Fabian Frederick
2015-02-20 18:12 ` [PATCH 4/7 linux-next] saa7146: " Fabian Frederick
2015-02-20 18:12 ` [PATCH 5/7 linux-next] hso: replace current->state by __set_current_state() Fabian Frederick
2015-02-22 20:25   ` David Miller
2015-02-20 18:12 ` [PATCH 6/7 linux-next] wan: cosa: replace current->state by set_current_state() Fabian Frederick
2015-02-20 18:26   ` Jan Yenya Kasprzak
2015-02-20 18:34   ` Sergei Shtylyov
2015-02-20 18:51     ` Fabian Frederick
2015-02-20 19:15       ` Sergei Shtylyov
2015-02-20 18:58     ` Peter Zijlstra
2015-02-20 19:31       ` Eric Dumazet
2015-02-20 19:44         ` Eric Dumazet
2015-02-20 20:02         ` Peter Zijlstra
2015-02-21  7:42       ` Fabian Frederick
2015-02-22 20:25   ` David Miller
2015-02-20 18:12 ` [PATCH 7/7 linux-next] serial: core: replace current->state by __set_current_state() Fabian Frederick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox