From patchwork Thu Jun 22 01:24:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqing Pan X-Patchwork-Id: 9803213 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CEEEF60234 for ; Thu, 22 Jun 2017 01:25:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8B98283A5 for ; Thu, 22 Jun 2017 01:25:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC2B428554; Thu, 22 Jun 2017 01:25:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6236E283A5 for ; Thu, 22 Jun 2017 01:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752020AbdFVBZD (ORCPT ); Wed, 21 Jun 2017 21:25:03 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43972 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148AbdFVBZC (ORCPT ); Wed, 21 Jun 2017 21:25:02 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AB261606DC; Thu, 22 Jun 2017 01:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498094701; bh=SyFPbLwW1EL4/SHV6cAeM1apjDH2Z6iv0Vqz+yiHbdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iq8vTc9+uwJcAEerWyPkAICmdiFGeVkn2RM53G11DlEMM467UHCo6KftrY2Ye/cOg SNIaKEBdzSIBPmViiL2Hakbi2ksjWcKmVwGUufTZyQF9ofsztn8GDmED5Ewioy5W/B iVtQ6Dtd+5UrwVJ30QWJg/YBW8YdSkzLilc0XGV0= Received: from smtp.codeaurora.org (unknown [180.166.53.21]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: miaoqing@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id F0154607BE; Thu, 22 Jun 2017 01:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498094701; bh=SyFPbLwW1EL4/SHV6cAeM1apjDH2Z6iv0Vqz+yiHbdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iq8vTc9+uwJcAEerWyPkAICmdiFGeVkn2RM53G11DlEMM467UHCo6KftrY2Ye/cOg SNIaKEBdzSIBPmViiL2Hakbi2ksjWcKmVwGUufTZyQF9ofsztn8GDmED5Ewioy5W/B iVtQ6Dtd+5UrwVJ30QWJg/YBW8YdSkzLilc0XGV0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F0154607BE Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=miaoqing@codeaurora.org Received: by smtp.codeaurora.org (sSMTP sendmail emulation); Thu, 22 Jun 2017 09:24:38 +0800 From: miaoqing@codeaurora.org To: kvalo@qca.qualcomm.com Cc: linux-wireless@vger.kernel.org, ath9k-devel@qca.qualcomm.com, sssa@qti.qualcomm.com, giulio.genovese@gmail.com, Miaoqing Pan Subject: [PATCH 2/3] ath9k: avoid potential freezing Date: Thu, 22 Jun 2017 09:24:28 +0800 Message-Id: <1498094669-6510-2-git-send-email-miaoqing@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1498094669-6510-1-git-send-email-miaoqing@codeaurora.org> References: <1498094669-6510-1-git-send-email-miaoqing@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Miaoqing Pan In the worst case, ath9k_rng_stop() may take 10s to stop rng kthread. The time is too long for users, use wait_event_interruptible_timeout() instead of msleep_interruptible(), wakup immediately once kthread_should_stop() is true. Signed-off-by: Miaoqing Pan --- drivers/net/wireless/ath/ath9k/rng.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/rng.c b/drivers/net/wireless/ath/ath9k/rng.c index 73f46fb..f9d3d6e 100644 --- a/drivers/net/wireless/ath/ath9k/rng.c +++ b/drivers/net/wireless/ath/ath9k/rng.c @@ -24,6 +24,8 @@ #define ATH9K_RNG_BUF_SIZE 320 #define ATH9K_RNG_ENTROPY(x) (((x) * 8 * 10) >> 5) /* quality: 10/32 */ +static DECLARE_WAIT_QUEUE_HEAD(rng_queue); + static int ath9k_rng_data_read(struct ath_softc *sc, u32 *buf, u32 buf_size) { int i, j; @@ -85,7 +87,9 @@ static int ath9k_rng_kthread(void *data) ATH9K_RNG_BUF_SIZE); if (unlikely(!bytes_read)) { delay = ath9k_rng_delay_get(++fail_stats); - msleep_interruptible(delay); + wait_event_interruptible_timeout(rng_queue, + kthread_should_stop(), + msecs_to_jiffies(delay)); continue; }