From patchwork Mon Aug 3 03:11:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 247333 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp861326ilo; Sun, 2 Aug 2020 20:12:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg4zmQ2EzxPxDmP/2yFmFzYkoMsSn7E92eUHY87FJzao7E9Vxt/5ifg0kWUZEf0PL+4wMp X-Received: by 2002:a50:a187:: with SMTP id 7mr14067544edk.71.1596424257679; Sun, 02 Aug 2020 20:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596424257; cv=none; d=google.com; s=arc-20160816; b=gPWQm+TcFHSaAvYD2jZh3/f7vKBo+GrBq0h+9WijU7EvUYBwQNB/CAGK9g6fxOROOI 0Sg+T27zqPIIYkxarpC4Ec69QT06OMGsbDdf/GmK5wGwq+fGQ6+lgolRhteMXIPGKqLZ t7RvPDEKtRP8QUA/39xNjeYI2LoHsH4QKlizFldnkGFEEg5mCahvBQyg3sfVEA5nNVKS yFQY+Cyg78uYKJm8HGvjflWnmVyWW+UQbTs5Fub/Nc6V1RoddyCfsWl2W+pYPPPnCMpi yrBc+WSp5jBotKjHs2SoKbnfp/NI3vJnei4EtZVU561ZmPaWRfpAEx+q77e2eXixS6Kg 3ANQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sikUkIrUUUYDQIfnByPU/LmcIZ12zwkI3UVYfyuDjzw=; b=lwId09B8++vy+qrVHAw+ZewijVgn0R9HPfULV/8Lp40npWloaS7Ap1MXVuYzxvPcL5 BrzDKzSutP8JwHHKT9aFNAbGU081PrqnhKSWCTe2EVIWzzX+nLuKUA89OAwojvo736dx PMDMMwqvmrbPTrU5V/3q6RnLkcfXS5zfXLVr11DT7sCxrkRlPlgQWjjVYVPN7aW8MO2h QCVu9sdvcBeZ9NUyCpIao2rVbrhDChpb/JrhuIJfsYBziBi+JkO9ZmzljWT6HF+sSJLE SKhTsiVVxw3pDYgvVBM8Z888DuaA7oRZEhs0rGCV+vL4yc79VflI6lSRVpOKrGe65djC yLnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gBWc2vip; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz19si10235393ejb.34.2020.08.02.20.10.57; Sun, 02 Aug 2020 20:10:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gBWc2vip; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726993AbgHCDK4 (ORCPT + 2 others); Sun, 2 Aug 2020 23:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbgHCDKz (ORCPT ); Sun, 2 Aug 2020 23:10:55 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54AEBC06174A for ; Sun, 2 Aug 2020 20:10:55 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id q76so12875486wme.4 for ; Sun, 02 Aug 2020 20:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sikUkIrUUUYDQIfnByPU/LmcIZ12zwkI3UVYfyuDjzw=; b=gBWc2vipv4uQatf9GMbAMQLNdYm/SL7Ww1x5Lk66em5Dg2oV6JKFhYKm4fU5SEHXi/ 5HVlmy5e32zZzLFnzPs5OjOZuIFc7TXRzRl2C63y5oV6Aouq6cheTPSvR0W0jgMzYXwA lzLu7oTrhqkW6h0jJhVVTTcirabTnKmFvPfSTkMn2eFt1NRD3Ht4kqjkLNj1Vrwl92XM F5Gr12zzg+TY5GrsOBBIgjS4A02HaGwCG4ZSukUHSKGo9/IH0Bo/6nLxEcofuf8IaDbm gUwPnPhEQlqoLYDmHTOGoGAgeuFBYTEryjURp8viFo3D6RO2Gx295Sx1eAajXDoTuA8w daXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sikUkIrUUUYDQIfnByPU/LmcIZ12zwkI3UVYfyuDjzw=; b=UN/jxggtxc4b/kFmYuzFvxaKNhLaatky+ln9wCYQnGVJTBT9Jkzc3gbArwSZBkQ/zO pYzjwtxkZ0eqa86Y+Ka+WjurwfnMryK+VkvLdRP4+jYybuUMuzO9eXsn9gbinA4lClPG Ehu9IZgqpA6WiduU+b4tkupMOW0QdGBLtiy/e11ua4BAaRxbefsMNRXyoiE9SmVzCzu9 Tb9dhJebQ07KpQ36iG20JQMxLfLUI2uwnMvIOWsaEHrLY61UKkIBYPklQezVJs1LpulW Yum6lWqL+J45vfww8EMC2mXRFQ0zEFPrBQC1KURjIm/N2N8J7F4Mh1siaSMBxnSvhr3O Gevw== X-Gm-Message-State: AOAM530VX6AbsZWDFy9ppeYbqVKA/fHGjRNfQBraE8MItGpAKEUcVmor Dj7sYF+4s+t5y31OMhTZopdx8h8xP7Q= X-Received: by 2002:a1c:2485:: with SMTP id k127mr13333234wmk.138.1596424254074; Sun, 02 Aug 2020 20:10:54 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id q2sm21956857wro.8.2020.08.02.20.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2020 20:10:53 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org Cc: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, bryan.odonoghue@linaro.org, shawn.guo@linaro.org Subject: [PATCH 07/36] wcn36xx: Use existing pointers in wcn36xx_smd_config_bss_v1 Date: Mon, 3 Aug 2020 04:11:03 +0100 Message-Id: <20200803031132.1427063-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200803031132.1427063-1-bryan.odonoghue@linaro.org> References: <20200803031132.1427063-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Two pointers are already defined in this function "bss" and "sta" which point to fields within msg_body->bss_params. We can substantially reduce the amount of extraneous text in this function by making use of those pointers. This change makes the code easier to read and modify. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/smd.c | 110 +++++++++++-------------- 1 file changed, 47 insertions(+), 63 deletions(-) -- 2.27.0 diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 218f70283809..05835cf6e409 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -1298,87 +1298,71 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, sta = &bss->sta; /* convert orig to v1 */ - memcpy(&msg_body->bss_params.bssid, - &orig->bss_params.bssid, ETH_ALEN); - memcpy(&msg_body->bss_params.self_mac_addr, - &orig->bss_params.self_mac_addr, ETH_ALEN); + memcpy(bss->bssid, &orig->bss_params.bssid, ETH_ALEN); + memcpy(bss->self_mac_addr, &orig->bss_params.self_mac_addr, ETH_ALEN); - msg_body->bss_params.bss_type = orig->bss_params.bss_type; - msg_body->bss_params.oper_mode = orig->bss_params.oper_mode; - msg_body->bss_params.nw_type = orig->bss_params.nw_type; + bss->bss_type = orig->bss_params.bss_type; + bss->oper_mode = orig->bss_params.oper_mode; + bss->nw_type = orig->bss_params.nw_type; - msg_body->bss_params.short_slot_time_supported = + bss->short_slot_time_supported = orig->bss_params.short_slot_time_supported; - msg_body->bss_params.lla_coexist = orig->bss_params.lla_coexist; - msg_body->bss_params.llb_coexist = orig->bss_params.llb_coexist; - msg_body->bss_params.llg_coexist = orig->bss_params.llg_coexist; - msg_body->bss_params.ht20_coexist = orig->bss_params.ht20_coexist; - msg_body->bss_params.lln_non_gf_coexist = - orig->bss_params.lln_non_gf_coexist; - - msg_body->bss_params.lsig_tx_op_protection_full_support = + bss->lla_coexist = orig->bss_params.lla_coexist; + bss->llb_coexist = orig->bss_params.llb_coexist; + bss->llg_coexist = orig->bss_params.llg_coexist; + bss->ht20_coexist = orig->bss_params.ht20_coexist; + bss->lln_non_gf_coexist = orig->bss_params.lln_non_gf_coexist; + + bss->lsig_tx_op_protection_full_support = orig->bss_params.lsig_tx_op_protection_full_support; - msg_body->bss_params.rifs_mode = orig->bss_params.rifs_mode; - msg_body->bss_params.beacon_interval = orig->bss_params.beacon_interval; - msg_body->bss_params.dtim_period = orig->bss_params.dtim_period; - msg_body->bss_params.tx_channel_width_set = - orig->bss_params.tx_channel_width_set; - msg_body->bss_params.oper_channel = orig->bss_params.oper_channel; - msg_body->bss_params.ext_channel = orig->bss_params.ext_channel; - - msg_body->bss_params.reserved = orig->bss_params.reserved; - - memcpy(&msg_body->bss_params.ssid, - &orig->bss_params.ssid, + bss->rifs_mode = orig->bss_params.rifs_mode; + bss->beacon_interval = orig->bss_params.beacon_interval; + bss->dtim_period = orig->bss_params.dtim_period; + bss->tx_channel_width_set = orig->bss_params.tx_channel_width_set; + bss->oper_channel = orig->bss_params.oper_channel; + bss->ext_channel = orig->bss_params.ext_channel; + + bss->reserved = orig->bss_params.reserved; + + memcpy(&bss->ssid, &orig->bss_params.ssid, sizeof(orig->bss_params.ssid)); - msg_body->bss_params.action = orig->bss_params.action; - msg_body->bss_params.rateset = orig->bss_params.rateset; - msg_body->bss_params.ht = orig->bss_params.ht; - msg_body->bss_params.obss_prot_enabled = - orig->bss_params.obss_prot_enabled; - msg_body->bss_params.rmf = orig->bss_params.rmf; - msg_body->bss_params.ht_oper_mode = orig->bss_params.ht_oper_mode; - msg_body->bss_params.dual_cts_protection = - orig->bss_params.dual_cts_protection; - - msg_body->bss_params.max_probe_resp_retry_limit = + bss->action = orig->bss_params.action; + bss->rateset = orig->bss_params.rateset; + bss->ht = orig->bss_params.ht; + bss->obss_prot_enabled = orig->bss_params.obss_prot_enabled; + bss->rmf = orig->bss_params.rmf; + bss->ht_oper_mode = orig->bss_params.ht_oper_mode; + bss->dual_cts_protection = orig->bss_params.dual_cts_protection; + + bss->max_probe_resp_retry_limit = orig->bss_params.max_probe_resp_retry_limit; - msg_body->bss_params.hidden_ssid = orig->bss_params.hidden_ssid; - msg_body->bss_params.proxy_probe_resp = - orig->bss_params.proxy_probe_resp; - msg_body->bss_params.edca_params_valid = - orig->bss_params.edca_params_valid; - - memcpy(&msg_body->bss_params.acbe, - &orig->bss_params.acbe, + bss->hidden_ssid = orig->bss_params.hidden_ssid; + bss->proxy_probe_resp = orig->bss_params.proxy_probe_resp; + bss->edca_params_valid = orig->bss_params.edca_params_valid; + + memcpy(&bss->acbe, &orig->bss_params.acbe, sizeof(orig->bss_params.acbe)); - memcpy(&msg_body->bss_params.acbk, - &orig->bss_params.acbk, + memcpy(&bss->acbk, &orig->bss_params.acbk, sizeof(orig->bss_params.acbk)); - memcpy(&msg_body->bss_params.acvi, - &orig->bss_params.acvi, + memcpy(&bss->acvi, &orig->bss_params.acvi, sizeof(orig->bss_params.acvi)); - memcpy(&msg_body->bss_params.acvo, - &orig->bss_params.acvo, + memcpy(&bss->acvo, &orig->bss_params.acvo, sizeof(orig->bss_params.acvo)); - msg_body->bss_params.ext_set_sta_key_param_valid = + bss->ext_set_sta_key_param_valid = orig->bss_params.ext_set_sta_key_param_valid; - memcpy(&msg_body->bss_params.ext_set_sta_key_param, + memcpy(&bss->ext_set_sta_key_param, &orig->bss_params.ext_set_sta_key_param, sizeof(orig->bss_params.acvo)); - msg_body->bss_params.wcn36xx_hal_persona = - orig->bss_params.wcn36xx_hal_persona; - msg_body->bss_params.spectrum_mgt_enable = - orig->bss_params.spectrum_mgt_enable; - msg_body->bss_params.tx_mgmt_power = orig->bss_params.tx_mgmt_power; - msg_body->bss_params.max_tx_power = orig->bss_params.max_tx_power; + bss->wcn36xx_hal_persona = orig->bss_params.wcn36xx_hal_persona; + bss->spectrum_mgt_enable = orig->bss_params.spectrum_mgt_enable; + bss->tx_mgmt_power = orig->bss_params.tx_mgmt_power; + bss->max_tx_power = orig->bss_params.max_tx_power; - wcn36xx_smd_convert_sta_to_v1(wcn, &orig->bss_params.sta, - &msg_body->bss_params.sta); + wcn36xx_smd_convert_sta_to_v1(wcn, &orig->bss_params.sta, sta); PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body));