From patchwork Sun Nov 6 12:56:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 9413925 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 746BD60585 for ; Sun, 6 Nov 2016 13:30:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 542DB29021 for ; Sun, 6 Nov 2016 13:30:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 369B329026; Sun, 6 Nov 2016 13:30:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B89B629021 for ; Sun, 6 Nov 2016 13:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751694AbcKFNaT (ORCPT ); Sun, 6 Nov 2016 08:30:19 -0500 Received: from www.osadl.org ([62.245.132.105]:34558 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751764AbcKFNaS (ORCPT ); Sun, 6 Nov 2016 08:30:18 -0500 X-Greylist: delayed 2062 seconds by postgrey-1.27 at vger.kernel.org; Sun, 06 Nov 2016 08:30:17 EST Received: from debian01.hofrr.at (92-243-34-74.adsl.nanet.at [92.243.34.74] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id uA6CtOWR019580; Sun, 6 Nov 2016 13:55:24 +0100 From: Nicholas Mc Guire To: Larry Finger Cc: Chaoming Li , Kalle Valo , Joe Perches , Arnd Bergmann , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH RFC] rtlwifi: btcoexist: fix port assignment Date: Sun, 6 Nov 2016 13:56:59 +0100 Message-Id: <1478437019-24689-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The port assignment in the if case should be to AUX not MAIN. Fixes: commit baa170229095 ("rtlwifi: btcoexist: Implement antenna selection") Signed-off-by: Nicholas Mc Guire --- problem located by coccinelle in: drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c:exhalbtc_set_ant_num() 973 /* The antenna position: 974 * Main (default) or Aux for pgAntNum=2 && btdmAntNum =1. 975 * The antenna position should be determined by 976 * auto-detect mechanism. 977 * The following is assumed to main, 978 * and those must be modified 979 * if y auto-detect mechanism is ready 980 */ 981 if ((gl_bt_coexist.board_info.pg_ant_num == 2) && 982 (gl_bt_coexist.board_info.btdm_ant_num == 1)) 983 gl_bt_coexist.board_info.btdm_ant_pos = 984 BTC_ANTENNA_AT_MAIN_PORT; 985 else 986 gl_bt_coexist.board_info.btdm_ant_pos = 987 BTC_ANTENNA_AT_MAIN_PORT; (line number from 4.9.0-rc2 linux-next 20161028) the if and else branch here are the same but the comment seems to indicate that the first case should be the AUX port and not the MAIN port here (the second sentence in the comment though is not really clear to me). If the intent is to set it to MAIN unconditionally and then let autodetect fix it then the if/else construct is useless. Looks like a cut&past bug, but this needs a check by someone who knows the details of the device. Patch was compile tested with: x86_64_defconfig + RTL8723AE=m (implies CONFIG_RTLBTCOEXIST) Patch is against 4.9.0-rc2 (localversion-next is next-20161028) drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c index 91cc139..588c8ed 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c @@ -981,7 +981,7 @@ void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num) if ((gl_bt_coexist.board_info.pg_ant_num == 2) && (gl_bt_coexist.board_info.btdm_ant_num == 1)) gl_bt_coexist.board_info.btdm_ant_pos = - BTC_ANTENNA_AT_MAIN_PORT; + BTC_ANTENNA_AT_AUX_PORT; else gl_bt_coexist.board_info.btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT;