From patchwork Thu Sep 8 12:34:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivo van Doorn X-Patchwork-Id: 1129482 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p88CdUIk026435 for ; Thu, 8 Sep 2011 12:39:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932630Ab1IHMj1 (ORCPT ); Thu, 8 Sep 2011 08:39:27 -0400 Received: from mail-ew0-f46.google.com ([209.85.215.46]:38572 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932621Ab1IHMj1 (ORCPT ); Thu, 8 Sep 2011 08:39:27 -0400 Received: by ewy4 with SMTP id 4so268175ewy.19 for ; Thu, 08 Sep 2011 05:39:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:message-id; bh=C7wGgmy5wFF4VzbUvKYqpilHy15JkMZn/2qwKx3GQwE=; b=YonlF3yD7bnTcxJeRL6EzlmU+HsCP8JcU/kQctaD7RTxB4O/YFxfNivw4ZTj+Uzs56 NJbCXV7R1lTRIYFl3ztWeOGIBetp1A5QuOBRQjq0S7Pxfv+M82x7C5ThcdWtUHXCt3UU lqg2/YMEHHlpNzCgP0apVxqWDLuCT2rGqAyRA= Received: by 10.213.20.135 with SMTP id f7mr223134ebb.1.1315485565968; Thu, 08 Sep 2011 05:39:25 -0700 (PDT) Received: from localhost.localdomain (g121037.upc-g.chello.nl [80.57.121.37]) by mx.google.com with ESMTPS id d12sm6401406eeb.8.2011.09.08.05.39.24 (version=SSLv3 cipher=OTHER); Thu, 08 Sep 2011 05:39:25 -0700 (PDT) From: Ivo van Doorn To: "John W. Linville" Subject: [PATCH 1/7] rt2x00: Move bssidx calculation into its own function Date: Thu, 8 Sep 2011 14:34:22 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.x86_64; KDE/4.4.5; x86_64; ; ) Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com MIME-Version: 1.0 Message-Id: <201109081434.23635.IvDoorn@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 08 Sep 2011 12:39:42 +0000 (UTC) From: Helmut Schaa This will be used by a later patch. No functional changes. Signed-off-by: Helmut Schaa Signed-off-by: Ivo van Doorn --- drivers/net/wireless/rt2x00/rt2x00.h | 6 ++++++ drivers/net/wireless/rt2x00/rt2x00dev.c | 16 ++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00mac.c | 10 +--------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index a15eec6..bacb533 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h @@ -1240,6 +1240,12 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ /* + * Utility functions. + */ +u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev, + struct ieee80211_vif *vif); + +/* * Interrupt context handlers. */ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 8374eb3..4db0ebe 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -33,6 +33,22 @@ #include "rt2x00lib.h" /* + * Utility functions. + */ +u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev, + struct ieee80211_vif *vif) +{ + /* + * When in STA mode, bssidx is always 0 otherwise local_address[5] + * contains the bss number, see BSS_ID_MASK comments for details. + */ + if (rt2x00dev->intf_sta_count) + return 0; + return vif->addr[5] & (rt2x00dev->ops->max_ap_intf - 1); +} +EXPORT_SYMBOL_GPL(rt2x00lib_get_bssidx); + +/* * Radio control handlers. */ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index a9123d4..4cf1848 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c @@ -504,15 +504,7 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, memset(&crypto, 0, sizeof(crypto)); - /* - * When in STA mode, bssidx is always 0 otherwise local_address[5] - * contains the bss number, see BSS_ID_MASK comments for details. - */ - if (rt2x00dev->intf_sta_count) - crypto.bssidx = 0; - else - crypto.bssidx = vif->addr[5] & (rt2x00dev->ops->max_ap_intf - 1); - + crypto.bssidx = rt2x00lib_get_bssidx(rt2x00dev, vif); crypto.cipher = rt2x00crypto_key_to_cipher(key); if (crypto.cipher == CIPHER_NONE) return -EOPNOTSUPP;