[media] saa7146: replace current->state by set_current_state()
authorFabian Frederick <fabf@skynet.be>
Fri, 20 Feb 2015 18:12:54 +0000 (15:12 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 3 Mar 2015 14:15:42 +0000 (11:15 -0300)
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: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/common/saa7146/saa7146_vbi.c

index 1e71e374bbfebe8b0eecc30d1516ccd983108059..2da99575877802157f0e20358419cee638f1af00 100644 (file)
@@ -95,7 +95,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
 
                /* prepare to wait to be woken up by the irq-handler */
                add_wait_queue(&vv->vbi_wq, &wait);
-               current->state = TASK_INTERRUPTIBLE;
+               set_current_state(TASK_INTERRUPTIBLE);
 
                /* start rps1 to enable workaround */
                saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
@@ -106,7 +106,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
                DEB_VBI("brs bug workaround %d/1\n", i);
 
                remove_wait_queue(&vv->vbi_wq, &wait);
-               current->state = TASK_RUNNING;
+               __set_current_state(TASK_RUNNING);
 
                /* disable rps1 irqs */
                SAA7146_IER_DISABLE(dev,MASK_28);