From patchwork Wed Feb 3 02:15:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byeoungwook Kim X-Patchwork-Id: 8197051 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9E9A99F4DD for ; Wed, 3 Feb 2016 02:15:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7F8920256 for ; Wed, 3 Feb 2016 02:15:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01E2320221 for ; Wed, 3 Feb 2016 02:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755375AbcBCCPS (ORCPT ); Tue, 2 Feb 2016 21:15:18 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33471 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754270AbcBCCPQ (ORCPT ); Tue, 2 Feb 2016 21:15:16 -0500 Received: by mail-pf0-f194.google.com with SMTP id e126so296366pfe.0; Tue, 02 Feb 2016 18:15:16 -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=sc+9wE6V9Ihv/yoVjMcgbyokg5qzgLFQC6Rj2iMBc2A=; b=tvqHKsc3sTedc3YwBc5C/4o1let1W5MGqamrLuiVG02Kwbp1wViM+3/UdayUzwuU2k UmIL+btkDKANfQXR4nKzjTkWiggFFdyK8tzMza/6LRoZzIzQ8Kd1hwRuOodeAHXJF3Y+ yy5J9OU+bV/pJdAR6tpOuWxf3vUcRuq7zjdEoIvyz0jLlZNkY83njNfE0fZNtWdfZTjv lxGgcccAOnfu8zPQ45K2TThdRJ42GkVduvraS5VnBd8+Un3CnE9GWium3NYohYDkXanF ovpbXDlvPyu+4YRivVAM0Sn545ctVq45nFUL3j9jU0vLztiBC7gRZWBCaFMQxkNAtp72 YXqw== 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=sc+9wE6V9Ihv/yoVjMcgbyokg5qzgLFQC6Rj2iMBc2A=; b=atz9fH0vyp9oJIMXJET2b/BWNW184DUnFigjetEfSzXKEfqB/OrVIFW1qfOLemAjxa Z6MNklje8RSPPvwhHdBlBuZvqHEDdbtcEwS8oMX9sY9fZa4ld9uj4ih5LLTxWh4/UuaZ x2oiU0NivM2lQWZE8NtBLiamKAMoSr78VNinLMgc1fpKLfU5Qpi1Gl3rTcQ21TDh7F1j jU7icDV1C1mYiRTrv8yg97pPYjKtBmBnNB4OShjkaHkI3IFygwGZrYBwm+vQinLz79Ds RMR+YgrPDD/QLiqMnUsl4AsClSV4zfPejOIkWcC+iGI0WHeKTNTfvvkvrK07GV2GMQbv kzfw== X-Gm-Message-State: AG10YOQf+y9zYoyvgB886bPiy5NRbDYNXFOwg9EwVKqzN+alWCpM9nbOe9r8B4Ff6/bOiA== X-Received: by 10.98.68.193 with SMTP id m62mr11476522pfi.130.1454465716174; Tue, 02 Feb 2016 18:15:16 -0800 (PST) Received: from gmail.com ([210.118.75.116]) by smtp.gmail.com with ESMTPSA id p8sm5499777pfi.34.2016.02.02.18.15.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2016 18:15:15 -0800 (PST) Date: Wed, 3 Feb 2016 11:15:10 +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 v2 1/2] rtlwifi: Fix improve function 'rtl_addr_delay()' in core.c Message-ID: <20160203021510.GA13725@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 Reviewed-by: Julian Calaby --- V2 split in separate patchs. 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);