From patchwork Mon Feb 15 22:12:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 8319741 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87B45C02AA for ; Mon, 15 Feb 2016 22:12:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 807292027D for ; Mon, 15 Feb 2016 22:12:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 52A232026D for ; Mon, 15 Feb 2016 22:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752939AbcBOWMS (ORCPT ); Mon, 15 Feb 2016 17:12:18 -0500 Received: from mail-ob0-f171.google.com ([209.85.214.171]:32895 "EHLO mail-ob0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467AbcBOWMR (ORCPT ); Mon, 15 Feb 2016 17:12:17 -0500 Received: by mail-ob0-f171.google.com with SMTP id jq7so46835281obb.0 for ; Mon, 15 Feb 2016 14:12:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=0XGuAn/8ksccOEjRIiMkUm7usJFrQgymXfD3km1vcUA=; b=XpQCtZ/0MPJxpTIjv/DzdnF3KRJ881RhLhAHdE0A4ZzRqTRakoneXvOQLxMdCp1Oa3 p8sEGZHHd3nQX0uXODWPQoLeSNdLkuUlJtQR/F4R4+cCJihxtokejMdAS/6P4EeC4JqK gr0/O4N/7mZWOWbe0NKAlF+q5lZHIITZLVHj0vpp+y36AlBrOBlvddCo18dxyVyPTH2Y iC7RoOWpOiryibiWZKeZY4pKaul82vk3tPzTHGS5TcU2ecHsbS5NXejXusIBW/JKnrkk POEeAxbg4d9C8FL3XKUUTiXjsmV2hUdg5OWSqK5uC9PvqraRogGRHPxNrJ840+MpRojJ QvPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=0XGuAn/8ksccOEjRIiMkUm7usJFrQgymXfD3km1vcUA=; b=JlPIKLz7Jp+Cf7cvBQhySJMtehc9aNYaTnE+XGjyAGXCpjJS8pmUfITgKcz7qVdQEL 7+WkCSz0ufdHfUlILclKNrwZGuU5wXMipGupdw+SJQSZJZ8+PLUGYbhdkYXOkvUjAowz y5BGNsuVB3gAec5o4c11FVQ7xMHt6QedZoUbYPbHEV5t/ek1GuDOCUaYlFpDJXYY3YRy nnUq9UphKzMmsVxJa4vdCdEM0XjSh8pO8VrCJpQmiDVm8gflBfuhApLz9SWUMc9cSTej ijsIjWpc85o+ZauZac67aPoLY2mmviwYSsBC19Qm/DSsjgS0OQE915H9RGNI/7Tc+8uY opUw== X-Gm-Message-State: AG10YOSfGcehacl55z+dkD+G0O57Fq9vYcdMB3HAPKOzKI0Se+6DkpPBqfADVgQ12YlgDQ== X-Received: by 10.60.58.6 with SMTP id m6mr13828635oeq.47.1455574337363; Mon, 15 Feb 2016 14:12:17 -0800 (PST) Received: from linux.site (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id tu11sm16178286oec.13.2016.02.15.14.12.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Feb 2016 14:12:16 -0800 (PST) From: Larry Finger To: kvalo@codeaurora.org Cc: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, Larry Finger Subject: [PATCH] rtlwifi: Change long delays to sleeps Date: Mon, 15 Feb 2016 16:12:07 -0600 Message-Id: <1455574327-2591-1-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Routine rtl_addr_delay() uses delay statements in code that can sleep. To improve system responsiveness, the various delay statements are changed. In addition, routines rtl_rfreg_delay() and rtl_bb_delay() are rewritten to use the code in rtl_addr_delay() for most of their input values. Suggested-by: Byeoungwook Kim Signed-off-by: Larry Finger --- Kalle, This patch will interfere with a set of 3 patches submitted by Byeoungwook Kim on Feb. 3, 2016 that are currently in the deferred list at patchwork. Larry drivers/net/wireless/realtek/rtlwifi/core.c | 44 ++++++++--------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 02eba0e..16ad0d6 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -54,59 +54,39 @@ EXPORT_SYMBOL(channel5g_80m); void rtl_addr_delay(u32 addr) { if (addr == 0xfe) - mdelay(50); + msleep(50); else if (addr == 0xfd) - mdelay(5); + msleep(5); else if (addr == 0xfc) - mdelay(1); + msleep(1); else if (addr == 0xfb) - udelay(50); + usleep_range(50, 100); else if (addr == 0xfa) - udelay(5); + usleep_range(5, 10); else if (addr == 0xf9) - udelay(1); + usleep_range(1, 2); } EXPORT_SYMBOL(rtl_addr_delay); void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr, u32 mask, u32 data) { - if (addr == 0xfe) { - mdelay(50); - } else if (addr == 0xfd) { - mdelay(5); - } else if (addr == 0xfc) { - mdelay(1); - } else if (addr == 0xfb) { - udelay(50); - } else if (addr == 0xfa) { - udelay(5); - } else if (addr == 0xf9) { - udelay(1); + if (addr >= 0xf9 && addr <= 0xfe) { + rtl_addr_delay(addr); } else { rtl_set_rfreg(hw, rfpath, addr, mask, data); - udelay(1); + usleep_range(1, 2); } } EXPORT_SYMBOL(rtl_rfreg_delay); void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data) { - if (addr == 0xfe) { - mdelay(50); - } else if (addr == 0xfd) { - mdelay(5); - } else if (addr == 0xfc) { - mdelay(1); - } else if (addr == 0xfb) { - udelay(50); - } else if (addr == 0xfa) { - udelay(5); - } else if (addr == 0xf9) { - udelay(1); + if (addr >= 0xf9 && addr <= 0xfe) { + rtl_addr_delay(addr); } else { rtl_set_bbreg(hw, addr, MASKDWORD, data); - udelay(1); + usleep_range(1, 2); } } EXPORT_SYMBOL(rtl_bb_delay);