From patchwork Wed Feb 3 05:21:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byeoungwook Kim X-Patchwork-Id: 8197881 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 E660D9F37A for ; Wed, 3 Feb 2016 05:22:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15EE420253 for ; Wed, 3 Feb 2016 05:22:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39D1020218 for ; Wed, 3 Feb 2016 05:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbcBCFVz (ORCPT ); Wed, 3 Feb 2016 00:21:55 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34182 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbcBCFVy (ORCPT ); Wed, 3 Feb 2016 00:21:54 -0500 Received: by mail-pf0-f194.google.com with SMTP id 65so484277pfd.1; Tue, 02 Feb 2016 21:21:53 -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=Ng49/is5Z6HpI9T7EVqEpITwVnNZClP2KZKZyUTniJo=; b=SPN2owjMkKDY4uxrpt3UEK2eG1s1XYi5985GPtneYo+iLzOuU5eNRler2S9clte2lg bp0cQEGAcNmb7nM3J00RBNxBVX41MJUKUpny3ckB+KKqV+4Glh86050C9iD9S+R6R9Hy 1Ne4teDrOyR8sf/vvQt2v183grtYbH1H4EkPU5X2JGrTdWY3UA+dRDVJZjhNOIiKxLBh e8/e4sExLbym8sMwHw2gJtEnzbX4Fh3HbHTFIWsej19DKJ9sWkWDx4ICB3PjB/ZT0+0s SC3rcVorHXBTEbIXXyftc19AKNh4J7sjFLJoghN1vLek3SBu2weQ/B+sQ6SGvtXkNQZa 6XQw== 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=Ng49/is5Z6HpI9T7EVqEpITwVnNZClP2KZKZyUTniJo=; b=MOcXmuq6h0LgQroVmXWDyQvCvFpD5CdaIoBlp5hFtW9yhwuZZVCQ6golQIVdEsxalO e8dqfMnpyYPeaAEZddfWy38XqwDWtl+U2NokmgkW6hyrIs8sZDnpTavxwkPEyIF4nGq3 pylt7VFpG51C+5Z46j8KsIzRJJDpcdavvenNmYZp9b9NsVSllnL+WLcxButf5L1iJqMt JICfizOPLCzRdkT8nFhG2hTvT7wkEdOi/ATDyRGksKYaJhc+PwIWExuCPbkb9EiagP6L rY9kUiCLJNU6HN8xX8Ai4cpzZbJN3Hc5b6q5skwcMCHS+bkIn/uJVhbR3cDIRqLPMWtM 3WCA== X-Gm-Message-State: AG10YOS+RhwHpB4fqmoIrqmC9hmGawLrOUrgqqc7O1eAbHraiHEJjz8vQvoAtF8U8NLaAw== X-Received: by 10.98.14.68 with SMTP id w65mr54110717pfi.146.1454476913435; Tue, 02 Feb 2016 21:21:53 -0800 (PST) Received: from gmail.com ([210.118.75.116]) by smtp.gmail.com with ESMTPSA id 195sm3481527pfa.5.2016.02.02.21.21.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2016 21:21:52 -0800 (PST) Date: Wed, 3 Feb 2016 14:21:46 +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, lkp@intel.com, julian.calaby@gmail.com Subject: [PATCH v3] rtlwifi: Fix improve function 'rtl_addr_delay()' in core.c Message-ID: <20160203052146.GA15711@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.3 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. Reviewed-by: Julian Calaby Signed-off-by: Byeoungwook Kim Signed-off-by: Fengguang Wu --- V3 remove unneeded semicolon. 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..63cda78 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);