From patchwork Sat Jun 21 21:00:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 4394651 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 125A3BEEAA for ; Sat, 21 Jun 2014 21:00:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D17620211 for ; Sat, 21 Jun 2014 21:00:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5509F201EF for ; Sat, 21 Jun 2014 21:00:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755399AbaFUVAA (ORCPT ); Sat, 21 Jun 2014 17:00:00 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:34960 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754789AbaFUU7k (ORCPT ); Sat, 21 Jun 2014 16:59:40 -0400 Received: by mail-wi0-f176.google.com with SMTP id n3so2299356wiv.9 for ; Sat, 21 Jun 2014 13:59:39 -0700 (PDT) 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:in-reply-to :references; bh=nuN1IuTJGbTfF33JQUs4b4bdmYFSBrafu/tuQgnWvb8=; b=jkYw+QljcYGE1zbRZ0/jmCa/Dx36LsEhwgdD5MBUxnvey8rWoDJMt2t5cBu7VuVPOT nDUDfdFD6l8eXTplpBZBZm2OJDbcSPcoQyC91jgKpgTD34BBtvs7mRaeQlQjf0MEHV6/ VZiH+R5972XfIOGZ3aOxMcB1hYZqlU4ebs+pyJ9cJ+8kUOOY8YPHSDbJbO7TeWElH6Pg 1J1AVq6kEV/QmoQ19Qrz8sKcnrHIjfu8aAkWf/TdoaIyElVGoHx/tjS1w4T64iaf8Zmb xS2g83Jbsj+mj7vMGGNGDEtP9k86Xivn3jq5yX/ZB6+2RbL8oZGD8I5A6eLrS0q0mvN0 4nKQ== X-Gm-Message-State: ALoCoQmWKMSQs1+aW1rP0+rVUUdNOpAGa0tmnzEiZH4l+adkRMKjfs36AV4oKqOmmiYOid1uqvoF X-Received: by 10.180.90.233 with SMTP id bz9mr13730611wib.42.1403384379367; Sat, 21 Jun 2014 13:59:39 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id u10sm24611660wjz.43.2014.06.21.13.59.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jun 2014 13:59:38 -0700 (PDT) From: Rickard Strandqvist To: Larry Finger , Chaoming Li Cc: Rickard Strandqvist , "John W. Linville" , Ben Hutchings , Peter Wu , Mark Cave-Ayland , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: wireless: rtlwifi: rtl8192cu: hw.c: Cleaning up if statement that always evaluates to false Date: Sat, 21 Jun 2014 23:00:37 +0200 Message-Id: <1403384437-9615-2-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403384437-9615-1-git-send-email-rickard_strandqvist@spectrumdigital.se> References: <1403384437-9615-1-git-send-email-rickard_strandqvist@spectrumdigital.se> 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, 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 I found a logical error in an if statement that always evaluates to false. This has after same discussion resulted in that we add a macro to handle this. Signed-off-by: Rickard Strandqvist Reviewed-by: Peter Wu --- drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | 2 +- drivers/net/wireless/rtlwifi/rtl8192ce/reg.h | 1 + drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index 55adf04..5050938 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c @@ -1206,7 +1206,7 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw, rtl_write_byte(rtlpriv, (MSR), bt_msr); rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) + if ((bt_msr & MSR_MASK) == MSR_AP) rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); else rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h index ed703a1..dc8460c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h @@ -375,6 +375,7 @@ #define MSR_ADHOC 0x01 #define MSR_INFRA 0x02 #define MSR_AP 0x03 +#define MSR_MASK 0x03 #define RRSR_RSC_OFFSET 21 #define RRSR_SHORT_OFFSET 23 diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 07cb06d..87c0a27 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c @@ -1360,7 +1360,7 @@ static int _rtl92cu_set_media_status(struct ieee80211_hw *hw, } rtl_write_byte(rtlpriv, (MSR), bt_msr); rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) + if ((bt_msr & MSR_MASK) == MSR_AP) rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); else rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66);