From patchwork Tue Mar 24 12:38:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 6078401 Return-Path: X-Original-To: patchwork-ath10k@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 668749F2A9 for ; Tue, 24 Mar 2015 12:41:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81A152024F for ; Tue, 24 Mar 2015 12:41:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99F942024D for ; Tue, 24 Mar 2015 12:41:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YaO93-0000cR-NT; Tue, 24 Mar 2015 12:41:21 +0000 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YaO91-0000aF-4f for ath10k@lists.infradead.org; Tue, 24 Mar 2015 12:41:20 +0000 Received: by laae1 with SMTP id e1so26155669laa.2 for ; Tue, 24 Mar 2015 05:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=8WhQ1+b1WMVrkp3+Ws1pbjxFvdKZiYCEDRUVeTZYd84=; b=NvodrHZnd5OIQqLGIe5Chj5/s0EkYg0uDfNtBpTLDM6LvzqlD0noNQwvHjXpKMvciK P240DIExpEWc8tQWQDau323LET2uwiueh0BQXDCck0ystc8vVldzJb0afaFcbr8f4e7+ tUk0qwBzQnCQqLyq2OTPnsdes/j3AFaTbz/Is= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8WhQ1+b1WMVrkp3+Ws1pbjxFvdKZiYCEDRUVeTZYd84=; b=jucrY6hdi2HUN8BU/EDzbMGEUtxWCYW0w7x26BRoZiSwf2p3a/VS23mFHmougoNiKi +SAIm0+/60VT1GHcxKppLZ/wgwUwJg12lDbY3pocDJKY+d6U3mikxnf/1Y6gtduHtyaR Miap+CnEdqImajW7snYvL8rbG9tkh5HIhhMeg5J3dX6jvR2gvdazFU+/g1EOBKMSTIWk MAnpUOMn4PnM3Wv7iXJKa69PsitaN/X4lXYzM2HmONH4HBhwi6Y/DYEDewhfh6EQU3vj 8PY7wVD74qnhPBgBiL0H4zkDybqESQn0OmHlya7O2+qOXWLAIjBUKdQhJKclSyi3ob7q Ehpw== X-Gm-Message-State: ALoCoQnTSR/WpbHUzHw18LG31ETGtZvq8r1AMhkI/AHM2X0v9pHYeFegpXzLYd/8csaEsUqW0GrzbQZn+Mfn4xPamABiLT9tQlAM+yMwQB8Y4RR4QpIz+EpUCyEKbX//Pie50jQFh8SNI1+N//jxLWo9PkdF9ZEIhL3FG57wofy84NcT8sGB66E= X-Received: by 10.152.206.70 with SMTP id lm6mr3647329lac.35.1427200850457; Tue, 24 Mar 2015 05:40:50 -0700 (PDT) Received: from bob.homerouter.cpe (apn-77-113-71-242.dynamic.gprs.plus.pl. [77.113.71.242]) by mx.google.com with ESMTPSA id le10sm905702lac.7.2015.03.24.05.40.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Mar 2015 05:40:49 -0700 (PDT) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH] ath10k: fix survey reporting Date: Tue, 24 Mar 2015 12:38:11 +0000 Message-Id: <1427200691-7109-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150324_054119_365817_DFA5901B X-CRM114-Status: GOOD ( 10.08 ) X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Number of channels is stored in a separate macro in a header file and channel list is constructed independently. The macro is used to define survey array. This fixes a recent regression introduced after adding support for 144 channel. The regression would lead to a warning and incomplete survey data on channel 165: chan info: invalid frequency 5825 (idx 38 out of bounds) Also make sure to enforce the sizes and avoid this kind of problem in the future. Fixes: 4a7898fed5f3 ("ath10k: enable channel 144 on 5GHz band") Signed-off-by: Michal Kazior --- Notes: (based on pending branch) drivers/net/wireless/ath/ath10k/core.h | 2 +- drivers/net/wireless/ath/ath10k/mac.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index d50408822f39..7fa171fa55e3 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -45,7 +45,7 @@ #define WMI_READY_TIMEOUT (5 * HZ) #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ) #define ATH10K_CONNECTION_LOSS_HZ (3*HZ) -#define ATH10K_NUM_CHANS 38 +#define ATH10K_NUM_CHANS 39 /* Antenna noise floor */ #define ATH10K_DEFAULT_NOISE_FLOOR -95 diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 5f9705deb430..75cc304d32d4 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -6014,6 +6014,10 @@ int ath10k_mac_register(struct ath10k *ar) ht_cap = ath10k_get_ht_cap(ar); vht_cap = ath10k_create_vht_cap(ar); + BUILD_BUG_ON((ARRAY_SIZE(ath10k_2ghz_channels) + + ARRAY_SIZE(ath10k_5ghz_channels)) != + ATH10K_NUM_CHANS); + if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { channels = kmemdup(ath10k_2ghz_channels, sizeof(ath10k_2ghz_channels),