Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4483335imb; Wed, 6 Mar 2019 14:44:12 -0800 (PST) X-Google-Smtp-Source: APXvYqwi0X8b2qOlWsYVxD9YigguEQURm/q3aeK6tmz12/yjpz6ON1jNtMEQcQajwp/6Fx5+Vqke X-Received: by 2002:a63:2bcd:: with SMTP id r196mr8264074pgr.355.1551912252562; Wed, 06 Mar 2019 14:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551912252; cv=none; d=google.com; s=arc-20160816; b=WK1Y3kTn6BSigdXOPibXJXxpY+jKF2nUkFgqMBTv/B0jAJCg/ZgG0G9vX4bALdGCWi Ymp9mH6Z/eiXOX/+MRLNljUAitoQksOlQ5Fp+NDU+kCLulVHNUD7DIp3vEHS+sVJiVgH w0wXUNadyVDijhNrNKlUgj4heaim1XxEbdP/KfhmcHPgjLJgiVocQ9PlYuuMDxGVKPxj 4PRSaLZ2+quEN7ROAG3WAgwEX8DYEsteZPu5rxptV3QuuSTtdqTqYlJ7Gy9dwFKA1BDX DzBDu4wU4VwvOvCnb71+QBagac/tN0i44WQIaO6IPO2IPnsvBEfFjYnZblsi4t8TSSK2 Ytwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pxbNDDqFC+39khGVZhvZypSyT4ICw43BIJ+PNAXnUXM=; b=IxiyrVgG/WQBKP/p3qniwUAps+YO/pKdboBCMlpoM+tkFrFbZEO5dMpLfViPbafqSD rXac/rwl4OaFMBqFY5HsXqK+2oxy53xB6vqUmL15Cr5ruEKY/hbUYoe0DZHMWKcsYT78 oG/3zbRpJBNh0CHzefK6wJLWibzcTqQ7rVyc4LO/inCLMv3asHaBz/ujAAPo4GulMA/t p0a65qmxR8opda/kngK43x9N0kl1SSyLxLRxN9DueeuOlJoztsLp8QEi7V1ATycgWHRF Xx/HWRFWa6nOszZEypIaNcVLmNYQm1JvbhLheCZ5lNkuUHgcNlmYbSTKh8+vNaSO3ZZX gy5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11si2373041pgp.169.2019.03.06.14.43.57; Wed, 06 Mar 2019 14:44:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726298AbfCFWnO (ORCPT + 99 others); Wed, 6 Mar 2019 17:43:14 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60844 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbfCFWnM (ORCPT ); Wed, 6 Mar 2019 17:43:12 -0500 Received: from localhost.localdomain (unknown [IPv6:2804:431:9719:798c:6bb0:a97a:4a09:e6d8]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: koike) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id D72E4280377; Wed, 6 Mar 2019 22:43:05 +0000 (GMT) From: Helen Koike To: linux-media@vger.kernel.org Cc: lucmaga@gmail.com, linux-kernel@vger.kernel.org, lkcamp@lists.libreplanetbr.org, andrealmeid@collabora.com, Hans Verkuil , kernel@collabora.com Subject: [PATCH 2/8] media: vimc: stream: fix thread state before sleep Date: Wed, 6 Mar 2019 19:42:38 -0300 Message-Id: <20190306224244.21070-3-helen.koike@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190306224244.21070-1-helen.koike@collabora.com> References: <20190306224244.21070-1-helen.koike@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Helen Koike --- drivers/media/platform/vimc/vimc-streamer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c index fcc897fb247b..392754c18046 100644 --- a/drivers/media/platform/vimc/vimc-streamer.c +++ b/drivers/media/platform/vimc/vimc-streamer.c @@ -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); } -- 2.20.1