Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C610CC43382 for ; Tue, 25 Sep 2018 06:25:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8810421480 for ; Tue, 25 Sep 2018 06:25:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8810421480 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbeIYMbH (ORCPT ); Tue, 25 Sep 2018 08:31:07 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:12212 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728214AbeIYMbH (ORCPT ); Tue, 25 Sep 2018 08:31:07 -0400 X-IronPort-AV: E=Sophos;i="5.54,301,1534834800"; d="scan'208";a="20543233" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Sep 2018 23:25:08 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch03.mchp-main.com (10.10.76.49) with Microsoft SMTP Server id 14.3.352.0; Mon, 24 Sep 2018 23:25:01 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH v3 20/29] staging: wilc1000: remove use of unnecessary 'wilc_connected_ssid' variable Date: Tue, 25 Sep 2018 11:53:35 +0530 Message-ID: <1537856624-22157-21-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537856624-22157-1-git-send-email-ajay.kathat@microchip.com> References: <1537856624-22157-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 'wilc_connected_ssid' actually used to store the BSSID information for connected BSSID. 'wilc_vif' already has 'bssid' variable to store the same information. So refactor code to remove 'wilc_connected_ssid' and instead used 'wilc_vif' struct 'bssid' element. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 24 ----------------------- drivers/staging/wilc1000/host_interface.h | 2 -- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 24 ++++++++++++++--------- 3 files changed, 15 insertions(+), 35 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 529390d..01db899 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -813,7 +813,6 @@ static void handle_scan(struct work_struct *work) kfree(msg); } -u8 wilc_connected_ssid[6] = {0}; static void handle_connect(struct work_struct *work) { struct host_if_msg *msg = container_of(work, struct host_if_msg, work); @@ -835,11 +834,6 @@ static void handle_connect(struct work_struct *work) return; } - if (memcmp(conn_attr->bssid, wilc_connected_ssid, ETH_ALEN) == 0) { - netdev_err(vif->ndev, "Discard connect request\n"); - goto error; - } - bss_param = conn_attr->params; if (!bss_param) { netdev_err(vif->ndev, "Required BSSID not found\n"); @@ -1019,10 +1013,6 @@ static void handle_connect(struct work_struct *work) cur_byte = wid_list[wid_cnt].val; wid_cnt++; - if (conn_attr->bssid) - memcpy(wilc_connected_ssid, - conn_attr->bssid, ETH_ALEN); - result = wilc_send_config_pkt(vif, SET_CFG, wid_list, wid_cnt, wilc_get_vif_idx(vif)); @@ -1145,8 +1135,6 @@ static void handle_connect_timeout(struct work_struct *work) kfree(hif_drv->usr_conn_req.ies); hif_drv->usr_conn_req.ies = NULL; - eth_zero_addr(wilc_connected_ssid); - out: kfree(msg); } @@ -1452,16 +1440,6 @@ static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif, } } - if (mac_status == MAC_STATUS_CONNECTED && - conn_info.status != WLAN_STATUS_SUCCESS) { - netdev_err(vif->ndev, - "Received MAC status is MAC_STATUS_CONNECTED, Assoc Resp is not SUCCESS\n"); - eth_zero_addr(wilc_connected_ssid); - } else if (mac_status == MAC_STATUS_DISCONNECTED) { - netdev_err(vif->ndev, "Received MAC status is MAC_STATUS_DISCONNECTED\n"); - eth_zero_addr(wilc_connected_ssid); - } - if (hif_drv->usr_conn_req.bssid) { memcpy(conn_info.bssid, hif_drv->usr_conn_req.bssid, 6); @@ -1874,8 +1852,6 @@ static void handle_disconnect(struct work_struct *work) vif->obtaining_ip = false; wilc_set_power_mgmt(vif, 0, 0); - eth_zero_addr(wilc_connected_ssid); - result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 4416f8f..33fb731 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -359,6 +359,4 @@ int wilc_get_vif_idx(struct wilc_vif *vif); int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power); int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power); -extern u8 wilc_connected_ssid[6]; - #endif diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 76d017d..1a4d262 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -478,7 +478,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE; wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE); - eth_zero_addr(wilc_connected_ssid); if (!wfi_drv->p2p_connect) wlan_channel = INVALID_CHANNEL; @@ -521,7 +520,6 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, wilc_ie = false; eth_zero_addr(priv->associated_bss); wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE); - eth_zero_addr(wilc_connected_ssid); if (!wfi_drv->p2p_connect) wlan_channel = INVALID_CHANNEL; @@ -696,8 +694,12 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, nw_info = &priv->scanned_shadow[sel_bssi_idx]; } else { ret = -ENOENT; - vif->connecting = false; - return ret; + goto out_error; + } + + if (ether_addr_equal_unaligned(vif->bssid, nw_info->bssid)) { + ret = -EALREADY; + goto out_error; } memset(priv->wep_key, 0, sizeof(priv->wep_key)); @@ -739,8 +741,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, ret = -ENOTSUPP; netdev_err(dev, "%s: Unsupported cipher\n", __func__); - vif->connecting = false; - return ret; + goto out_error; } } @@ -787,13 +788,18 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, security, auth_type, nw_info->ch, nw_info->join_params); - if (ret != 0) { + if (ret) { + u8 null_bssid[ETH_ALEN] = {0}; + netdev_err(dev, "wilc_set_join_req(): Error\n"); ret = -ENOENT; - vif->connecting = false; - return ret; + wilc_wlan_set_bssid(dev, null_bssid, STATION_MODE); + goto out_error; } + return 0; +out_error: + vif->connecting = false; return ret; } -- 2.7.4