]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
media: vimc: stream: fix thread state before sleep
authorHelen Fornazier <helen.koike@collabora.com>
Wed, 6 Mar 2019 22:42:38 +0000 (17:42 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838700
[ Upstream commit 2978a505aaa981b279ef359f74ba93d25098e0a0 ]

The state TASK_UNINTERRUPTIBLE should be set just before
schedule_timeout() call, so it knows the sleep mode it should enter.
There is no point in setting TASK_UNINTERRUPTIBLE at the initialization
of the thread as schedule_timeout() will set the state back to
TASK_RUNNING.

This fixes a warning in __might_sleep() call, as it's expecting the
task to be in TASK_RUNNING state just before changing the state to
a sleeping state.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/platform/vimc/vimc-streamer.c

index fcc897fb247bc2bc14c01471f99eccc46c2dec73..392754c18046cb0ac8b4285ae653f59e23aff5a3 100644 (file)
@@ -120,7 +120,6 @@ static int vimc_streamer_thread(void *data)
        int i;
 
        set_freezable();
-       set_current_state(TASK_UNINTERRUPTIBLE);
 
        for (;;) {
                try_to_freeze();
@@ -137,6 +136,7 @@ static int vimc_streamer_thread(void *data)
                                break;
                }
                //wait for 60hz
+               set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(HZ / 60);
        }