Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp948516pxb; Wed, 6 Apr 2022 05:06:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcgVz7sjAErl6KT/3usAJW2Wt+rQQ0fL+/jjFkdy0DGBr/nF/OPl3+7FCAcMGAEnhHEtNa X-Received: by 2002:a17:902:b10f:b0:156:612f:318d with SMTP id q15-20020a170902b10f00b00156612f318dmr8213787plr.143.1649246764024; Wed, 06 Apr 2022 05:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649246764; cv=none; d=google.com; s=arc-20160816; b=NOaw0P2kO/t1h8HmX/OTEov3J5dD1qLsT5TkzmNrkqH1MTOey5a94p0kut0OZuPX/9 xGL8cbVP3gkORAJAdAiAaNeTMxlfH3MAsMATISrgxgDWpPTwlrA5I6HycdakO8WtdPuG X8KcCbWNM/byl2SoI/JlRdsREJE4uWVe3RBNdsuNFs/pMJD36SdcYQ0yFsrC9QOr3vd1 DE0RSOWPo/Sj6EJeSifMS9GnMQmGvLug0pJytuQPB+yo7myr2+lobsBZkjHquuPf5URx fIdjLBJBas+xs6QWMG8pj2xrlbN7kQNC1jjRKs2npPOMEKp+freo4JgfrsHz15LBqyvb w8Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ihb0Oo6uzrJ7i7ES6RnGudcZVN/CipVYf3jNZpUHQLI=; b=fQU2KuoxsGbPQPSjcCNEDDS/GOIdVv2ZsRiXHN/7rGrOO+Rg2SBqhKR5gauyqwBp/Y 38h/RM2wgfhyNoSQYMlzHb6PZvZg9hWy2VpZkIJoCd2fGPgT8lPdPGkDSAhXQ5AOJGzo 2HtAx1RbJskRwcS/pxEAZcznrOUhOmtxS0x2gfFCTAK6n26BV6eOU5/+KYt6yj0maNLl 74BfQ8B/KI37TI/gHggg9lR3FOH1TNaQUmqSO0AymJLdaAxjwJHaPUX+5feabHuSh4Eg 4cOoIIuKz4ygwXe8vGBuXTZXHC+fuj5zgq62HkxwhCO9F1MbtynGMdKuyyV0keecKv4m /1+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cOtTwbNQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z17-20020a056a00241100b004fa70a4ef46si17439032pfh.110.2022.04.06.05.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:06:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cOtTwbNQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87DE3684F49; Wed, 6 Apr 2022 03:33:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587861AbiDFAKj (ORCPT + 99 others); Tue, 5 Apr 2022 20:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390735AbiDENnL (ORCPT ); Tue, 5 Apr 2022 09:43:11 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7563653E17 for ; Tue, 5 Apr 2022 05:43:42 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id p8so11971167pfh.8 for ; Tue, 05 Apr 2022 05:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ihb0Oo6uzrJ7i7ES6RnGudcZVN/CipVYf3jNZpUHQLI=; b=cOtTwbNQi5IfZUAxRf50Bs1HOneUA1zU2agmrl/ioAeT0pNG68hoBDlfq3E2n5c/lm v8Vz/drHW7M/EqTvitrTgJprz83zD6CN8Y5ZxNedn4ZiF7oQdLiGXSPhNe0bnbhEEFyI GLeckXj6/jek9wnvFOTbFHCwxWPEJ6PaHEZsyqCqfB9+apiJ3mJMirM9BKGgRFqs6Lav 862usk14tutu/G40euP+x93V7lpLIeWn/TYYAkaL/ScLPPhMjCh3tmbzRbivvSUTrpST /1XDrd79VUwISEPz95aoQNWKFRZxnz4QN3yFvd2ryTAUAWTeiIwv4uQU7yZMHkO0fwxm jZyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ihb0Oo6uzrJ7i7ES6RnGudcZVN/CipVYf3jNZpUHQLI=; b=FPGeQwIje1XTtMhY5FvqLE/nSgEbtiTqs5jE3117tQqa64lnZM4gDaG92OPe6b47eJ 3TvXsud99dePpCqzhzSrPqQRfkSekHFrzy2Za3eI1o661bT1TTGrIKKjlLhdZCLw7h6i +KkE60Z59Fjw/ryy3Qo55qSdQtHjNTtTjjD28Bjr1ucWria7Ty9iwhP1KT87rvpSC6Fq B4QFCfZ9rx8cr5QT3P5+nWHPanbIDAF2vtWKKq5fQOljN6Zh88lubs+NV/RnhmF8zkG3 UXj+q6OQzIC15J7wzLjfEIyIY4ws3MH3E57FojrW9NlIsA2oDlcKrJnU1A2URvEbgbLO mRdQ== X-Gm-Message-State: AOAM531xHAyUHtxSZrdPK7wyrxZMJxkvs7O304Lpzu8LTUMnsA1eQrh0 CrLySWEkdcOD1t/6HJHXuG4sKS1Mfp+h1w== X-Received: by 2002:a63:2d47:0:b0:399:53e3:5b4c with SMTP id t68-20020a632d47000000b0039953e35b4cmr2741835pgt.165.1649162621998; Tue, 05 Apr 2022 05:43:41 -0700 (PDT) Received: from vihas.localhost.com ([103.85.9.59]) by smtp.gmail.com with ESMTPSA id nl17-20020a17090b385100b001c70883f6ccsm2760014pjb.36.2022.04.05.05.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 05:43:41 -0700 (PDT) From: Vihas Makwana To: Larry Finger , Phillip Potter , Greg Kroah-Hartman , Michael Straube , Dan Carpenter , Pavel Skripkin Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Vihas Makwana Subject: [PATCH 2/3] staging: r8188eu: drop redundant if check in check_fwstate Date: Tue, 5 Apr 2022 18:12:39 +0530 Message-Id: <20220405124239.3372-3-makvihas@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220405124239.3372-1-makvihas@gmail.com> References: <20220405124239.3372-1-makvihas@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NO_RDNS_DOTCOM_HELO, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The if check is redundant. Drop it and simplify the funciton. Also, drop clr_fwstate(), clr_fwstate_ex(), up_scanned_network() and down_scanned_network() as they are not used anywhere. Signed-off-by: Vihas Makwana --- drivers/staging/r8188eu/include/rtw_mlme.h | 43 +--------------------- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/drivers/staging/r8188eu/include/rtw_mlme.h b/drivers/staging/r8188eu/include/rtw_mlme.h index 37d217aaf..3b6f70ad8 100644 --- a/drivers/staging/r8188eu/include/rtw_mlme.h +++ b/drivers/staging/r8188eu/include/rtw_mlme.h @@ -453,15 +453,7 @@ static inline u8 *get_bssid(struct mlme_priv *pmlmepriv) static inline bool check_fwstate(struct mlme_priv *pmlmepriv, int state) { - if (pmlmepriv->fw_state & state) - return true; - - return false; -} - -static inline int get_fwstate(struct mlme_priv *pmlmepriv) -{ - return pmlmepriv->fw_state; + return pmlmepriv->fw_state & state; } /* @@ -487,39 +479,6 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state) pmlmepriv->bScanInProcess = false; } -/* - * No Limit on the calling context, - * therefore set it to be the critical section... - */ -static inline void clr_fwstate(struct mlme_priv *pmlmepriv, int state) -{ - spin_lock_bh(&pmlmepriv->lock); - if (check_fwstate(pmlmepriv, state)) - pmlmepriv->fw_state ^= state; - spin_unlock_bh(&pmlmepriv->lock); -} - -static inline void clr_fwstate_ex(struct mlme_priv *pmlmepriv, int state) -{ - spin_lock_bh(&pmlmepriv->lock); - _clr_fwstate_(pmlmepriv, state); - spin_unlock_bh(&pmlmepriv->lock); -} - -static inline void up_scanned_network(struct mlme_priv *pmlmepriv) -{ - spin_lock_bh(&pmlmepriv->lock); - pmlmepriv->num_of_scanned++; - spin_unlock_bh(&pmlmepriv->lock); -} - -static inline void down_scanned_network(struct mlme_priv *pmlmepriv) -{ - spin_lock_bh(&pmlmepriv->lock); - pmlmepriv->num_of_scanned--; - spin_unlock_bh(&pmlmepriv->lock); -} - static inline void set_scanned_network_val(struct mlme_priv *pmlmepriv, int val) { spin_lock_bh(&pmlmepriv->lock); -- 2.30.2