From patchwork Thu Aug 13 18:21:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 7010051 X-Patchwork-Delegate: kvalo@adurom.com 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 072C79F434 for ; Thu, 13 Aug 2015 18:22:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1298520637 for ; Thu, 13 Aug 2015 18:22:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 016BF20632 for ; Thu, 13 Aug 2015 18:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753260AbbHMSWA (ORCPT ); Thu, 13 Aug 2015 14:22:00 -0400 Received: from mout.gmx.net ([212.227.15.18]:59382 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753125AbbHMSV7 (ORCPT ); Thu, 13 Aug 2015 14:21:59 -0400 Received: from ultralex.Speedport_W_921V_1_37_000 ([91.10.245.80]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MAyVY-1ZXceN0nQK-009wzh; Thu, 13 Aug 2015 20:21:55 +0200 From: Oleksij Rempel To: ath9k-devel@venema.h4ckr.net, dan.carpenter@oracle.com, Sujith.Manoharan@atheros.com, kvalo@codeaurora.org, linux-wireless@vger.kernel.org Cc: Oleksij Rempel Subject: [PATCH] ath9k_htc: do ani shortcalibratio if we got -ETIMEDOUT Date: Thu, 13 Aug 2015 20:21:38 +0200 Message-Id: <1439490098-12479-1-git-send-email-linux@rempel-privat.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20150811214324.GA30816@mwanda> References: <20150811214324.GA30816@mwanda> X-Provags-ID: V03:K0:f8AFhUQkxojfBsha/qnYEJGZ8Wt/US8i3HtqQPWB1MD+hZW+p2p urbrzZ4N7RsIz3T2jhj5CFbjWF9P6xDJDCv3ifb0A8Q4AFnIAWD5onMJwl0zV0E2tkYAdvo 9H8EEiMBS1I6/+Yz5VGEwuVfP+qPBMsRcOS+Hb7J1bSJ/P4+UZ3xllkzcK2vac19pCUXyun sADOd3bdlnC6TBeIiPlNA== X-UI-Out-Filterresults: notjunk:1; V01:K0:qkcfRdU1OLY=:fMeeVyAmZ5glka6RIJ1bAu /g5LrLjaqt54CJ5cAHE6hc0emwgs5Ne33ccAO8PwcAom5mtdUjSHV+t2VPUiBos2MG3hOPlLa SqVX+jSGORFGf9rL31ITEhg7hxiw1Wk/aJ8MOXy8RjmoFMgx17s5JAgZGqiTQ7zgMFptMn/4g 827ivjFTnPcQNCQk4zffpmoE204qt7gvg4Ork1oQsbEiNoRd6fNslZOcrrJJ+Fe7tjF1Bne5Z FLu4pG9gbpQUU8kgTvLo/43Lxhhhvr6TWpNWaE0K1//ESP1NzNDrSSOULaR5wuTvw6KUm5LmP y+/yeAQvKRRs1kDn7K4HF5Ani11VJHAv88jo6FCdYdNQ4wkRttkR4gtk+BWc6eIg2oJcFg5Ee VYieJfRc0uhDTPpILmBCNXRDAT5GZS3UYwJok8iSbAWLSBazkJdEZ/uiA0kpSqal6DrIBsMzZ GLWJICovsovl2LP6q3L54hb1719B/xyvdiVQDUh77dh7D009y0ECRw605ZLSd9VfiLrn23aUV TZiSqVsJQG8FrkVu/vmjdFiTuiYts2JCghisgD4ceUp1UNNQSO5p+y52SVCOhVNX8qWY+8Iuq hMJAAs4VYHe5fVBnekm20w6O0ho2BhcYKHsy2+KmeQPFKXq7++aqNC7ssJ0Wil8AtCEv7yR6B cG4+PrnBRrBKmJ6Gm5H0blaiylfwUxHTmR055cG3/CkrvWdldI6cwWX0f+hAVa4CDNALN78Vc 1/VivVhgBYkiO+Lv Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 From: Oleksij Rempel current code will handle -ETIMEDOUT as success which is probalbly wrong. According to this comment I assume it is safe to handle -ETIMEDOUT as false: drivers/net/wireless/ath/ath9k/calib.c 290 /* 291 * We timed out waiting for the noisefloor to load, probably due to an 292 * in-progress rx. Simply return here and allow the load plenty of time 293 * to complete before the next calibration interval. We need to avoid 294 * trying to load -50 (which happens below) while the previous load is 295 * still in progress as this can cause rx deafness. Instead by returning 296 * here, the baseband nf cal will just be capped by our present 297 * noisefloor until the next calibration timer. 298 */ Since no other error wariants are present, this patch is checking only for (ret <= 0). Reported-by: Dan Carpenter Signed-off-by: Oleksij Rempel --- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index dab1323..172a9ff 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c @@ -794,8 +794,11 @@ void ath9k_htc_ani_work(struct work_struct *work) common->ani.longcal_timer = timestamp; } - /* Short calibration applies only while caldone is false */ - if (!common->ani.caldone) { + /* + * Short calibration applies only while caldone + * is false or -ETIMEDOUT + */ + if (common->ani.caldone <= 0) { if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) { shortcal = true; @@ -844,7 +847,11 @@ set_timer: */ cal_interval = ATH_LONG_CALINTERVAL; cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL); - if (!common->ani.caldone) + /* + * Short calibration applies only while caldone + * is false or -ETIMEDOUT + */ + if (common->ani.caldone <= 0) cal_interval = min(cal_interval, (u32)short_cal_interval); ieee80211_queue_delayed_work(common->hw, &priv->ani_work,