From patchwork Wed Feb 3 02:01:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byeoungwook Kim X-Patchwork-Id: 8197031 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 3CB1FBEEE5 for ; Wed, 3 Feb 2016 02:02:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 706A420256 for ; Wed, 3 Feb 2016 02:02:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9868B20253 for ; Wed, 3 Feb 2016 02:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755279AbcBCCBs (ORCPT ); Tue, 2 Feb 2016 21:01:48 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36117 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755157AbcBCCBq (ORCPT ); Tue, 2 Feb 2016 21:01:46 -0500 Received: by mail-pf0-f196.google.com with SMTP id n128so280104pfn.3; Tue, 02 Feb 2016 18:01:46 -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=X3C4Pq3xpgWLgc2VAyJWXVGheuSgkviB4zKPVtM9nBo=; b=b5f3OK8A+a3OIfbctajHVQdG8rKW02zGWT7cPcZ0qV4kcX5pbF5PD4idHtMkXJY1zs uIST1JttD5HibA+66/NfB8g97A+p+adFuBV4cqZ81rhx5kuGTtzN4otgAYTXfZ0g84k5 Qzsak1CyzAOtRFglIOgWX+QUM7XDONXHA1mBT0GPLKuo7X7YpbZtiVt0g1RU/GGyVyKc pZCix+0REBs68q2S6+/XbJgLyIO4bSI6EERCO62ugF4m8AnVcS7UREgpJp9NvCeUHrcv ZtiiqXOxI97FgffTCym0tF/UOPzGUlg44FVY73t9rmmAgcSBYMSK6upkCymvXMWxmIte nM4g== 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=X3C4Pq3xpgWLgc2VAyJWXVGheuSgkviB4zKPVtM9nBo=; b=c6lTsKRdefsgl3PvcF/a4ONKiqwGwZg88/gR8jir2BNy9rpn0EoFL1OzbWktCj+DUf 1VG+Fzi238S5F73gUS9+cOT6WMORbYqQl2U0tsAubvz0C7Krppd/3ZKrU0wCQCRvjp82 PmG4Wx/ggdm6ATzSMAcop2w8EcHlRsJnU5RmnskVP3sRfhFcrihnmeXgt5XvFlFlvb/m 8T2C3GEtj115o3TVO/jaSFd+4EJ07yWzliqG1iKcr7yM3qypZxdqXgDSB5RkXv/cOJEl twM1JxoM745sQomY7Wvt6QoI0/u/Wisn2W8Uf5ZcQUkTyVHLGFc2Pyhz8T8jXdZrQSZL nWzg== X-Gm-Message-State: AG10YOTdlNvjeqfa+8Te/v5WizYnOHUecg8BsqtjNGNib9yS2kK1JA5kS1UCk2DMDm8OyQ== X-Received: by 10.98.10.65 with SMTP id s62mr19925999pfi.119.1454464906039; Tue, 02 Feb 2016 18:01:46 -0800 (PST) Received: from gmail.com ([210.118.75.116]) by smtp.gmail.com with ESMTPSA id ds14sm5474506pac.5.2016.02.02.18.01.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2016 18:01:45 -0800 (PST) Date: Wed, 3 Feb 2016 11:01:39 +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 2/2] rtlwifi: Fix reusable codes in core.c Message-ID: <20160203020139.GA13619@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 rtl_*_delay() functions were reused same codes about addr variable. So i have converted to rtl_addr_delay() from code about addr variable. Signed-off-by: Byeoungwook Kim Reviewed-by: Julian Calaby Reviewed-by: Julian Calaby --- drivers/net/wireless/realtek/rtlwifi/core.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 05f432c..c1193d1 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -63,18 +63,8 @@ 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); @@ -84,18 +74,8 @@ 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);