public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: Remove ioctl interface
@ 2025-01-09 13:20 Yeking
  2025-01-09 20:31 ` Philipp Hortmann
  2025-01-09 21:19 ` Arnd Bergmann
  0 siblings, 2 replies; 6+ messages in thread
From: Yeking @ 2025-01-09 13:20 UTC (permalink / raw)
  To: linux-staging
  Cc: 谢致邦 (XIE Zhibang), Greg Kroah-Hartman,
	Philipp Hortmann, Masahiro Yamada, Nicolas Schier, Hans de Goede,
	Rodrigo Gobbi, Dan Carpenter, Arnd Bergmann, Justin Stitt,
	Johannes Berg, linux-kernel

From: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>

Wireless drivers should not use the ioctl interface, so remove this
interface for the rtl8723bs driver. (found by code inspection)

Fixes: 8bfb36766064 ("wireless: wext: remove ndo_do_ioctl fallback")
Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>
---
 drivers/staging/rtl8723bs/Makefile            |    1 -
 .../staging/rtl8723bs/include/osdep_intf.h    |    2 -
 .../staging/rtl8723bs/os_dep/ioctl_linux.c    | 1286 -----------------
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   |    1 -
 4 files changed, 1290 deletions(-)
 delete mode 100644 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c

diff --git a/drivers/staging/rtl8723bs/Makefile b/drivers/staging/rtl8723bs/Makefile
index ba200ee66..8560b84a3 100644
--- a/drivers/staging/rtl8723bs/Makefile
+++ b/drivers/staging/rtl8723bs/Makefile
@@ -48,7 +48,6 @@ r8723bs-y = \
 		hal/HalHWImg8723B_RF.o \
 		hal/HalPhyRf_8723B.o \
 		os_dep/ioctl_cfg80211.o \
-		os_dep/ioctl_linux.o \
 		os_dep/mlme_linux.o \
 		os_dep/osdep_service.o \
 		os_dep/os_intfs.o \
diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h
index 215ece612..73199be78 100644
--- a/drivers/staging/rtl8723bs/include/osdep_intf.h
+++ b/drivers/staging/rtl8723bs/include/osdep_intf.h
@@ -47,8 +47,6 @@ u32 rtw_start_drv_threads(struct adapter *padapter);
 void rtw_stop_drv_threads(struct adapter *padapter);
 void rtw_cancel_all_timer(struct adapter *padapter);
 
