From patchwork Fri Jan 17 05:27:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 3501961 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 23BDA9F32F for ; Fri, 17 Jan 2014 05:30:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 490332015D for ; Fri, 17 Jan 2014 05:30:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62FBB20158 for ; Fri, 17 Jan 2014 05:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751829AbaAQFaY (ORCPT ); Fri, 17 Jan 2014 00:30:24 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:63787 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751171AbaAQFaW (ORCPT ); Fri, 17 Jan 2014 00:30:22 -0500 Received: by mail-pb0-f48.google.com with SMTP id rr13so3632165pbb.7 for ; Thu, 16 Jan 2014 21:30:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=iPj5w5U5BT0F76xlAOQXNPDNEggjyYZisoJoW/fwkdA=; b=J5snGTgFfO3FXkDXiiPInF1CXrBmypRe5mPlkdu9hp6/243ebHignc63R/vfRX1kAS TL20KhpZ25UKzIL06EzqPsQkz2tmFdKAYsyP3dqOtmpr5hQrtpuOvK1U2Ev/PePKNc6a Ro5hIE5xs3u+MrHh8wuCyUt1Ftp6I2ffvz0ezxDVGjbJOe5MQUjbH+VYd8CbqV2rGNEG 3+W+K7ThjEAZoxkK5uUmJ1joggZ5T8y6N/KkHh5grEtKdiC6fiL0FAg3juK4bfFgb6Bq f7lUhyBo3m5lV0OTsVEsBcVnuY/s9sgAPF6+JUtBFy6E+lEJmXPp1pRw1Q3NlcQtwEBc W8CQ== X-Received: by 10.68.204.4 with SMTP id ku4mr22386pbc.66.1389936621391; Thu, 16 Jan 2014 21:30:21 -0800 (PST) Received: from localhost.localdomain ([175.153.40.33]) by mx.google.com with ESMTPSA id xu8sm26228557pab.0.2014.01.16.21.30.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jan 2014 21:30:20 -0800 (PST) From: ZHAO Gang To: Stefano Brivio Cc: , , "John W. Linville" Subject: [PATCH 2/2] b43: use kernel api to replace b43 specific helper function Date: Fri, 17 Jan 2014 13:27:34 +0800 Message-Id: X-Mailer: git-send-email 1.8.4.2 In-Reply-To: References: In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 Use ieee80211_channel_to_frequency() to replace b43_channel_to_freq_{2,5}ghz(), and remove unused b43_freq_to_channel_{2,5}ghz(). Signed-off-by: ZHAO Gang --- drivers/net/wireless/b43/main.h | 35 ----------------------------------- drivers/net/wireless/b43/xmit.c | 12 ++++++------ 2 files changed, 6 insertions(+), 41 deletions(-) diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h index abac25e..f476fc3 100644 --- a/drivers/net/wireless/b43/main.h +++ b/drivers/net/wireless/b43/main.h @@ -58,41 +58,6 @@ enum b43_verbosity { #endif }; - -/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ -static inline u8 b43_freq_to_channel_5ghz(int freq) -{ - return ((freq - 5000) / 5); -} -static inline u8 b43_freq_to_channel_2ghz(int freq) -{ - u8 channel; - - if (freq == 2484) - channel = 14; - else - channel = (freq - 2407) / 5; - - return channel; -} - -/* Lightweight function to convert a channel number to a frequency (in Mhz). */ -static inline int b43_channel_to_freq_5ghz(u8 channel) -{ - return (5000 + (5 * channel)); -} -static inline int b43_channel_to_freq_2ghz(u8 channel) -{ - int freq; - - if (channel == 14) - freq = 2484; - else - freq = 2407 + (5 * channel); - - return freq; -} - static inline int b43_is_cck_rate(int rate) { return (rate == B43_CCK_RATE_1MB || diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 50e5ddb..218a0f3 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c @@ -806,7 +806,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) B43_WARN_ON(1); /* FIXME: We don't really know which value the "chanid" contains. * So the following assignment might be wrong. */ - status.freq = b43_channel_to_freq_5ghz(chanid); + status.freq = + ieee80211_channel_to_frequency(chanid, status.band); break; case B43_PHYTYPE_G: status.band = IEEE80211_BAND_2GHZ; @@ -819,13 +820,12 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) case B43_PHYTYPE_HT: /* chanid is the SHM channel cookie. Which is the plain * channel number in b43. */ - if (chanstat & B43_RX_CHAN_5GHZ) { + if (chanstat & B43_RX_CHAN_5GHZ) status.band = IEEE80211_BAND_5GHZ; - status.freq = b43_channel_to_freq_5ghz(chanid); - } else { + else status.band = IEEE80211_BAND_2GHZ; - status.freq = b43_channel_to_freq_2ghz(chanid); - } + status.freq = + ieee80211_channel_to_frequency(chanid, status.band); break; default: B43_WARN_ON(1);