From patchwork Fri Jan 17 16:17:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 3506151 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 1ABE79F2E9 for ; Fri, 17 Jan 2014 16:18:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E79132011B for ; Fri, 17 Jan 2014 16:18:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79D8220165 for ; Fri, 17 Jan 2014 16:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752100AbaAQQSV (ORCPT ); Fri, 17 Jan 2014 11:18:21 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:64293 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752017AbaAQQSV (ORCPT ); Fri, 17 Jan 2014 11:18:21 -0500 Received: by mail-pd0-f170.google.com with SMTP id z10so4175772pdj.15 for ; Fri, 17 Jan 2014 08:18:20 -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=vwNml8Nw2iExvVtVq5zzH4mWZHAoZseTK5mRP3L7XJc=; b=zjU3yKLdu7Tec1/6EonASPNNB6DO2y1r96FK+jITb6gsB2MtTLDN1LYh/vXGc8dvoi gDTOF/cxAZAIX5k/y+33kDlrExKeUqPi2Y0iXqzC+BInyFNnlFao3aJAshUMjogn+6Z+ CkHY2Is1bAPJHoyJPc0LZdzVlmwEyILB86IBE9sZPtfoHZMfTgzNUdviwHNf6xo+eDQz +mr6Deo0+HEAF5dSVldlY4crQ1io4dmJo0TvGM9ULYMZs3orcW2ym/pVTIzAV8FcFxO1 n+r3OpJQeVGMVXSq+X9YV2W+N4/ha+9XXLBT4ihvCLRiHBHdQ+ZZ0696el47wkk5Z0zK pBfQ== X-Received: by 10.68.247.6 with SMTP id ya6mr2972043pbc.45.1389975500752; Fri, 17 Jan 2014 08:18:20 -0800 (PST) Received: from localhost.localdomain ([175.153.40.41]) by mx.google.com with ESMTPSA id qw8sm23907919pbb.27.2014.01.17.08.18.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jan 2014 08:18:20 -0800 (PST) From: ZHAO Gang To: Stefano Brivio Cc: Johannes Berg , Jonas Gorski , Luca Coelho , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , "John W. Linville" , , Subject: [PATCH v4 2/2] b43: use kernel api to replace b43 specific helper function Date: Sat, 18 Jan 2014 00:17:39 +0800 Message-Id: <1d5702e0bc7bddf7d1fbd5d068d8eaa2025bf32c.1389975095.git.gamerh2o@gmail.com> 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 --- v4: bump version to consistent with first patch. 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);