-int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
-
 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname);
 struct net_device *rtw_init_netdev(struct adapter *padapter);
 void rtw_unregister_netdevs(struct dvobj_priv *dvobj);
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
deleted file mode 100644
index 793b05153..000000000
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ /dev/null
@@ -1,1286 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- ******************************************************************************/
-
-#include <linux/etherdevice.h>
-#include <drv_types.h>
-#include <rtw_mp.h>
-#include <hal_btcoex.h>
-#include <linux/jiffies.h>
-#include <linux/kernel.h>
-
-#define RTL_IOCTL_WPA_SUPPLICANT	(SIOCIWFIRSTPRIV + 30)
-
-static int wpa_set_auth_algs(struct net_device *dev, u32 value)
-{
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	int ret = 0;
-
-	if ((value & IW_AUTH_ALG_SHARED_KEY) && (value & IW_AUTH_ALG_OPEN_SYSTEM)) {
-		padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
-		padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeAutoSwitch;
-		padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
-	} else if (value & IW_AUTH_ALG_SHARED_KEY)	{
-		padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
-
-		padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared;
-		padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared;
-	} else if (value & IW_AUTH_ALG_OPEN_SYSTEM) {
-		/* padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; */
-		if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) {
-			padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
-			padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
-		}
-	} else {
-		ret = -EINVAL;
-	}
-
-	return ret;
-}
-
-static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
-{
-	int ret = 0;
-	u8 max_idx;
-	u32 wep_key_idx, wep_key_len, wep_total_len;
-	struct ndis_802_11_wep	 *pwep = NULL;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct security_priv *psecuritypriv = &padapter->securitypriv;
-
-	param->u.crypt.err = 0;
-	param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
-
-	if (param_len < (u32)((u8 *)param->u.crypt.key - (u8 *)param) + param->u.crypt.key_len) {
-		ret =  -EINVAL;
-		goto exit;
-	}
-
-	if (param->sta_addr[0] != 0xff || param->sta_addr[1] != 0xff ||
-	    param->sta_addr[2] != 0xff || param->sta_addr[3] != 0xff ||
-	    param->sta_addr[4] != 0xff || param->sta_addr[5] != 0xff) {
-		ret = -EINVAL;
-		goto exit;
-	}
-
-	if (strcmp(param->u.crypt.alg, "WEP") == 0)
-		max_idx = WEP_KEYS - 1;
-	else
-		max_idx = BIP_MAX_KEYID;
-
-	if (param->u.crypt.idx > max_idx) {
-		netdev_err(dev, "Error crypt.idx %d > %d\n", param->u.crypt.idx, max_idx);
-		ret = -EINVAL;
-		goto exit;
-	}
-
-	if (strcmp(param->u.crypt.alg, "WEP") == 0) {
-		padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
-		padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_;
-		padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_;
-
-		wep_key_idx = param->u.crypt.idx;
-		wep_key_len = param->u.crypt.key_len;
-
-		if (wep_key_len > 0) {
-			wep_key_len = wep_key_len <= 5 ? 5 : 13;
-			wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
-			/* Allocate a full structure to avoid potentially running off the end. */
-			pwep = kzalloc(sizeof(*pwep), GFP_KERNEL);
-			if (!pwep) {
-				ret = -ENOMEM;
-				goto exit;
-			}
-
-			pwep->key_length = wep_key_len;
-			pwep->length = wep_total_len;
-
-			if (wep_key_len == 13) {
-				padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_;
-				padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_;
-			}
-		} else {
-			ret = -EINVAL;
-			goto exit;
-		}
-
-		pwep->key_index = wep_key_idx;
-		pwep->key_index |= 0x80000000;
-
-		memcpy(pwep->key_material,  param->u.crypt.key, pwep->key_length);
-
-		if (param->u.crypt.set_tx) {
-			if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL)
-				ret = -EOPNOTSUPP;
-		} else {
-			/* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */
-			/* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to fw/cam */
-
-			if (wep_key_idx >= WEP_KEYS) {
-				ret = -EOPNOTSUPP;
-				goto exit;
-			}
-
-			memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length);
-			psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length;
-			rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, true);
-		}
-
-		goto exit;
-	}
-
-	if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { /*  802_1x */
-		struct sta_info *psta, *pbcmc_sta;
-		struct sta_priv *pstapriv = &padapter->stapriv;
-
-		if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */
-			psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv));
-			if (psta) {
-				/* Jeff: don't disable ieee8021x_blocked while clearing key */
-				if (strcmp(param->u.crypt.alg, "none") != 0)
-					psta->ieee8021x_blocked = false;
-
-				if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) ||
-				    (padapter->securitypriv.ndisencryptstatus ==  Ndis802_11Encryption3Enabled)) {
-					psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
-				}
-
-				if (param->u.crypt.set_tx == 1) { /* pairwise key */
-					memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-
-					if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
-						memcpy(psta->dot11tkiptxmickey.skey, &param->u.crypt.key[16], 8);
-						memcpy(psta->dot11tkiprxmickey.skey, &param->u.crypt.key[24], 8);
-
-						padapter->securitypriv.busetkipkey = false;
-						/* _set_timer(&padapter->securitypriv.tkip_timer, 50); */
-					}
-
-					rtw_setstakey_cmd(padapter, psta, true, true);
-				} else { /* group key */
-					if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) {
-						memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-						/* only TKIP group key need to install this */
-						if (param->u.crypt.key_len > 16) {
-							memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[16], 8);
-							memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[24], 8);
-						}
-						padapter->securitypriv.binstallGrpkey = true;
-
-						padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx;
-
-						rtw_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx, 1, true);
-					} else if (strcmp(param->u.crypt.alg, "BIP") == 0) {
-						/* save the IGTK key, length 16 bytes */
-						memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-						padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx;
-						padapter->securitypriv.binstallBIPkey = true;
-					}
-				}
-			}
-
-			pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
-			if (pbcmc_sta) {
-				/* Jeff: don't disable ieee8021x_blocked while clearing key */
-				if (strcmp(param->u.crypt.alg, "none") != 0)
-					pbcmc_sta->ieee8021x_blocked = false;
-
-				if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) ||
-				    (padapter->securitypriv.ndisencryptstatus ==  Ndis802_11Encryption3Enabled)) {
-					pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm;
-				}
-			}
-		} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
-			/* adhoc mode */
-		}
-	}
-
-exit:
-
-	kfree(pwep);
-	return ret;
-}
-
-static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ielen)
-{
-	u8 *buf = NULL;
-	int group_cipher = 0, pairwise_cipher = 0;
-	int ret = 0;
-	u8 null_addr[] = {0, 0, 0, 0, 0, 0};
-
-	if (ielen > MAX_WPA_IE_LEN || !pie) {
-		_clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
-		if (!pie)
-			return ret;
-		else
-			return -EINVAL;
-	}
-
-	if (ielen) {
-		buf = rtw_zmalloc(ielen);
-		if (!buf) {
-			ret =  -ENOMEM;
-			goto exit;
-		}
-
-		memcpy(buf, pie, ielen);
-
-		if (ielen < RSN_HEADER_LEN) {
-			ret  = -1;
-			goto exit;
-		}
-
-		if (rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) {
-			padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
-			padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK;
-			memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen);
-		}
-
-		if (rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) {
-			padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
-			padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK;
-			memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen);
-		}
-
-		if (group_cipher == 0)
-			group_cipher = WPA_CIPHER_NONE;
-		if (pairwise_cipher == 0)
-			pairwise_cipher = WPA_CIPHER_NONE;
-
-		switch (group_cipher) {
-		case WPA_CIPHER_NONE:
-			padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled;
-			break;
-		case WPA_CIPHER_WEP40:
-			padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
-			break;
-		case WPA_CIPHER_TKIP:
-			padapter->securitypriv.dot118021XGrpPrivacy = _TKIP_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
-			break;
-		case WPA_CIPHER_CCMP:
-			padapter->securitypriv.dot118021XGrpPrivacy = _AES_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
-			break;
-		case WPA_CIPHER_WEP104:
-			padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
-			break;
-		}
-
-		switch (pairwise_cipher) {
-		case WPA_CIPHER_NONE:
-			padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled;
-			break;
-		case WPA_CIPHER_WEP40:
-			padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
-			break;
-		case WPA_CIPHER_TKIP:
-			padapter->securitypriv.dot11PrivacyAlgrthm = _TKIP_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
-			break;
-		case WPA_CIPHER_CCMP:
-			padapter->securitypriv.dot11PrivacyAlgrthm = _AES_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
-			break;
-		case WPA_CIPHER_WEP104:
-			padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_;
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;
-			break;
-		}
-
-		_clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS);
-		{/* set wps_ie */
-			u16 cnt = 0;
-			u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
-
-			while (cnt < ielen) {
-				eid = buf[cnt];
-
-				if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&buf[cnt + 2], wps_oui, 4))) {
-					padapter->securitypriv.wps_ie_len = ((buf[cnt + 1] + 2) < MAX_WPS_IE_LEN) ? (buf[cnt + 1] + 2) : MAX_WPS_IE_LEN;
-
-					memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len);
-
-					set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS);
-
-					cnt += buf[cnt + 1] + 2;
-
-					break;
-				} else {
-					cnt += buf[cnt + 1] + 2; /* goto next */
-				}
-			}
-		}
-	}
-
-	/* TKIP and AES disallow multicast packets until installing group key */
-	if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ ||
-	    padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ ||
-	    padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
-		/* WPS open need to enable multicast */
-		/*  check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == true) */
-		rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr);
-
-exit:
-
-	kfree(buf);
-
-	return ret;
-}
-
-static int wpa_set_param(struct net_device *dev, u8 name, u32 value)
-{
-	uint ret = 0;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-
-	switch (name) {
-	case IEEE_PARAM_WPA_ENABLED:
-
-		padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; /* 802.1x */
-
-		/* ret = ieee80211_wpa_enable(ieee, value); */
-
-		switch ((value) & 0xff) {
-		case 1: /* WPA */
-			padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled;
-			break;
-		case 2: /* WPA2 */
-			padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; /* WPA2_PSK */
-			padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled;
-			break;
-		}
-
-		break;
-
-	case IEEE_PARAM_TKIP_COUNTERMEASURES:
-		/* ieee->tkip_countermeasures =value; */
-		break;
-
-	case IEEE_PARAM_DROP_UNENCRYPTED:
-	{
-		/* HACK:
-		 *
-		 * wpa_supplicant calls set_wpa_enabled when the driver
-		 * is loaded and unloaded, regardless of if WPA is being
-		 * used.  No other calls are made which can be used to
-		 * determine if encryption will be used or not prior to
-		 * association being expected.  If encryption is not being
-		 * used, drop_unencrypted is set to false, else true -- we
-		 * can use this to determine if the CAP_PRIVACY_ON bit should
-		 * be set.
-		 */
-		break;
-	}
-	case IEEE_PARAM_PRIVACY_INVOKED:
-
-		/* ieee->privacy_invoked =value; */
-
-		break;
-
-	case IEEE_PARAM_AUTH_ALGS:
-
-		ret = wpa_set_auth_algs(dev, value);
-
-		break;
-
-	case IEEE_PARAM_IEEE_802_1X:
-
-		/* ieee->ieee802_1x =value; */
-
-		break;
-
-	case IEEE_PARAM_WPAX_SELECT:
-
-		/*  added for WPA2 mixed mode */
-		/*
-		spin_lock_irqsave(&ieee->wpax_suitlist_lock, flags);
-		ieee->wpax_type_set = 1;
-		ieee->wpax_type_notify = value;
-		spin_unlock_irqrestore(&ieee->wpax_suitlist_lock, flags);
-		*/
-
-		break;
-
-	default:
-
-		ret = -EOPNOTSUPP;
-
-		break;
-	}
-
-	return ret;
-}
-
-static int wpa_mlme(struct net_device *dev, u32 command, u32 reason)
-{
-	int ret = 0;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-
-	switch (command) {
-	case IEEE_MLME_STA_DEAUTH:
-
-		if (!rtw_set_802_11_disassociate(padapter))
-			ret = -1;
-
-		break;
-
-	case IEEE_MLME_STA_DISASSOC:
-
-		if (!rtw_set_802_11_disassociate(padapter))
-			ret = -1;
-
-		break;
-
-	default:
-		ret = -EOPNOTSUPP;
-		break;
-	}
-
-	return ret;
-}
-
-static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p)
-{
-	struct ieee_param *param;
-	uint ret = 0;
-
-	/* down(&ieee->wx_sem); */
-
-	if (!p->pointer || p->length != sizeof(struct ieee_param))
-		return -EINVAL;
-
-	param = rtw_malloc(p->length);
-	if (!param)
-		return -ENOMEM;
-
-	if (copy_from_user(param, p->pointer, p->length)) {
-		kfree(param);
-		return -EFAULT;
-	}
-
-	switch (param->cmd) {
-	case IEEE_CMD_SET_WPA_PARAM:
-		ret = wpa_set_param(dev, param->u.wpa_param.name, param->u.wpa_param.value);
-		break;
-
-	case IEEE_CMD_SET_WPA_IE:
-		/* ret = wpa_set_wpa_ie(dev, param, p->length); */
-		ret =  rtw_set_wpa_ie(rtw_netdev_priv(dev), (char *)param->u.wpa_ie.data, (u16)param->u.wpa_ie.len);
-		break;
-
-	case IEEE_CMD_SET_ENCRYPTION:
-		ret = wpa_set_encryption(dev, param, p->length);
-		break;
-
-	case IEEE_CMD_MLME:
-		ret = wpa_mlme(dev, param->u.mlme.command, param->u.mlme.reason_code);
-		break;
-
-	default:
-		ret = -EOPNOTSUPP;
-		break;
-	}
-
-	if (ret == 0 && copy_to_user(p->pointer, param, p->length))
-		ret = -EFAULT;
-
-	kfree(param);
-
-	/* up(&ieee->wx_sem); */
-	return ret;
-}
-
-static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len)
-{
-	int ret = 0;
-	u32 wep_key_idx, wep_key_len, wep_total_len;
-	struct ndis_802_11_wep	 *pwep = NULL;
-	struct sta_info *psta = NULL, *pbcmc_sta = NULL;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct security_priv *psecuritypriv = &padapter->securitypriv;
-	struct sta_priv *pstapriv = &padapter->stapriv;
-	char *txkey = padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey;
-	char *rxkey = padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey;
-	char *grpkey = psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey;
-
-	param->u.crypt.err = 0;
-	param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0';
-
-	/* sizeof(struct ieee_param) = 64 bytes; */
-	/* if (param_len !=  (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) */
-	if (param_len !=  sizeof(struct ieee_param) + param->u.crypt.key_len) {
-		ret =  -EINVAL;
-		goto exit;
-	}
-
-	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
-	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
-	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
-		if (param->u.crypt.idx >= WEP_KEYS) {
-			ret = -EINVAL;
-			goto exit;
-		}
-	} else {
-		psta = rtw_get_stainfo(pstapriv, param->sta_addr);
-		if (!psta)
-			/* ret = -EINVAL; */
-			goto exit;
-	}
-
-	if (strcmp(param->u.crypt.alg, "none") == 0 && !psta) {
-		/* todo:clear default encryption keys */
-
-		psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open;
-		psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled;
-		psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_;
-		psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
-
-		goto exit;
-	}
-
-	if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) {
-		wep_key_idx = param->u.crypt.idx;
-		wep_key_len = param->u.crypt.key_len;
-
-		if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) {
-			ret = -EINVAL;
-			goto exit;
-		}
-
-		if (wep_key_len > 0) {
-			wep_key_len = wep_key_len <= 5 ? 5 : 13;
-			wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material);
-			/* Allocate a full structure to avoid potentially running off the end. */
-			pwep = kzalloc(sizeof(*pwep), GFP_KERNEL);
-			if (!pwep)
-				goto exit;
-
-			pwep->key_length = wep_key_len;
-			pwep->length = wep_total_len;
-		}
-
-		pwep->key_index = wep_key_idx;
-
-		memcpy(pwep->key_material,  param->u.crypt.key, pwep->key_length);
-
-		if (param->u.crypt.set_tx) {
-			psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto;
-			psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled;
-			psecuritypriv->dot11PrivacyAlgrthm = _WEP40_;
-			psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
-
-			if (pwep->key_length == 13) {
-				psecuritypriv->dot11PrivacyAlgrthm = _WEP104_;
-				psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
-			}
-
-			psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx;
-
-			memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length);
-
-			psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length;
-
-			rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 1);
-		} else {
-			/* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */
-			/* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to cam */
-
-			memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length);
-
-			psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length;
-
-			rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 0);
-		}
-
-		goto exit;
-	}
-
-	if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /*  group key */
-		if (param->u.crypt.set_tx == 1) {
-			if (strcmp(param->u.crypt.alg, "WEP") == 0) {
-				memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-
-				psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
-				if (param->u.crypt.key_len == 13)
-					psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
-
-			} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
-				psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
-
-				memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-
-				/* set mic key */
-				memcpy(txkey, &param->u.crypt.key[16], 8);
-				memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[24], 8);
-
-				psecuritypriv->busetkipkey = true;
-
-			} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
-				psecuritypriv->dot118021XGrpPrivacy = _AES_;
-
-				memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-			} else {
-				psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
-			}
-
-			psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
-
-			psecuritypriv->binstallGrpkey = true;
-
-			psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
-
-			rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
-
-			pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
-			if (pbcmc_sta) {
-				pbcmc_sta->ieee8021x_blocked = false;
-				pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */
-			}
-		}
-
-		goto exit;
-	}
-
-	if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) { /*  psk/802_1x */
-		if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
-			if (param->u.crypt.set_tx == 1)	{
-				memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-
-				if (strcmp(param->u.crypt.alg, "WEP") == 0) {
-					psta->dot118021XPrivacy = _WEP40_;
-					if (param->u.crypt.key_len == 13)
-						psta->dot118021XPrivacy = _WEP104_;
-				} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
-					psta->dot118021XPrivacy = _TKIP_;
-
-					/* set mic key */
-					memcpy(psta->dot11tkiptxmickey.skey, &param->u.crypt.key[16], 8);
-					memcpy(psta->dot11tkiprxmickey.skey, &param->u.crypt.key[24], 8);
-
-					psecuritypriv->busetkipkey = true;
-
-				} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
-					psta->dot118021XPrivacy = _AES_;
-				} else {
-					psta->dot118021XPrivacy = _NO_PRIVACY_;
-				}
-
-				rtw_ap_set_pairwise_key(padapter, psta);
-
-				psta->ieee8021x_blocked = false;
-
-			} else { /* group key??? */
-				if (strcmp(param->u.crypt.alg, "WEP") == 0) {
-					memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-
-					psecuritypriv->dot118021XGrpPrivacy = _WEP40_;
-					if (param->u.crypt.key_len == 13)
-						psecuritypriv->dot118021XGrpPrivacy = _WEP104_;
-				} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
-					psecuritypriv->dot118021XGrpPrivacy = _TKIP_;
-
-					memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-
-					/* set mic key */
-					memcpy(txkey, &param->u.crypt.key[16], 8);
-					memcpy(rxkey, &param->u.crypt.key[24], 8);
-
-					psecuritypriv->busetkipkey = true;
-
-				} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
-					psecuritypriv->dot118021XGrpPrivacy = _AES_;
-
-					memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len));
-				} else {
-					psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_;
-				}
-
-				psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
-
-				psecuritypriv->binstallGrpkey = true;
-
-				psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/*  */
-
-				rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx);
-
-				pbcmc_sta = rtw_get_bcmc_stainfo(padapter);
-				if (pbcmc_sta) {
-					pbcmc_sta->ieee8021x_blocked = false;
-					pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */
-				}
-			}
-		}
-	}
-
-exit:
-	kfree(pwep);
-
-	return ret;
-}
-
-static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int len)
-{
-	int ret = 0;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct sta_priv *pstapriv = &padapter->stapriv;
-	unsigned char *pbuf = param->u.bcn_ie.buf;
-
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
-		return -EINVAL;
-
-	memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2);
-
-	if ((pstapriv->max_num_sta > NUM_STA) || (pstapriv->max_num_sta <= 0))
-		pstapriv->max_num_sta = NUM_STA;
-
-	if (rtw_check_beacon_data(padapter, pbuf,  (len - 12 - 2)) == _SUCCESS)/*  12 = param header, 2:no packed */
-		ret = 0;
-	else
-		ret = -EINVAL;
-
-	return ret;
-}
-
-static void rtw_hostapd_sta_flush(struct net_device *dev)
-{
-	/* _irqL irqL; */
-	/* struct list_head	*phead, *plist; */
-	/* struct sta_info *psta = NULL; */
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	/* struct sta_priv *pstapriv = &padapter->stapriv; */
-
-	flush_all_cam_entry(padapter);	/* clear CAM */
-
-	rtw_sta_flush(padapter);
-}
-
-static int rtw_add_sta(struct net_device *dev, struct ieee_param *param)
-{
-	int ret = 0;
-	struct sta_info *psta = NULL;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct sta_priv *pstapriv = &padapter->stapriv;
-
-	if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
-		return -EINVAL;
-
-	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
-	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
-	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
-		return -EINVAL;
-	}
-
-/*
-	psta = rtw_get_stainfo(pstapriv, param->sta_addr);
-	if (psta)
-	{
-		rtw_free_stainfo(padapter,  psta);
-
-		psta = NULL;
-	}
-*/
-	/* psta = rtw_alloc_stainfo(pstapriv, param->sta_addr); */
-	psta = rtw_get_stainfo(pstapriv, param->sta_addr);
-	if (psta) {
-		int flags = param->u.add_sta.flags;
-
-		psta->aid = param->u.add_sta.aid;/* aid = 1~2007 */
-
-		memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16);
-
-		/* check wmm cap. */
-		if (WLAN_STA_WME & flags)
-			psta->qos_option = 1;
-		else
-			psta->qos_option = 0;
-
-		if (pmlmepriv->qospriv.qos_option == 0)
-			psta->qos_option = 0;
-
-		/* chec 802.11n ht cap. */
-		if (WLAN_STA_HT & flags) {
-			psta->htpriv.ht_option = true;
-			psta->qos_option = 1;
-			memcpy((void *)&psta->htpriv.ht_cap, (void *)&param->u.add_sta.ht_cap, sizeof(struct ieee80211_ht_cap));
-		} else {
-			psta->htpriv.ht_option = false;
-		}
-
-		if (!pmlmepriv->htpriv.ht_option)
-			psta->htpriv.ht_option = false;
-
-		update_sta_info_apmode(padapter, psta);
-
-	} else {
-		ret = -ENOMEM;
-	}
-
-	return ret;
-}
-
-static int rtw_del_sta(struct net_device *dev, struct ieee_param *param)
-{
-	int ret = 0;
-	struct sta_info *psta = NULL;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct sta_priv *pstapriv = &padapter->stapriv;
-
-	if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
-		return -EINVAL;
-
-	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
-	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
-	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
-		return -EINVAL;
-	}
-
-	psta = rtw_get_stainfo(pstapriv, param->sta_addr);
-	if (psta) {
-		u8 updated = false;
-
-		spin_lock_bh(&pstapriv->asoc_list_lock);
-		if (list_empty(&psta->asoc_list) == false) {
-			list_del_init(&psta->asoc_list);
-			pstapriv->asoc_list_cnt--;
-			updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING);
-		}
-		spin_unlock_bh(&pstapriv->asoc_list_lock);
-
-		associated_clients_update(padapter, updated);
-
-		psta = NULL;
-	}
-
-	return ret;
-}
-
-static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *param, int len)
-{
-	int ret = 0;
-	struct sta_info *psta = NULL;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct sta_priv *pstapriv = &padapter->stapriv;
-	struct ieee_param_ex *param_ex = (struct ieee_param_ex *)param;
-	struct sta_data *psta_data = (struct sta_data *)param_ex->data;
-
-	if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
-		return -EINVAL;
-
-	if (param_ex->sta_addr[0] == 0xff && param_ex->sta_addr[1] == 0xff &&
-	    param_ex->sta_addr[2] == 0xff && param_ex->sta_addr[3] == 0xff &&
-	    param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) {
-		return -EINVAL;
-	}
-
-	psta = rtw_get_stainfo(pstapriv, param_ex->sta_addr);
-	if (psta) {
-		psta_data->aid = (u16)psta->aid;
-		psta_data->capability = psta->capability;
-		psta_data->flags = psta->flags;
-
-/*
-		nonerp_set : BIT(0)
-		no_short_slot_time_set : BIT(1)
-		no_short_preamble_set : BIT(2)
-		no_ht_gf_set : BIT(3)
-		no_ht_set : BIT(4)
-		ht_20mhz_set : BIT(5)
-*/
-
-		psta_data->sta_set = ((psta->nonerp_set) |
-							 (psta->no_short_slot_time_set << 1) |
-							 (psta->no_short_preamble_set << 2) |
-							 (psta->no_ht_gf_set << 3) |
-							 (psta->no_ht_set << 4) |
-							 (psta->ht_20mhz_set << 5));
-
-		psta_data->tx_supp_rates_len =  psta->bssratelen;
-		memcpy(psta_data->tx_supp_rates, psta->bssrateset, psta->bssratelen);
-		memcpy(&psta_data->ht_cap, &psta->htpriv.ht_cap, sizeof(struct ieee80211_ht_cap));
-		psta_data->rx_pkts = psta->sta_stats.rx_data_pkts;
-		psta_data->rx_bytes = psta->sta_stats.rx_bytes;
-		psta_data->rx_drops = psta->sta_stats.rx_drops;
-
-		psta_data->tx_pkts = psta->sta_stats.tx_pkts;
-		psta_data->tx_bytes = psta->sta_stats.tx_bytes;
-		psta_data->tx_drops = psta->sta_stats.tx_drops;
-
-	} else {
-		ret = -1;
-	}
-
-	return ret;
-}
-
-static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param)
-{
-	int ret = 0;
-	struct sta_info *psta = NULL;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct sta_priv *pstapriv = &padapter->stapriv;
-
-	if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true)
-		return -EINVAL;
-
-	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
-	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
-	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
-		return -EINVAL;
-	}
-
-	psta = rtw_get_stainfo(pstapriv, param->sta_addr);
-	if (psta) {
-		if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC)) {
-			int wpa_ie_len;
-			int copy_len;
-
-			wpa_ie_len = psta->wpa_ie[1];
-
-			copy_len = ((wpa_ie_len + 2) > sizeof(psta->wpa_ie)) ? (sizeof(psta->wpa_ie)) : (wpa_ie_len + 2);
-
-			param->u.wpa_ie.len = copy_len;
-
-			memcpy(param->u.wpa_ie.reserved, psta->wpa_ie, copy_len);
-		}
-	} else {
-		ret = -1;
-	}
-
-	return ret;
-}
-
-static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, int len)
-{
-	int ret = 0;
-	unsigned char wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
-	int ie_len;
-
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
-		return -EINVAL;
-
-	ie_len = len - 12 - 2;/*  12 = param header, 2:no packed */
-
-	kfree(pmlmepriv->wps_beacon_ie);
-	pmlmepriv->wps_beacon_ie = NULL;
-
-	if (ie_len > 0) {
-		pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len);
-		pmlmepriv->wps_beacon_ie_len = ie_len;
-		if (!pmlmepriv->wps_beacon_ie)
-			return -EINVAL;
-
-		memcpy(pmlmepriv->wps_beacon_ie, param->u.bcn_ie.buf, ie_len);
-
-		update_beacon(padapter, WLAN_EID_VENDOR_SPECIFIC, wps_oui, true);
-
-		pmlmeext->bstart_bss = true;
-	}
-
-	return ret;
-}
-
-static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *param, int len)
-{
-	int ret = 0;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	int ie_len;
-
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
-		return -EINVAL;
-
-	ie_len = len - 12 - 2;/*  12 = param header, 2:no packed */
-
-	kfree(pmlmepriv->wps_probe_resp_ie);
-	pmlmepriv->wps_probe_resp_ie = NULL;
-
-	if (ie_len > 0) {
-		pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len);
-		pmlmepriv->wps_probe_resp_ie_len = ie_len;
-		if (!pmlmepriv->wps_probe_resp_ie)
-			return -EINVAL;
-
-		memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len);
-	}
-
-	return ret;
-}
-
-static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *param, int len)
-{
-	int ret = 0;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	int ie_len;
-
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
-		return -EINVAL;
-
-	ie_len = len - 12 - 2;/*  12 = param header, 2:no packed */
-
-	kfree(pmlmepriv->wps_assoc_resp_ie);
-	pmlmepriv->wps_assoc_resp_ie = NULL;
-
-	if (ie_len > 0) {
-		pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len);
-		pmlmepriv->wps_assoc_resp_ie_len = ie_len;
-		if (!pmlmepriv->wps_assoc_resp_ie)
-			return -EINVAL;
-
-		memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len);
-	}
-
-	return ret;
-}
-
-static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, int len)
-{
-	int ret = 0;
-	struct adapter *adapter = rtw_netdev_priv(dev);
-	struct mlme_priv *mlmepriv = &adapter->mlmepriv;
-	struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv;
-	struct mlme_ext_info *mlmeinfo = &mlmeext->mlmext_info;
-	int ie_len;
-	u8 *ssid_ie;
-	char ssid[NDIS_802_11_LENGTH_SSID + 1];
-	signed int ssid_len;
-	u8 ignore_broadcast_ssid;
-
-	if (check_fwstate(mlmepriv, WIFI_AP_STATE) != true)
-		return -EPERM;
-
-	if (param->u.bcn_ie.reserved[0] != 0xea)
-		return -EINVAL;
-
-	mlmeinfo->hidden_ssid_mode = ignore_broadcast_ssid = param->u.bcn_ie.reserved[1];
-
-	ie_len = len - 12 - 2;/*  12 = param header, 2:no packed */
-	ssid_ie = rtw_get_ie(param->u.bcn_ie.buf,  WLAN_EID_SSID, &ssid_len, ie_len);
-
-	if (ssid_ie && ssid_len > 0 && ssid_len <= NDIS_802_11_LENGTH_SSID) {
-		struct wlan_bssid_ex *pbss_network = &mlmepriv->cur_network.network;
-		struct wlan_bssid_ex *pbss_network_ext = &mlmeinfo->network;
-
-		memcpy(ssid, ssid_ie + 2, ssid_len);
-		ssid[ssid_len] = 0x0;
-
-		memcpy(pbss_network->ssid.ssid, (void *)ssid, ssid_len);
-		pbss_network->ssid.ssid_length = ssid_len;
-		memcpy(pbss_network_ext->ssid.ssid, (void *)ssid, ssid_len);
-		pbss_network_ext->ssid.ssid_length = ssid_len;
-	}
-
-	return ret;
-}
-
-static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len)
-{
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
-		return -EINVAL;
-
-	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
-	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
-	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
-		return -EINVAL;
-	}
-
-	rtw_acl_remove_sta(padapter, param->sta_addr);
-	return 0;
-}
-
-static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len)
-{
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
-		return -EINVAL;
-
-	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
-	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
-	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
-		return -EINVAL;
-	}
-
-	return rtw_acl_add_sta(padapter, param->sta_addr);
-}
-
-static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *param, int len)
-{
-	int ret = 0;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
-		return -EINVAL;
-
-	rtw_set_macaddr_acl(padapter, param->u.mlme.command);
-
-	return ret;
-}
-
-static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p)
-{
-	struct ieee_param *param;
-	int ret = 0;
-	struct adapter *padapter = rtw_netdev_priv(dev);
-
-	/*
-	 * this function is expect to call in master mode, which allows no power saving
-	 * so, we just check hw_init_completed
-	 */
-
-	if (!padapter->hw_init_completed)
-		return -EPERM;
-
-	if (!p->pointer || p->length != sizeof(*param))
-		return -EINVAL;
-
-	param = rtw_malloc(p->length);
-	if (!param)
-		return -ENOMEM;
-
-	if (copy_from_user(param, p->pointer, p->length)) {
-		kfree(param);
-		return -EFAULT;
-	}
-
-	switch (param->cmd) {
-	case RTL871X_HOSTAPD_FLUSH:
-
-		rtw_hostapd_sta_flush(dev);
-
-		break;
-
-	case RTL871X_HOSTAPD_ADD_STA:
-
-		ret = rtw_add_sta(dev, param);
-
-		break;
-
-	case RTL871X_HOSTAPD_REMOVE_STA:
-
-		ret = rtw_del_sta(dev, param);
-
-		break;
-
-	case RTL871X_HOSTAPD_SET_BEACON:
-
-		ret = rtw_set_beacon(dev, param, p->length);
-
-		break;
-
-	case RTL871X_SET_ENCRYPTION:
-
-		ret = rtw_set_encryption(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_GET_WPAIE_STA:
-
-		ret = rtw_get_sta_wpaie(dev, param);
-
-		break;
-
-	case RTL871X_HOSTAPD_SET_WPS_BEACON:
-
-		ret = rtw_set_wps_beacon(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_SET_WPS_PROBE_RESP:
-
-		ret = rtw_set_wps_probe_resp(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP:
-
-		ret = rtw_set_wps_assoc_resp(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_SET_HIDDEN_SSID:
-
-		ret = rtw_set_hidden_ssid(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_GET_INFO_STA:
-
-		ret = rtw_ioctl_get_sta_data(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_SET_MACADDR_ACL:
-
-		ret = rtw_ioctl_set_macaddr_acl(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_ACL_ADD_STA:
-
-		ret = rtw_ioctl_acl_add_sta(dev, param, p->length);
-
-		break;
-
-	case RTL871X_HOSTAPD_ACL_REMOVE_STA:
-
-		ret = rtw_ioctl_acl_remove_sta(dev, param, p->length);
-
-		break;
-
-	default:
-		ret = -EOPNOTSUPP;
-		break;
-	}
-
-	if (ret == 0 && copy_to_user(p->pointer, param, p->length))
-		ret = -EFAULT;
-
-	kfree(param);
-	return ret;
-}
-
-/*  copy from net/wireless/wext.c end */
-
-int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-	struct iwreq *wrq = (struct iwreq *)rq;
-	int ret = 0;
-
-	switch (cmd) {
-	case RTL_IOCTL_WPA_SUPPLICANT:
-		ret = wpa_supplicant_ioctl(dev, &wrq->u.data);
-		break;
-	case RTL_IOCTL_HOSTAPD:
-		ret = rtw_hostapd_ioctl(dev, &wrq->u.data);
-		break;
-	default:
-		ret = -EOPNOTSUPP;
-		break;
-	}
-
-	return ret;
-}
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 4e1917c05..738a601c5 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -407,7 +407,6 @@ static const struct net_device_ops rtw_netdev_ops = {
 	.ndo_select_queue	= rtw_select_queue,
 	.ndo_set_mac_address = rtw_net_set_mac_address,
 	.ndo_get_stats = rtw_net_get_stats,
-	.ndo_do_ioctl = rtw_ioctl,
 };
 
 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: rtl8723bs: Remove ioctl interface
  2025-01-09 13:20 [PATCH] staging: rtl8723bs: Remove ioctl interface Yeking
@ 2025-01-09 20:31 ` Philipp Hortmann
  2025-01-09 21:19 ` Arnd Bergmann
  1 sibling, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2025-01-09 20:31 UTC (permalink / raw)
  To: Yeking, linux-staging
  Cc: Greg Kroah-Hartman, Masahiro Yamada, Nicolas Schier,
	Hans de Goede, Rodrigo Gobbi, Dan Carpenter, Arnd Bergmann,
	Justin Stitt, Johannes Berg, linux-kernel

On 09.01.25 14:20, Yeking@Red54.com wrote:
> From: 谢致邦 (XIE Zhibang)<Yeking@Red54.com>
> 
> Wireless drivers should not use the ioctl interface, so remove this
> interface for the rtl8723bs driver. (found by code inspection)
> 
> Fixes: 8bfb36766064 ("wireless: wext: remove ndo_do_ioctl fallback")
> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
> Signed-off-by: 谢致邦 (XIE Zhibang)<Yeking@Red54.com>
> ---

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: rtl8723bs: Remove ioctl interface
  2025-01-09 13:20 [PATCH] staging: rtl8723bs: Remove ioctl interface Yeking
  2025-01-09 20:31 ` Philipp Hortmann
@ 2025-01-09 21:19 ` Arnd Bergmann
  2025-01-10 13:10   ` Yeking
  1 sibling, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2025-01-09 21:19 UTC (permalink / raw)
  To: Yeking, linux-staging
  Cc: Greg Kroah-Hartman, Philipp Hortmann, Masahiro Yamada,
	Nicolas Schier, Hans de Goede, Rodrigo Gobbi, Dan Carpenter,
	Justin Stitt, Johannes Berg, linux-kernel

On Thu, Jan 9, 2025, at 14:20, Yeking@red54.com wrote:
> From: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>
>
> Wireless drivers should not use the ioctl interface, so remove this
> interface for the rtl8723bs driver. (found by code inspection)
>
> Fixes: 8bfb36766064 ("wireless: wext: remove ndo_do_ioctl fallback")
> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
> Signed-off-by: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>
> ---
>  drivers/staging/rtl8723bs/Makefile            |    1 -
>  .../staging/rtl8723bs/include/osdep_intf.h    |    2 -
>  .../staging/rtl8723bs/os_dep/ioctl_linux.c    | 1286 -----------------
>  drivers/staging/rtl8723bs/os_dep/os_intfs.c   |    1 -
>  4 files changed, 1290 deletions(-)
>  delete mode 100644 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c


Thanks for picking this up again. I had done a complete removal
of ndo_do_ioctl a while ago but hadn't gotten around to finishing
the upstreaming. For my older patches, see
https://lore.kernel.org/all/20231009141908.1767241-7-arnd@kernel.org/

Your version is very similar but seems to miss a couple of stale
data structure and function declarations. Can you make sure you
include all those?

       Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re: [PATCH] staging: rtl8723bs: Remove ioctl interface
  2025-01-09 21:19 ` Arnd Bergmann
@ 2025-01-10 13:10   ` Yeking
  2025-02-22 19:03     ` [PATCH] staging: rtl8723bs: Remove some unused functions, macros, and structs Yeking
  0 siblings, 1 reply; 6+ messages in thread
From: Yeking @ 2025-01-10 13:10 UTC (permalink / raw)
  To: arnd
  Cc: Yeking, dan.carpenter, gregkh, hdegoede, johannes.berg,
	justinstitt, linux-kernel, linux-staging, masahiroy, nicolas,
	philipp.g.hortmann, rodrigo.gobbi.7

> Thanks for picking this up again. I had done a complete removal
> of ndo_do_ioctl a while ago but hadn't gotten around to finishing
> the upstreaming. For my older patches, see
> https://lore.kernel.org/all/20231009141908.1767241-7-arnd@kernel.org/
> 
> Your version is very similar but seems to miss a couple of stale
> data structure and function declarations. Can you make sure you
> include all those?
> 
>        Arnd

Thanks for letting me know that you have an old patch. The stale functions like
rtw_ndev_notifier_call, rtw_ndev_notifier_register and
rtw_ndev_notifier_unregister, and the related struct rtw_ndev_notifier have
been removed in 037f9a6df3fb (staging: rtl8723bs: Remove no-op
netdevice_notifier(), 2024-10-24). As for the intf_priv struct that was removed
in your old patch, it has not been processed yet, because rtl8723bs has a lot
of such structs that have not been used since they were introduced in
554c0a3abf21 (staging: Add rtl8723bs sdio wifi driver, 2017-03-29), such as
many in rtw_mp.h. I plan to deal with these contents later.

	XIE Zhibang


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] staging: rtl8723bs: Remove some unused functions, macros, and structs
  2025-01-10 13:10   ` Yeking
@ 2025-02-22 19:03     ` Yeking
  2025-02-24  8:53       ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Yeking @ 2025-02-22 19:03 UTC (permalink / raw)
  To: yeking
  Cc: arnd, dan.carpenter, gregkh, hdegoede, johannes.berg, justinstitt,
	linux-kernel, linux-staging, masahiroy, nicolas,
	philipp.g.hortmann, rodrigo.gobbi.7,
	谢致邦 (XIE Zhibang), Roshan Khatri

From: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>

Remove some functions, macros, and structs that have not been used since
they were introduced in commit 554c0a3abf21 ("staging: Add rtl8723bs
sdio wifi driver").

Signed-off-by: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>
---
 drivers/staging/rtl8723bs/hal/hal_com.c       |   3 +
 .../staging/rtl8723bs/include/osdep_intf.h    |  27 --
 .../staging/rtl8723bs/include/rtl8723b_hal.h  |   1 -
 drivers/staging/rtl8723bs/include/rtw_io.h    |  92 -----
 drivers/staging/rtl8723bs/include/rtw_mp.h    | 341 ------------------
 drivers/staging/rtl8723bs/os_dep/os_intfs.c   |   2 -
 6 files changed, 3 insertions(+), 463 deletions(-)
 delete mode 100644 drivers/staging/rtl8723bs/include/rtw_mp.h

diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index b41ec89932af..1213a91cffff 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -884,6 +884,9 @@ static u32 Array_kfreemap[] = {
 	0xfc, 0x0,
 };
 
+#define		REG_RF_BB_GAIN_OFFSET	0x7f
+//#define		RF_GAIN_OFFSET_MASK	0xfffff
+
 void rtw_bb_rf_gain_offset(struct adapter *padapter)
 {
 	u8 value = padapter->eeprompriv.EEPROMRFGainOffset;
diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h
index 73199be78139..83a25598e962 100644
--- a/drivers/staging/rtl8723bs/include/osdep_intf.h
+++ b/drivers/staging/rtl8723bs/include/osdep_intf.h
@@ -8,33 +8,6 @@
 #ifndef __OSDEP_INTF_H_
 #define __OSDEP_INTF_H_
 
-
-struct intf_priv {
-
-	u8 *intf_dev;
-	u32 max_iosz;	/* USB2.0: 128, USB1.1: 64, SDIO:64 */
-	u32 max_xmitsz; /* USB2.0: unlimited, SDIO:512 */
-	u32 max_recvsz; /* USB2.0: unlimited, SDIO:512 */
-
-	volatile u8 *io_rwmem;
-	volatile u8 *allocated_io_rwmem;
-	u32 io_wsz; /* unit: 4bytes */
-	u32 io_rsz;/* unit: 4bytes */
-	u8 intf_status;
-
-	void (*_bus_io)(u8 *priv);
-
-/*
-Under Sync. IRP (SDIO/USB)
-A protection mechanism is necessary for the io_rwmem(read/write protocol)
-
-Under Async. IRP (SDIO/USB)
-The protection mechanism is through the pending queue.
-*/
-
-	struct mutex ioctl_mutex;
-};
-
 struct dvobj_priv *devobj_init(void);
 void devobj_deinit(struct dvobj_priv *pdvobj);
 
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
index e6d6e9de5474..a4a14474c35d 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
@@ -15,7 +15,6 @@
 #include "rtl8723b_recv.h"
 #include "rtl8723b_xmit.h"
 #include "rtl8723b_cmd.h"
-#include "rtw_mp.h"
 #include "hal_pwr_seq.h"
 #include "Hal8192CPhyReg.h"
 #include "hal_phy_cfg.h"
diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
index 0ee87be6dc4f..adf1de4d7924 100644
--- a/drivers/staging/rtl8723bs/include/rtw_io.h
+++ b/drivers/staging/rtl8723bs/include/rtw_io.h
@@ -8,16 +8,7 @@
 #ifndef _RTW_IO_H_
 #define _RTW_IO_H_
 
-/*
-	For prompt mode accessing, caller shall free io_req
-	Otherwise, io_handler will free io_req
-*/
-
-/* below is for the intf_option bit definition... */
-
-struct intf_priv;
 struct intf_hdl;
-struct io_queue;
 
 struct _io_ops {
 		u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
@@ -36,8 +27,6 @@ struct _io_ops {
 		void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
 		void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
 
-		void (*_sync_irp_protocol_rw)(struct io_queue *pio_q);
-
 		u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr);
 
 		u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
@@ -49,18 +38,6 @@ struct _io_ops {
 		void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
 };
 
-struct io_req {
-	struct list_head	list;
-	u32 addr;
-	volatile u32 val;
-	u32 command;
-	u32 status;
-	u8 *pbuf;
-
-	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt);
-	u8 *cnxt;
-};
-
 struct	intf_hdl {
 	struct adapter *padapter;
 	struct dvobj_priv *pintf_dev;/* 	pointer to &(padapter->dvobjpriv); */
@@ -74,21 +51,6 @@ struct	intf_hdl {
 int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj);
 void rtw_reset_continual_io_error(struct dvobj_priv *dvobj);
 
-/*
-Below is the data structure used by _io_handler
-
-*/
-
-struct io_queue {
-	spinlock_t	lock;
-	struct list_head	free_ioreqs;
-	struct list_head		pending;		/* The io_req list that will be served in the single protocol read/write. */
-	struct list_head		processing;
-	u8 *free_ioreqs_buf; /*  4-byte aligned */
-	u8 *pallocated_free_ioreqs_buf;
-	struct	intf_hdl	intf;
-};
-
 struct io_priv {
 
 	struct adapter *padapter;
@@ -97,20 +59,6 @@ struct io_priv {
 
 };
 
-extern uint ioreq_flush(struct adapter *adapter, struct io_queue *ioqueue);
-extern void sync_ioreq_enqueue(struct io_req *preq, struct io_queue *ioqueue);
-extern uint sync_ioreq_flush(struct adapter *adapter, struct io_queue *ioqueue);
-
-
-extern uint free_ioreq(struct io_req *preq, struct io_queue *pio_queue);
-extern struct io_req *alloc_ioreq(struct io_queue *pio_q);
-
-extern uint register_intf_hdl(u8 *dev, struct intf_hdl *pintfhdl);
-extern void unregister_intf_hdl(struct intf_hdl *pintfhdl);
-
-extern void _rtw_attrib_read(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
-extern void _rtw_attrib_write(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
-
 extern u8 rtw_read8(struct adapter *adapter, u32 addr);
 extern u16 rtw_read16(struct adapter *adapter, u32 addr);
 extern u32 rtw_read32(struct adapter *adapter, u32 addr);
@@ -121,46 +69,6 @@ extern int rtw_write32(struct adapter *adapter, u32 addr, u32 val);
 
 extern u32 rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
 
-extern void rtw_write_scsi(struct adapter *adapter, u32 cnt, u8 *pmem);
-
-/* ioreq */
-extern void ioreq_read8(struct adapter *adapter, u32 addr, u8 *pval);
-extern void ioreq_read16(struct adapter *adapter, u32 addr, u16 *pval);
-extern void ioreq_read32(struct adapter *adapter, u32 addr, u32 *pval);
-extern void ioreq_write8(struct adapter *adapter, u32 addr, u8 val);
-extern void ioreq_write16(struct adapter *adapter, u32 addr, u16 val);
-extern void ioreq_write32(struct adapter *adapter, u32 addr, u32 val);
-
-
-extern uint async_read8(struct adapter *adapter, u32 addr, u8 *pbuff,
-	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
-extern uint async_read16(struct adapter *adapter, u32 addr,  u8 *pbuff,
-	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
-extern uint async_read32(struct adapter *adapter, u32 addr,  u8 *pbuff,
-	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
-
-extern void async_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
-extern void async_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
-
-extern void async_write8(struct adapter *adapter, u32 addr, u8 val,
-	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
-extern void async_write16(struct adapter *adapter, u32 addr, u16 val,
-	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
-extern void async_write32(struct adapter *adapter, u32 addr, u32 val,
-	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
-
-extern void async_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
-extern void async_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
-
-
 int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapter *padapter, struct _io_ops *pops));
 
-
-extern uint alloc_io_queue(struct adapter *adapter);
-extern void free_io_queue(struct adapter *adapter);
-extern void async_bus_io(struct io_queue *pio_q);
-extern void bus_sync_io(struct io_queue *pio_q);
-extern u32 _ioreq2rwmem(struct io_queue *pio_q);
-extern void dev_power_down(struct adapter *Adapter, u8 bpwrup);
-
 #endif	/* _RTL8711_IO_H_ */
diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h
deleted file mode 100644
index 5a1cbd2ed851..000000000000
--- a/drivers/staging/rtl8723bs/include/rtw_mp.h
+++ /dev/null
@@ -1,341 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- ******************************************************************************/
-#ifndef _RTW_MP_H_
-#define _RTW_MP_H_
-
-#define MAX_MP_XMITBUF_SZ	2048
-
-struct mp_xmit_frame {
-	struct list_head	list;
-
-	struct pkt_attrib attrib;
-
-	struct sk_buff *pkt;
-
-	int frame_tag;
-
-	struct adapter *padapter;
-
-	uint mem[(MAX_MP_XMITBUF_SZ >> 2)];
-};
-
-struct mp_wiparam {
-	u32 bcompleted;
-	u32 act_type;
-	u32 io_offset;
-	u32 io_value;
-};
-
-struct mp_tx {
-	u8 stop;
-	u32 count, sended;
-	u8 payload;
-	struct pkt_attrib attrib;
-	/* struct tx_desc desc; */
-	/* u8 resvdtx[7]; */
-	u8 desc[TXDESC_SIZE];
-	u8 *pallocated_buf;
-	u8 *buf;
-	u32 buf_size, write_size;
-	void *PktTxThread;
-};
-
-#define MP_MAX_LINES		1000
-#define MP_MAX_LINES_BYTES	256
-
-typedef void (*MPT_WORK_ITEM_HANDLER)(void *Adapter);
-struct mpt_context {
-	/*  Indicate if we have started Mass Production Test. */
-	bool			bMassProdTest;
-
-	/*  Indicate if the driver is unloading or unloaded. */
-	bool			bMptDrvUnload;
-
-	struct timer_list			MPh2c_timeout_timer;
-/*  Event used to sync H2c for BT control */
-
-	bool		MptH2cRspEvent;
-	bool		MptBtC2hEvent;
-	bool		bMPh2c_timeout;
-
-	/* 8190 PCI does not support NDIS_WORK_ITEM. */
-	/*  Work Item for Mass Production Test. */
-	/* NDIS_WORK_ITEM	MptWorkItem; */
-/* 	RT_WORK_ITEM		MptWorkItem; */
-	/*  Event used to sync the case unloading driver and MptWorkItem is still in progress. */
-/* 	NDIS_EVENT		MptWorkItemEvent; */
-	/*  To protect the following variables. */
-/* 	NDIS_SPIN_LOCK		MptWorkItemSpinLock; */
-	/*  Indicate a MptWorkItem is scheduled and not yet finished. */
-	bool			bMptWorkItemInProgress;
-	/*  An instance which implements function and context of MptWorkItem. */
-	MPT_WORK_ITEM_HANDLER	CurrMptAct;
-
-	/*  1 =Start, 0 =Stop from UI. */
-	u32 		MptTestStart;
-	/*  _TEST_MODE, defined in MPT_Req2.h */
-	u32 		MptTestItem;
-	/*  Variable needed in each implementation of CurrMptAct. */
-	u32 		MptActType;	/*  Type of action performed in CurrMptAct. */
-	/*  The Offset of IO operation is depend of MptActType. */
-	u32 		MptIoOffset;
-	/*  The Value of IO operation is depend of MptActType. */
-	u32 		MptIoValue;
-	/*  The RfPath of IO operation is depend of MptActType. */
-	u32 		MptRfPath;
-
-	enum wireless_mode		MptWirelessModeToSw;	/*  Wireless mode to switch. */
-	u8 	MptChannelToSw;		/*  Channel to switch. */
-	u8 	MptInitGainToSet;	/*  Initial gain to set. */
-	u32 		MptBandWidth;		/*  bandwidth to switch. */
-	u32 		MptRateIndex;		/*  rate index. */
-	/*  Register value kept for Single Carrier Tx test. */
-	u8 	btMpCckTxPower;
-	/*  Register value kept for Single Carrier Tx test. */
-	u8 	btMpOfdmTxPower;
-	/*  For MP Tx Power index */
-	u8 	TxPwrLevel[2];	/*  rf-A, rf-B */
-	u32 		RegTxPwrLimit;
-	/*  Content of RCR Register for Mass Production Test. */
-	u32 		MptRCR;
-	/*  true if we only receive packets with specific pattern. */
-	bool			bMptFilterPattern;
-	/*  Rx OK count, statistics used in Mass Production Test. */
-	u32 		MptRxOkCnt;
-	/*  Rx CRC32 error count, statistics used in Mass Production Test. */
-	u32 		MptRxCrcErrCnt;
-
-	bool			bCckContTx;	/*  true if we are in CCK Continuous Tx test. */
-	bool			bOfdmContTx;	/*  true if we are in OFDM Continuous Tx test. */
-	bool			bStartContTx;	/*  true if we have start Continuous Tx test. */
-	/*  true if we are in Single Carrier Tx test. */
-	bool			bSingleCarrier;
-	/*  true if we are in Carrier Suppression Tx Test. */
-	bool			bCarrierSuppression;
-	/* true if we are in Single Tone Tx test. */
-	bool			bSingleTone;
-
-	/*  ACK counter asked by K.Y.. */
-	bool			bMptEnableAckCounter;
-	u32 		MptAckCounter;
-
-	/*  SD3 Willis For 8192S to save 1T/2T RF table for ACUT	Only fro ACUT delete later ~~~! */
-	/* s8		BufOfLines[2][MAX_LINES_HWCONFIG_TXT][MAX_BYTES_LINE_HWCONFIG_TXT]; */
-	/* s8			BufOfLines[2][MP_MAX_LINES][MP_MAX_LINES_BYTES]; */
-	/* s32			RfReadLine[2]; */
-
-	u8 APK_bound[2];	/* for APK	path A/path B */
-	bool		bMptIndexEven;
-
-	u8 backup0xc50;
-	u8 backup0xc58;
-	u8 backup0xc30;
-	u8 backup0x52_RF_A;
-	u8 backup0x52_RF_B;
-
-	u32 		backup0x58_RF_A;
-	u32 		backup0x58_RF_B;
-
-	u8 	h2cReqNum;
-	u8 	c2hBuf[32];
-
-    u8          btInBuf[100];
-	u32 		mptOutLen;
-    u8          mptOutBuf[100];
-
-};
-/* endif */
-
-/* define RTPRIV_IOCTL_MP					(SIOCIWFIRSTPRIV + 0x17) */
-enum {
-	WRITE_REG = 1,
-	READ_REG,
-	WRITE_RF,
-	READ_RF,
-	MP_START,
-	MP_STOP,
-	MP_RATE,
-	MP_CHANNEL,
-	MP_BANDWIDTH,
-	MP_TXPOWER,
-	MP_ANT_TX,
-	MP_ANT_RX,
-	MP_CTX,
-	MP_QUERY,
-	MP_ARX,
-	MP_PSD,
-	MP_PWRTRK,
-	MP_THER,
-	MP_IOCTL,
-	EFUSE_GET,
-	EFUSE_SET,
-	MP_RESET_STATS,
-	MP_DUMP,
-	MP_PHYPARA,
-	MP_SetRFPathSwh,
-	MP_QueryDrvStats,
-	MP_SetBT,
-	CTA_TEST,
-	MP_DISABLE_BT_COEXIST,
-	MP_PwrCtlDM,
-	MP_NULL,
-	MP_GET_TXPOWER_INX,
-};
-
-struct mp_priv {
-	struct adapter *papdater;
-
-	/* Testing Flag */
-	u32 mode;/* 0 for normal type packet, 1 for loopback packet (16bytes TXCMD) */
-
-	u32 prev_fw_state;
-
-	/* OID cmd handler */
-	struct mp_wiparam workparam;
-/* 	u8 act_in_progress; */
-
-	/* Tx Section */
-	u8 TID;
-	u32 tx_pktcount;
-	u32 pktInterval;
-	struct mp_tx tx;
-
-	/* Rx Section */
-	u32 rx_bssidpktcount;
-	u32 rx_pktcount;
-	u32 rx_pktcount_filter_out;
-	u32 rx_crcerrpktcount;
-	u32 rx_pktloss;
-	bool  rx_bindicatePkt;
-	struct recv_stat rxstat;
-
-	/* RF/BB relative */
-	u8 channel;
-	u8 bandwidth;
-	u8 prime_channel_offset;
-	u8 txpoweridx;
-	u8 txpoweridx_b;
-	u8 rateidx;
-	u32 preamble;
-/* 	u8 modem; */
-	u32 CrystalCap;
-/* 	u32 curr_crystalcap; */
-
-	u16 antenna_tx;
-	u16 antenna_rx;
-/* 	u8 curr_rfpath; */
-
-	u8 check_mp_pkt;
-
-	u8 bSetTxPower;
-/* 	uint ForcedDataRate; */
-	u8 mp_dm;
-	u8 mac_filter[ETH_ALEN];
-	u8 bmac_filter;
-
-	struct wlan_network mp_network;
-	NDIS_802_11_MAC_ADDRESS network_macaddr;
-
-	u8 *pallocated_mp_xmitframe_buf;
-	u8 *pmp_xmtframe_buf;
-	struct __queue free_mp_xmitqueue;
-	u32 free_mp_xmitframe_cnt;
-	bool bSetRxBssid;
-	bool bTxBufCkFail;
-
-	struct mpt_context MptCtx;
-
-	u8 *TXradomBuffer;
-};
-
-/* Hardware Registers */
-extern u8 mpdatarate[NumRates];
-
-#define MAX_TX_PWR_INDEX_N_MODE 64	/*  0x3F */
-
-#define		REG_RF_BB_GAIN_OFFSET	0x7f
-#define		RF_GAIN_OFFSET_MASK	0xfffff
-
-/*  */
-/* struct mp_xmit_frame *alloc_mp_xmitframe(struct mp_priv *pmp_priv); */
-/* int free_mp_xmitframe(struct xmit_priv *pxmitpriv, struct mp_xmit_frame *pmp_xmitframe); */
-
-s32 init_mp_priv(struct adapter *padapter);
-void free_mp_priv(struct mp_priv *pmp_priv);
-s32 MPT_InitializeAdapter(struct adapter *padapter, u8 Channel);
-void MPT_DeInitAdapter(struct adapter *padapter);
-s32 mp_start_test(struct adapter *padapter);
-void mp_stop_test(struct adapter *padapter);
-
-u32 _read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask);
-void _write_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask, u32 val);
-
-u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz);
-void write_macreg(struct adapter *padapter, u32 addr, u32 val, u32 sz);
-
-void SetChannel(struct adapter *padapter);
-void SetBandwidth(struct adapter *padapter);
-int SetTxPower(struct adapter *padapter);
-void SetAntennaPathPower(struct adapter *padapter);
-void SetDataRate(struct adapter *padapter);
-
-void SetAntenna(struct adapter *padapter);
-
-s32 SetThermalMeter(struct adapter *padapter, u8 target_ther);
-void GetThermalMeter(struct adapter *padapter, u8 *value);
-
-void SetContinuousTx(struct adapter *padapter, u8 bStart);
-void SetSingleCarrierTx(struct adapter *padapter, u8 bStart);
-void SetSingleToneTx(struct adapter *padapter, u8 bStart);
-void SetCarrierSuppressionTx(struct adapter *padapter, u8 bStart);
-void PhySetTxPowerLevel(struct adapter *padapter);
-
-void fill_txdesc_for_mp(struct adapter *padapter, u8 *ptxdesc);
-void SetPacketTx(struct adapter *padapter);
-void SetPacketRx(struct adapter *padapter, u8 bStartRx);
-
-void ResetPhyRxPktCount(struct adapter *padapter);
-u32 GetPhyRxPktReceived(struct adapter *padapter);
-u32 GetPhyRxPktCRC32Error(struct adapter *padapter);
-
-s32	SetPowerTracking(struct adapter *padapter, u8 enable);
-void GetPowerTracking(struct adapter *padapter, u8 *enable);
-
-u32 mp_query_psd(struct adapter *padapter, u8 *data);
-
-void Hal_SetAntenna(struct adapter *padapter);
-void Hal_SetBandwidth(struct adapter *padapter);
-
-void Hal_SetTxPower(struct adapter *padapter);
-void Hal_SetCarrierSuppressionTx(struct adapter *padapter, u8 bStart);
-void Hal_SetSingleToneTx(struct adapter *padapter, u8 bStart);
-void Hal_SetSingleCarrierTx(struct adapter *padapter, u8 bStart);
-void Hal_SetContinuousTx(struct adapter *padapter, u8 bStart);
-
-void Hal_SetDataRate(struct adapter *padapter);
-void Hal_SetChannel(struct adapter *padapter);
-void Hal_SetAntennaPathPower(struct adapter *padapter);
-s32 Hal_SetThermalMeter(struct adapter *padapter, u8 target_ther);
-s32 Hal_SetPowerTracking(struct adapter *padapter, u8 enable);
-void Hal_GetPowerTracking(struct adapter *padapter, u8 *enable);
-void Hal_GetThermalMeter(struct adapter *padapter, u8 *value);
-void Hal_mpt_SwitchRfSetting(struct adapter *padapter);
-void Hal_MPT_CCKTxPowerAdjust(struct adapter *Adapter, bool bInCH14);
-void Hal_MPT_CCKTxPowerAdjustbyIndex(struct adapter *padapter, bool beven);
-void Hal_SetCCKTxPower(struct adapter *padapter, u8 *TxPower);
-void Hal_SetOFDMTxPower(struct adapter *padapter, u8 *TxPower);
-void Hal_TriggerRFThermalMeter(struct adapter *padapter);
-u8 Hal_ReadRFThermalMeter(struct adapter *padapter);
-void Hal_SetCCKContinuousTx(struct adapter *padapter, u8 bStart);
-void Hal_SetOFDMContinuousTx(struct adapter *padapter, u8 bStart);
-void Hal_ProSetCrystalCap(struct adapter *padapter, u32 CrystalCapVal);
-void MP_PHY_SetRFPathSwitch(struct adapter *padapter, bool bMain);
-u32 mpt_ProQueryCalTxPower(struct adapter *padapter, u8 RfPath);
-void MPT_PwrCtlDM(struct adapter *padapter, u32 bstart);
-u8 MptToMgntRate(u32 MptRateIdx);
-
-#endif /* _RTW_MP_H_ */
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 738a601c55bb..de48c3454ab3 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -724,8 +724,6 @@ u8 rtw_free_drv_sw(struct adapter *padapter)
 
 	rtw_free_mlme_priv(&padapter->mlmepriv);
 
-	/* free_io_queue(padapter); */
-
 	_rtw_free_xmit_priv(&padapter->xmitpriv);
 
 	_rtw_free_sta_priv(&padapter->stapriv); /* will free bcmc_stainfo here */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: rtl8723bs: Remove some unused functions, macros, and structs
  2025-02-22 19:03     ` [PATCH] staging: rtl8723bs: Remove some unused functions, macros, and structs Yeking
@ 2025-02-24  8:53       ` Hans de Goede
  0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2025-02-24  8:53 UTC (permalink / raw)
  To: Yeking
  Cc: arnd, dan.carpenter, gregkh, johannes.berg, justinstitt,
	linux-kernel, linux-staging, masahiroy, nicolas,
	philipp.g.hortmann, rodrigo.gobbi.7, Roshan Khatri

Hi,

On 22-Feb-25 8:03 PM, Yeking@Red54.com wrote:
> From: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>
> 
> Remove some functions, macros, and structs that have not been used since
> they were introduced in commit 554c0a3abf21 ("staging: Add rtl8723bs
> sdio wifi driver").
> 
> Signed-off-by: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  drivers/staging/rtl8723bs/hal/hal_com.c       |   3 +
>  .../staging/rtl8723bs/include/osdep_intf.h    |  27 --
>  .../staging/rtl8723bs/include/rtl8723b_hal.h  |   1 -
>  drivers/staging/rtl8723bs/include/rtw_io.h    |  92 -----
>  drivers/staging/rtl8723bs/include/rtw_mp.h    | 341 ------------------
>  drivers/staging/rtl8723bs/os_dep/os_intfs.c   |   2 -
>  6 files changed, 3 insertions(+), 463 deletions(-)
>  delete mode 100644 drivers/staging/rtl8723bs/include/rtw_mp.h
> 
> diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
> index b41ec89932af..1213a91cffff 100644
> --- a/drivers/staging/rtl8723bs/hal/hal_com.c
> +++ b/drivers/staging/rtl8723bs/hal/hal_com.c
> @@ -884,6 +884,9 @@ static u32 Array_kfreemap[] = {
>  	0xfc, 0x0,
>  };
>  
> +#define		REG_RF_BB_GAIN_OFFSET	0x7f
> +//#define		RF_GAIN_OFFSET_MASK	0xfffff
> +
>  void rtw_bb_rf_gain_offset(struct adapter *padapter)
>  {
>  	u8 value = padapter->eeprompriv.EEPROMRFGainOffset;
> diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h
> index 73199be78139..83a25598e962 100644
> --- a/drivers/staging/rtl8723bs/include/osdep_intf.h
> +++ b/drivers/staging/rtl8723bs/include/osdep_intf.h
> @@ -8,33 +8,6 @@
>  #ifndef __OSDEP_INTF_H_
>  #define __OSDEP_INTF_H_
>  
> -
> -struct intf_priv {
> -
> -	u8 *intf_dev;
> -	u32 max_iosz;	/* USB2.0: 128, USB1.1: 64, SDIO:64 */
> -	u32 max_xmitsz; /* USB2.0: unlimited, SDIO:512 */
> -	u32 max_recvsz; /* USB2.0: unlimited, SDIO:512 */
> -
> -	volatile u8 *io_rwmem;
> -	volatile u8 *allocated_io_rwmem;
> -	u32 io_wsz; /* unit: 4bytes */
> -	u32 io_rsz;/* unit: 4bytes */
> -	u8 intf_status;
> -
> -	void (*_bus_io)(u8 *priv);
> -
> -/*
> -Under Sync. IRP (SDIO/USB)
> -A protection mechanism is necessary for the io_rwmem(read/write protocol)
> -
> -Under Async. IRP (SDIO/USB)
> -The protection mechanism is through the pending queue.
> -*/
> -
> -	struct mutex ioctl_mutex;
> -};
> -
>  struct dvobj_priv *devobj_init(void);
>  void devobj_deinit(struct dvobj_priv *pdvobj);
>  
> diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
> index e6d6e9de5474..a4a14474c35d 100644
> --- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
> +++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
> @@ -15,7 +15,6 @@
>  #include "rtl8723b_recv.h"
>  #include "rtl8723b_xmit.h"
>  #include "rtl8723b_cmd.h"
> -#include "rtw_mp.h"
>  #include "hal_pwr_seq.h"
>  #include "Hal8192CPhyReg.h"
>  #include "hal_phy_cfg.h"
> diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
> index 0ee87be6dc4f..adf1de4d7924 100644
> --- a/drivers/staging/rtl8723bs/include/rtw_io.h
> +++ b/drivers/staging/rtl8723bs/include/rtw_io.h
> @@ -8,16 +8,7 @@
>  #ifndef _RTW_IO_H_
>  #define _RTW_IO_H_
>  
> -/*
> -	For prompt mode accessing, caller shall free io_req
> -	Otherwise, io_handler will free io_req
> -*/
> -
> -/* below is for the intf_option bit definition... */
> -
> -struct intf_priv;
>  struct intf_hdl;
> -struct io_queue;
>  
>  struct _io_ops {
>  		u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
> @@ -36,8 +27,6 @@ struct _io_ops {
>  		void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
>  		void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
>  
> -		void (*_sync_irp_protocol_rw)(struct io_queue *pio_q);
> -
>  		u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr);
>  
>  		u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
> @@ -49,18 +38,6 @@ struct _io_ops {
>  		void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
>  };
>  
> -struct io_req {
> -	struct list_head	list;
> -	u32 addr;
> -	volatile u32 val;
> -	u32 command;
> -	u32 status;
> -	u8 *pbuf;
> -
> -	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt);
> -	u8 *cnxt;
> -};
> -
>  struct	intf_hdl {
>  	struct adapter *padapter;
>  	struct dvobj_priv *pintf_dev;/* 	pointer to &(padapter->dvobjpriv); */
> @@ -74,21 +51,6 @@ struct	intf_hdl {
>  int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj);
>  void rtw_reset_continual_io_error(struct dvobj_priv *dvobj);
>  
> -/*
> -Below is the data structure used by _io_handler
> -
> -*/
> -
> -struct io_queue {
> -	spinlock_t	lock;
> -	struct list_head	free_ioreqs;
> -	struct list_head		pending;		/* The io_req list that will be served in the single protocol read/write. */
> -	struct list_head		processing;
> -	u8 *free_ioreqs_buf; /*  4-byte aligned */
> -	u8 *pallocated_free_ioreqs_buf;
> -	struct	intf_hdl	intf;
> -};
> -
>  struct io_priv {
>  
>  	struct adapter *padapter;
> @@ -97,20 +59,6 @@ struct io_priv {
>  
>  };
>  
> -extern uint ioreq_flush(struct adapter *adapter, struct io_queue *ioqueue);
> -extern void sync_ioreq_enqueue(struct io_req *preq, struct io_queue *ioqueue);
> -extern uint sync_ioreq_flush(struct adapter *adapter, struct io_queue *ioqueue);
> -
> -
> -extern uint free_ioreq(struct io_req *preq, struct io_queue *pio_queue);
> -extern struct io_req *alloc_ioreq(struct io_queue *pio_q);
> -
> -extern uint register_intf_hdl(u8 *dev, struct intf_hdl *pintfhdl);
> -extern void unregister_intf_hdl(struct intf_hdl *pintfhdl);
> -
> -extern void _rtw_attrib_read(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
> -extern void _rtw_attrib_write(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
> -
>  extern u8 rtw_read8(struct adapter *adapter, u32 addr);
>  extern u16 rtw_read16(struct adapter *adapter, u32 addr);
>  extern u32 rtw_read32(struct adapter *adapter, u32 addr);
> @@ -121,46 +69,6 @@ extern int rtw_write32(struct adapter *adapter, u32 addr, u32 val);
>  
>  extern u32 rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
>  
> -extern void rtw_write_scsi(struct adapter *adapter, u32 cnt, u8 *pmem);
> -
> -/* ioreq */
> -extern void ioreq_read8(struct adapter *adapter, u32 addr, u8 *pval);
> -extern void ioreq_read16(struct adapter *adapter, u32 addr, u16 *pval);
> -extern void ioreq_read32(struct adapter *adapter, u32 addr, u32 *pval);
> -extern void ioreq_write8(struct adapter *adapter, u32 addr, u8 val);
> -extern void ioreq_write16(struct adapter *adapter, u32 addr, u16 val);
> -extern void ioreq_write32(struct adapter *adapter, u32 addr, u32 val);
> -
> -
> -extern uint async_read8(struct adapter *adapter, u32 addr, u8 *pbuff,
> -	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
> -extern uint async_read16(struct adapter *adapter, u32 addr,  u8 *pbuff,
> -	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
> -extern uint async_read32(struct adapter *adapter, u32 addr,  u8 *pbuff,
> -	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
> -
> -extern void async_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
> -extern void async_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
> -
> -extern void async_write8(struct adapter *adapter, u32 addr, u8 val,
> -	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
> -extern void async_write16(struct adapter *adapter, u32 addr, u16 val,
> -	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
> -extern void async_write32(struct adapter *adapter, u32 addr, u32 val,
> -	void (*_async_io_callback)(struct adapter *padater, struct io_req *pio_req, u8 *cnxt), u8 *cnxt);
> -
> -extern void async_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
> -extern void async_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
> -
> -
>  int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapter *padapter, struct _io_ops *pops));
>  
> -
> -extern uint alloc_io_queue(struct adapter *adapter);
> -extern void free_io_queue(struct adapter *adapter);
> -extern void async_bus_io(struct io_queue *pio_q);
> -extern void bus_sync_io(struct io_queue *pio_q);
> -extern u32 _ioreq2rwmem(struct io_queue *pio_q);
> -extern void dev_power_down(struct adapter *Adapter, u8 bpwrup);
> -
>  #endif	/* _RTL8711_IO_H_ */
> diff --git a/drivers/staging/rtl8723bs/include/rtw_mp.h b/drivers/staging/rtl8723bs/include/rtw_mp.h
> deleted file mode 100644
> index 5a1cbd2ed851..000000000000
> --- a/drivers/staging/rtl8723bs/include/rtw_mp.h
> +++ /dev/null
> @@ -1,341 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/******************************************************************************
> - *
> - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
> - *
> - ******************************************************************************/
> -#ifndef _RTW_MP_H_
> -#define _RTW_MP_H_
> -
> -#define MAX_MP_XMITBUF_SZ	2048
> -
> -struct mp_xmit_frame {
> -	struct list_head	list;
> -
> -	struct pkt_attrib attrib;
> -
> -	struct sk_buff *pkt;
> -
> -	int frame_tag;
> -
> -	struct adapter *padapter;
> -
> -	uint mem[(MAX_MP_XMITBUF_SZ >> 2)];
> -};
> -
> -struct mp_wiparam {
> -	u32 bcompleted;
> -	u32 act_type;
> -	u32 io_offset;
> -	u32 io_value;
> -};
> -
> -struct mp_tx {
> -	u8 stop;
> -	u32 count, sended;
> -	u8 payload;
> -	struct pkt_attrib attrib;
> -	/* struct tx_desc desc; */
> -	/* u8 resvdtx[7]; */
> -	u8 desc[TXDESC_SIZE];
> -	u8 *pallocated_buf;
> -	u8 *buf;
> -	u32 buf_size, write_size;
> -	void *PktTxThread;
> -};
> -
> -#define MP_MAX_LINES		1000
> -#define MP_MAX_LINES_BYTES	256
> -
> -typedef void (*MPT_WORK_ITEM_HANDLER)(void *Adapter);
> -struct mpt_context {
> -	/*  Indicate if we have started Mass Production Test. */
> -	bool			bMassProdTest;
> -
> -	/*  Indicate if the driver is unloading or unloaded. */
> -	bool			bMptDrvUnload;
> -
> -	struct timer_list			MPh2c_timeout_timer;
> -/*  Event used to sync H2c for BT control */
> -
> -	bool		MptH2cRspEvent;
> -	bool		MptBtC2hEvent;
> -	bool		bMPh2c_timeout;
> -
> -	/* 8190 PCI does not support NDIS_WORK_ITEM. */
> -	/*  Work Item for Mass Production Test. */
> -	/* NDIS_WORK_ITEM	MptWorkItem; */
> -/* 	RT_WORK_ITEM		MptWorkItem; */
> -	/*  Event used to sync the case unloading driver and MptWorkItem is still in progress. */
> -/* 	NDIS_EVENT		MptWorkItemEvent; */
> -	/*  To protect the following variables. */
> -/* 	NDIS_SPIN_LOCK		MptWorkItemSpinLock; */
> -	/*  Indicate a MptWorkItem is scheduled and not yet finished. */
> -	bool			bMptWorkItemInProgress;
> -	/*  An instance which implements function and context of MptWorkItem. */
> -	MPT_WORK_ITEM_HANDLER	CurrMptAct;
> -
> -	/*  1 =Start, 0 =Stop from UI. */
> -	u32 		MptTestStart;
> -	/*  _TEST_MODE, defined in MPT_Req2.h */
> -	u32 		MptTestItem;
> -	/*  Variable needed in each implementation of CurrMptAct. */
> -	u32 		MptActType;	/*  Type of action performed in CurrMptAct. */
> -	/*  The Offset of IO operation is depend of MptActType. */
> -	u32 		MptIoOffset;
> -	/*  The Value of IO operation is depend of MptActType. */
> -	u32 		MptIoValue;
> -	/*  The RfPath of IO operation is depend of MptActType. */
> -	u32 		MptRfPath;
> -
> -	enum wireless_mode		MptWirelessModeToSw;	/*  Wireless mode to switch. */
> -	u8 	MptChannelToSw;		/*  Channel to switch. */
> -	u8 	MptInitGainToSet;	/*  Initial gain to set. */
> -	u32 		MptBandWidth;		/*  bandwidth to switch. */
> -	u32 		MptRateIndex;		/*  rate index. */
> -	/*  Register value kept for Single Carrier Tx test. */
> -	u8 	btMpCckTxPower;
> -	/*  Register value kept for Single Carrier Tx test. */
> -	u8 	btMpOfdmTxPower;
> -	/*  For MP Tx Power index */
> -	u8 	TxPwrLevel[2];	/*  rf-A, rf-B */
> -	u32 		RegTxPwrLimit;
> -	/*  Content of RCR Register for Mass Production Test. */
> -	u32 		MptRCR;
> -	/*  true if we only receive packets with specific pattern. */
> -	bool			bMptFilterPattern;
> -	/*  Rx OK count, statistics used in Mass Production Test. */
> -	u32 		MptRxOkCnt;
> -	/*  Rx CRC32 error count, statistics used in Mass Production Test. */
> -	u32 		MptRxCrcErrCnt;
> -
> -	bool			bCckContTx;	/*  true if we are in CCK Continuous Tx test. */
> -	bool			bOfdmContTx;	/*  true if we are in OFDM Continuous Tx test. */
> -	bool			bStartContTx;	/*  true if we have start Continuous Tx test. */
> -	/*  true if we are in Single Carrier Tx test. */
> -	bool			bSingleCarrier;
> -	/*  true if we are in Carrier Suppression Tx Test. */
> -	bool			bCarrierSuppression;
> -	/* true if we are in Single Tone Tx test. */
> -	bool			bSingleTone;
> -
> -	/*  ACK counter asked by K.Y.. */
> -	bool			bMptEnableAckCounter;
> -	u32 		MptAckCounter;
> -
> -	/*  SD3 Willis For 8192S to save 1T/2T RF table for ACUT	Only fro ACUT delete later ~~~! */
> -	/* s8		BufOfLines[2][MAX_LINES_HWCONFIG_TXT][MAX_BYTES_LINE_HWCONFIG_TXT]; */
> -	/* s8			BufOfLines[2][MP_MAX_LINES][MP_MAX_LINES_BYTES]; */
> -	/* s32			RfReadLine[2]; */
> -
> -	u8 APK_bound[2];	/* for APK	path A/path B */
> -	bool		bMptIndexEven;
> -
> -	u8 backup0xc50;
> -	u8 backup0xc58;
> -	u8 backup0xc30;
> -	u8 backup0x52_RF_A;
> -	u8 backup0x52_RF_B;
> -
> -	u32 		backup0x58_RF_A;
> -	u32 		backup0x58_RF_B;
> -
> -	u8 	h2cReqNum;
> -	u8 	c2hBuf[32];
> -
> -    u8          btInBuf[100];
> -	u32 		mptOutLen;
> -    u8          mptOutBuf[100];
> -
> -};
> -/* endif */
> -
> -/* define RTPRIV_IOCTL_MP					(SIOCIWFIRSTPRIV + 0x17) */
> -enum {
> -	WRITE_REG = 1,
> -	READ_REG,
> -	WRITE_RF,
> -	READ_RF,
> -	MP_START,
> -	MP_STOP,
> -	MP_RATE,
> -	MP_CHANNEL,
> -	MP_BANDWIDTH,
> -	MP_TXPOWER,
> -	MP_ANT_TX,
> -	MP_ANT_RX,
> -	MP_CTX,
> -	MP_QUERY,
> -	MP_ARX,
> -	MP_PSD,
> -	MP_PWRTRK,
> -	MP_THER,
> -	MP_IOCTL,
> -	EFUSE_GET,
> -	EFUSE_SET,
> -	MP_RESET_STATS,
> -	MP_DUMP,
> -	MP_PHYPARA,
> -	MP_SetRFPathSwh,
> -	MP_QueryDrvStats,
> -	MP_SetBT,
> -	CTA_TEST,
> -	MP_DISABLE_BT_COEXIST,
> -	MP_PwrCtlDM,
> -	MP_NULL,
> -	MP_GET_TXPOWER_INX,
> -};
> -
> -struct mp_priv {
> -	struct adapter *papdater;
> -
> -	/* Testing Flag */
> -	u32 mode;/* 0 for normal type packet, 1 for loopback packet (16bytes TXCMD) */
> -
> -	u32 prev_fw_state;
> -
> -	/* OID cmd handler */
> -	struct mp_wiparam workparam;
> -/* 	u8 act_in_progress; */
> -
> -	/* Tx Section */
> -	u8 TID;
> -	u32 tx_pktcount;
> -	u32 pktInterval;
> -	struct mp_tx tx;
> -
> -	/* Rx Section */
> -	u32 rx_bssidpktcount;
> -	u32 rx_pktcount;
> -	u32 rx_pktcount_filter_out;
> -	u32 rx_crcerrpktcount;
> -	u32 rx_pktloss;
> -	bool  rx_bindicatePkt;
> -	struct recv_stat rxstat;
> -
> -	/* RF/BB relative */
> -	u8 channel;
> -	u8 bandwidth;
> -	u8 prime_channel_offset;
> -	u8 txpoweridx;
> -	u8 txpoweridx_b;
> -	u8 rateidx;
> -	u32 preamble;
> -/* 	u8 modem; */
> -	u32 CrystalCap;
> -/* 	u32 curr_crystalcap; */
> -
> -	u16 antenna_tx;
> -	u16 antenna_rx;
> -/* 	u8 curr_rfpath; */
> -
> -	u8 check_mp_pkt;
> -
> -	u8 bSetTxPower;
> -/* 	uint ForcedDataRate; */
> -	u8 mp_dm;
> -	u8 mac_filter[ETH_ALEN];
> -	u8 bmac_filter;
> -
> -	struct wlan_network mp_network;
> -	NDIS_802_11_MAC_ADDRESS network_macaddr;
> -
> -	u8 *pallocated_mp_xmitframe_buf;
> -	u8 *pmp_xmtframe_buf;
> -	struct __queue free_mp_xmitqueue;
> -	u32 free_mp_xmitframe_cnt;
> -	bool bSetRxBssid;
> -	bool bTxBufCkFail;
> -
> -	struct mpt_context MptCtx;
> -
> -	u8 *TXradomBuffer;
> -};
> -
> -/* Hardware Registers */
> -extern u8 mpdatarate[NumRates];
> -
> -#define MAX_TX_PWR_INDEX_N_MODE 64	/*  0x3F */
> -
> -#define		REG_RF_BB_GAIN_OFFSET	0x7f
> -#define		RF_GAIN_OFFSET_MASK	0xfffff
> -
> -/*  */
> -/* struct mp_xmit_frame *alloc_mp_xmitframe(struct mp_priv *pmp_priv); */
> -/* int free_mp_xmitframe(struct xmit_priv *pxmitpriv, struct mp_xmit_frame *pmp_xmitframe); */
> -
> -s32 init_mp_priv(struct adapter *padapter);
> -void free_mp_priv(struct mp_priv *pmp_priv);
> -s32 MPT_InitializeAdapter(struct adapter *padapter, u8 Channel);
> -void MPT_DeInitAdapter(struct adapter *padapter);
> -s32 mp_start_test(struct adapter *padapter);
> -void mp_stop_test(struct adapter *padapter);
> -
> -u32 _read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask);
> -void _write_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask, u32 val);
> -
> -u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz);
> -void write_macreg(struct adapter *padapter, u32 addr, u32 val, u32 sz);
> -
> -void SetChannel(struct adapter *padapter);
> -void SetBandwidth(struct adapter *padapter);
> -int SetTxPower(struct adapter *padapter);
> -void SetAntennaPathPower(struct adapter *padapter);
> -void SetDataRate(struct adapter *padapter);
> -
> -void SetAntenna(struct adapter *padapter);
> -
> -s32 SetThermalMeter(struct adapter *padapter, u8 target_ther);
> -void GetThermalMeter(struct adapter *padapter, u8 *value);
> -
> -void SetContinuousTx(struct adapter *padapter, u8 bStart);
> -void SetSingleCarrierTx(struct adapter *padapter, u8 bStart);
> -void SetSingleToneTx(struct adapter *padapter, u8 bStart);
> -void SetCarrierSuppressionTx(struct adapter *padapter, u8 bStart);
> -void PhySetTxPowerLevel(struct adapter *padapter);
> -
> -void fill_txdesc_for_mp(struct adapter *padapter, u8 *ptxdesc);
> -void SetPacketTx(struct adapter *padapter);
> -void SetPacketRx(struct adapter *padapter, u8 bStartRx);
> -
> -void ResetPhyRxPktCount(struct adapter *padapter);
> -u32 GetPhyRxPktReceived(struct adapter *padapter);
> -u32 GetPhyRxPktCRC32Error(struct adapter *padapter);
> -
> -s32	SetPowerTracking(struct adapter *padapter, u8 enable);
> -void GetPowerTracking(struct adapter *padapter, u8 *enable);
> -
> -u32 mp_query_psd(struct adapter *padapter, u8 *data);
> -
> -void Hal_SetAntenna(struct adapter *padapter);
> -void Hal_SetBandwidth(struct adapter *padapter);
> -
> -void Hal_SetTxPower(struct adapter *padapter);
> -void Hal_SetCarrierSuppressionTx(struct adapter *padapter, u8 bStart);
> -void Hal_SetSingleToneTx(struct adapter *padapter, u8 bStart);
> -void Hal_SetSingleCarrierTx(struct adapter *padapter, u8 bStart);
> -void Hal_SetContinuousTx(struct adapter *padapter, u8 bStart);
> -
> -void Hal_SetDataRate(struct adapter *padapter);
> -void Hal_SetChannel(struct adapter *padapter);
> -void Hal_SetAntennaPathPower(struct adapter *padapter);
> -s32 Hal_SetThermalMeter(struct adapter *padapter, u8 target_ther);
> -s32 Hal_SetPowerTracking(struct adapter *padapter, u8 enable);
> -void Hal_GetPowerTracking(struct adapter *padapter, u8 *enable);
> -void Hal_GetThermalMeter(struct adapter *padapter, u8 *value);
> -void Hal_mpt_SwitchRfSetting(struct adapter *padapter);
> -void Hal_MPT_CCKTxPowerAdjust(struct adapter *Adapter, bool bInCH14);
> -void Hal_MPT_CCKTxPowerAdjustbyIndex(struct adapter *padapter, bool beven);
> -void Hal_SetCCKTxPower(struct adapter *padapter, u8 *TxPower);
> -void Hal_SetOFDMTxPower(struct adapter *padapter, u8 *TxPower);
> -void Hal_TriggerRFThermalMeter(struct adapter *padapter);
> -u8 Hal_ReadRFThermalMeter(struct adapter *padapter);
> -void Hal_SetCCKContinuousTx(struct adapter *padapter, u8 bStart);
> -void Hal_SetOFDMContinuousTx(struct adapter *padapter, u8 bStart);
> -void Hal_ProSetCrystalCap(struct adapter *padapter, u32 CrystalCapVal);
> -void MP_PHY_SetRFPathSwitch(struct adapter *padapter, bool bMain);
> -u32 mpt_ProQueryCalTxPower(struct adapter *padapter, u8 RfPath);
> -void MPT_PwrCtlDM(struct adapter *padapter, u32 bstart);
> -u8 MptToMgntRate(u32 MptRateIdx);
> -
> -#endif /* _RTW_MP_H_ */
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 738a601c55bb..de48c3454ab3 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -724,8 +724,6 @@ u8 rtw_free_drv_sw(struct adapter *padapter)
>  
>  	rtw_free_mlme_priv(&padapter->mlmepriv);
>  
> -	/* free_io_queue(padapter); */
> -
>  	_rtw_free_xmit_priv(&padapter->xmitpriv);
>  
>  	_rtw_free_sta_priv(&padapter->stapriv); /* will free bcmc_stainfo here */


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-24  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-09 13:20 [PATCH] staging: rtl8723bs: Remove ioctl interface Yeking
2025-01-09 20:31 ` Philipp Hortmann
2025-01-09 21:19 ` Arnd Bergmann
2025-01-10 13:10   ` Yeking
2025-02-22 19:03     ` [PATCH] staging: rtl8723bs: Remove some unused functions, macros, and structs Yeking
2025-02-24  8:53       ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox