From patchwork Wed Feb 3 02:16:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byeoungwook Kim X-Patchwork-Id: 8197071 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 9941C9F4DD for ; Wed, 3 Feb 2016 02:16:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B659C20221 for ; Wed, 3 Feb 2016 02:16:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDB85201FE for ; Wed, 3 Feb 2016 02:16:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755324AbcBCCQY (ORCPT ); Tue, 2 Feb 2016 21:16:24 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36550 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754270AbcBCCQX (ORCPT ); Tue, 2 Feb 2016 21:16:23 -0500 Received: by mail-pf0-f196.google.com with SMTP id n128so293350pfn.3; Tue, 02 Feb 2016 18:16:22 -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=ff5LKZ8e4bc00YA5eqVtMX2hq29HKgyta6gmss8qVXU=; b=RFdYh1KN6tccJbFD4+2Lk16V2XUPFb3EfIxlR9LOQ1NEq3/svIB1GowKStoJ5GStXn rgB7lEzK74+VCgcvfKdCJv44t4uu90HibjHRTlJRqXAPzGtffllsWtdMovofbYwXkWKU pmqGOg+/3RoMD5Yj+P0GPBVSN11qxKAc52CHPDzuqdEkxCX647x0SbBJWto0h2NGeZv4 uOMRP71Z4KJSwQkYFcF9hYqAjlZzK4Qjh1u+K4cr3Z+n4lNqWGr1aBw7o34q50IgEDP+ 1wDR9zXsM6RYLTSL2VS0uMz9GpSaer8AU+JaGNmdyIARODRm46siDFESXM0tTh0vNjnn JJpw== 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=ff5LKZ8e4bc00YA5eqVtMX2hq29HKgyta6gmss8qVXU=; b=Grb/RxkZaFUPHAqIsPFyXOtzph9wrG1Gg5NQRaCIGCD6aZq+6FpDw3eQTFixob5tEc 50TrmbLXPpse8JO7WKNhWAZe/4FdC8GsKsWciDyrK6JdJnlqYozUdhNMVpYqpdAHWmv7 gEpguRhmbnPbnbOn6rkS2fIcGQH4Bfjebj6kcgv2Hdvo3+a+wMENMBMeB2pcdmZffQhG tke4WyI+D8FYU38zgrtspKZVdWPaZ19i43qIB50dedOX0xBI+uGRugfHzxg8RXR0mzy9 NXpqHmdiUTbhTEtD69hMTa7U/WecBMrhSnZ88vY1oZZzXvfbwMbJ3VqOMC8DZRAykTF5 ceog== X-Gm-Message-State: AG10YORhnfDbqp//ArsUljORPkH0CiThpY/60E8DHVog2oAxEBuDi+AtaYV9fmyKMaUO8A== X-Received: by 10.98.79.156 with SMTP id f28mr52506663pfj.55.1454465782688; Tue, 02 Feb 2016 18:16:22 -0800 (PST) Received: from gmail.com ([210.118.75.116]) by smtp.gmail.com with ESMTPSA id e1sm5549971pas.1.2016.02.02.18.16.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Feb 2016 18:16:22 -0800 (PST) Date: Wed, 3 Feb 2016 11:16:17 +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 2/2] rtlwifi: Fix reusable codes in core.c Message-ID: <20160203021617.GA13759@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 Acked-by: Larry Finger --- V2 split in separate patchs. 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);