Commit a948f8ce authored by Fabian Frederick's avatar Fabian Frederick Committed by David S. Miller

irda: 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: default avatarPeter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 30ff5476
...@@ -811,7 +811,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -811,7 +811,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
break; break;
} }
spin_unlock_irqrestore(&self->spinlock, flags); spin_unlock_irqrestore(&self->spinlock, flags);
current->state = TASK_RUNNING; __set_current_state(TASK_RUNNING);
} }
/* /*
......
...@@ -305,7 +305,7 @@ irnet_ctrl_read(irnet_socket * ap, ...@@ -305,7 +305,7 @@ irnet_ctrl_read(irnet_socket * ap,
/* Put ourselves on the wait queue to be woken up */ /* Put ourselves on the wait queue to be woken up */
add_wait_queue(&irnet_events.rwait, &wait); add_wait_queue(&irnet_events.rwait, &wait);
current->state = TASK_INTERRUPTIBLE; set_current_state(TASK_INTERRUPTIBLE);
for(;;) for(;;)
{ {
/* If there is unread events */ /* If there is unread events */
...@@ -321,7 +321,7 @@ irnet_ctrl_read(irnet_socket * ap, ...@@ -321,7 +321,7 @@ irnet_ctrl_read(irnet_socket * ap,
/* Yield and wait to be woken up */ /* Yield and wait to be woken up */
schedule(); schedule();
} }
current->state = TASK_RUNNING; __set_current_state(TASK_RUNNING);
remove_wait_queue(&irnet_events.rwait, &wait); remove_wait_queue(&irnet_events.rwait, &wait);
/* Did we got it ? */ /* Did we got it ? */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment