From patchwork Wed Feb 3 01:59:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byeoungwook Kim X-Patchwork-Id: 8197011 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 31786BEEE5 for ; Wed, 3 Feb 2016 02:00:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6915E20256 for ; Wed, 3 Feb 2016 02:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C1E120253 for ; Wed, 3 Feb 2016 02:00:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932516AbcBCCAA (ORCPT ); Tue, 2 Feb 2016 21:00:00 -0500 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33307 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932130AbcBCB77 (ORCPT ); Tue, 2 Feb 2016 20:59:59 -0500 Received: by mail-pa0-f67.google.com with SMTP id pv5so267196pac.0; Tue, 02 Feb 2016 17:59:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=VNBD5lChzPSSTn/K39zejmuh+LX5WjNQB1oTOmVl3wM=; b=HbgCo9zEdcXx1bVTPCwNYYe5Ur0npdx3APkQsviZsaBW1BSshafGZUVM1J1dKWQ1z7 Wg9JUMoQs8RY81q4tQ6AU7zU/eSMFjTF4iE7G1+mQ/Q8sx3IJW4aO5Szyb/g7Nb1JzOq uyhCOTUMSu0zxF6SgSjxB76Jj2vo+081lW9nebkWMaKDyDrHf2fUWcmNE5uf98ngYEvY jh2V9sgmguFF4fllLa+ST8urrVwhS2maa9Qllhr0s34oljVdYnVjTwNHpjYuz68A95le WuJFT1QvIGI30fDl4JUNKNAcGbRAysCrKSMCtHyFPv4pPsHkTDtE9N77kT2t3huQEjiz VFhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=VNBD5lChzPSSTn/K39zejmuh+LX5WjNQB1oTOmVl3wM=; b=b8IYRuAubWRB0x+vAV+7PjE6hBgtsdHdipR4PFFwxec3M6PjvqlplpWA+cahxJ0bHB ziM5o21jnf9e9w5AHnT33xP+7Ow17NtS8ApNSjqfwJf5lW4NKGmQ6GLCmibfDdAt67jW toPgqQRsIeZx9KXddQ4gSm28qktg0s+WjyvwlpLc18t6rLM6b3UD4ZkKHhiLF5uypLzi /xIK3VtTcc5VJGxaHjp0oHnSaoxr/Qt0ET9VLWr4z2EhiITBNb2BWrXu46zjeAodkEth qwsyZra58S/wAyGP56smN/hnSHCzj6NPmMUYATRdwQkVhSHDKJCD0g4Y27qwK6loAKlJ +MzA== X-Gm-Message-State: AG10YOTMwkNm2gvLH/+Aw8h+Xj12grP/iFBSFSTPg3E3qvEBFtF5ktXIbTjIURhgWYYAXw== X-Received: by 10.66.235.202 with SMTP id uo10mr52197196pac.63.1454464798758; Tue, 02 Feb 2016 17:59:58 -0800 (PST) Received: from gmail.com ([210.118.75.116]) by smtp.gmail.com with ESMTPSA id 26sm5422410pfo.55.2016.02.02.17.59.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2016 17:59:58 -0800 (PST) Date: Wed, 3 Feb 2016 10:59:53 +0900 From: Byeoungwook Kim To: Larry.Finger@lwfinger.net Cc: kvalo@codeaurora.org, chaoming_li@realsil.com.cn, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] rtlwifi: Fix improve function 'rtl_addr_delay()' in core.c Message-ID: <20160203015953.GA13562@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FSL_HELO_FAKE, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY 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 Conditional codes in rtl_addr_delay() were improved in readability and performance by using switch codes. Signed-off-by: Byeoungwook Kim Reported-by: Julian Calaby Reviewed-by: Julian Calaby --- drivers/net/wireless/realtek/rtlwifi/core.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 4ae421e..05f432c 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -37,18 +37,26 @@ void rtl_addr_delay(u32 addr) { - if (addr == 0xfe) + switch (addr) { + case 0xfe: mdelay(50); - else if (addr == 0xfd) + break; + case 0xfd: mdelay(5); - else if (addr == 0xfc) + break; + case 0xfc: mdelay(1); - else if (addr == 0xfb) + break; + case 0xfb: udelay(50); - else if (addr == 0xfa) + break; + case 0xfa: udelay(5); - else if (addr == 0xf9) + break; + case 0xf9: udelay(1); + break; + }; } EXPORT_SYMBOL(rtl_addr_delay);