Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1859495rwb; Fri, 2 Dec 2022 02:03:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf6XcQEUjzlbQYbZPPjJXpslt8X/c//HW43grRezHrvCS1k5It1QAw0luNLQlEsywY8pZSOb X-Received: by 2002:a17:903:32d0:b0:189:8e05:e2da with SMTP id i16-20020a17090332d000b001898e05e2damr24872372plr.116.1669975398149; Fri, 02 Dec 2022 02:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669975398; cv=none; d=google.com; s=arc-20160816; b=jOEGQzYzuOTSWaB9ls+duBv1i2tv6M9dJG8tJXgHxqkWJlLVr1yiDcRov9EKHlmhFJ bIbSUWJTa6YWfsWoZLdytK3WwNFY1EZfVdBrMfrnDHHLOXkTEq6Zz40IDn/Iw6ovj62Y K9hwfUe00cVn8LOMxPP/7SxKfy6MAA25icN+J9P0N70KtMe/hoIpP62HuNCBNxINB2YO iiQ6uBcAyI2tH27ZmmsPt6NU+ZpottX1lrl5+tdfu52jZ48O/NRsl3XTUhXpuEq8B+t7 Z/G8wij6lTP5LWMtcJQ6ejHmgTUMt/f7jfGpX8Emhbi4/eoyRL0shHt478pIhvml1BCH gy9w== 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; bh=th+yQwNDmUC4eTr0QSQ3EUiovXZojiPvgC6D7y6UTdM=; b=kzIo4m0RfSyuWFqH1eRiv82Sstb46F+6ZYmvOcFqJ/6pUNPxncnzXErfL0Uu4CNByf V2m6IueGbnBNvG/t244zQ51CgA3B8S64AetMvvP0FSuugEl7OqNMQfvdBt7yIYREsc0j 05bhRJp+hQrrMMWnHOT88thky8fxe4jVZ2FkEqHNNlNintAQv5HIPMaO/uLdtaqtNsqX wKPFaAJQjptcHVASpoFq6prFVoL4qBhVrhwLr4jLCpt2/eFw9BmeFOW9SXRqyiDdzYNK rZcgxDdC0CK45Hgp8ZO09WCtBM4nMXMDjCl0DMdpxHCi1OhxZGwLBcY2trjip0fKaWFK ks2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o16-20020a056a0015d000b00537d8aa3bc3si7418614pfu.200.2022.12.02.02.03.06; Fri, 02 Dec 2022 02:03:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232508AbiLBJc0 (ORCPT + 83 others); Fri, 2 Dec 2022 04:32:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232573AbiLBJcT (ORCPT ); Fri, 2 Dec 2022 04:32:19 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47097BDCF2 for ; Fri, 2 Dec 2022 01:32:19 -0800 (PST) Received: from ipservice-092-217-087-074.092.217.pools.vodafone-ip.de ([92.217.87.74] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1p12Oy-0001zC-5v; Fri, 02 Dec 2022 10:32:12 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 1/2] staging: r8188eu: use subtype helpers in collect_bss_info Date: Fri, 2 Dec 2022 10:31:58 +0100 Message-Id: <20221202093159.404111-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202093159.404111-1-martin@kaiser.cx> References: <20221202093159.404111-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 Use the iee80211 helper functions to check the frame subtype in collect_bss_info. Replace the call to the driver-specific GetFrameSubType function. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 26 +++++++++------------ 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 95a9470f4c99..1b9cf7596a76 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -5963,10 +5963,11 @@ void site_survey(struct adapter *padapter) /* collect bss info from Beacon and Probe request/response frames. */ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, struct wlan_bssid_ex *bssid) { + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; int i; u32 len; u8 *p; - u16 val16, subtype; + u16 val16; u8 *pframe = precv_frame->rx_data; u32 packet_len = precv_frame->len; u8 ie_offset; @@ -5982,23 +5983,18 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st memset(bssid, 0, sizeof(struct wlan_bssid_ex)); - subtype = GetFrameSubType(pframe); - - if (subtype == WIFI_BEACON) { + if (ieee80211_is_beacon(mgmt->frame_control)) { bssid->Reserved[0] = 1; ie_offset = _BEACON_IE_OFFSET_; + } else if (ieee80211_is_probe_req(mgmt->frame_control)) { + ie_offset = _PROBEREQ_IE_OFFSET_; + bssid->Reserved[0] = 2; + } else if (ieee80211_is_probe_resp(mgmt->frame_control)) { + ie_offset = _PROBERSP_IE_OFFSET_; + bssid->Reserved[0] = 3; } else { - /* FIXME : more type */ - if (subtype == WIFI_PROBEREQ) { - ie_offset = _PROBEREQ_IE_OFFSET_; - bssid->Reserved[0] = 2; - } else if (subtype == WIFI_PROBERSP) { - ie_offset = _PROBERSP_IE_OFFSET_; - bssid->Reserved[0] = 3; - } else { - bssid->Reserved[0] = 0; - ie_offset = _FIXED_IE_LENGTH_; - } + bssid->Reserved[0] = 0; + ie_offset = _FIXED_IE_LENGTH_; } bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len; -- 2.30.2