rtl8188eu: Make this code look exactly like the code in the kernel version

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-11-29 16:10:20 -06:00
parent 9ac6886fe0
commit 91938194fd
43 changed files with 182 additions and 845 deletions

View file

@ -938,7 +938,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,
memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN);
if (pPMK->cmd == IW_PMKSA_ADD) {
DBG_88E("[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n");
if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN) == true)
if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN))
return ret;
else
ret = true;
@ -1039,7 +1039,7 @@ static int rtw_wx_get_range(struct net_device *dev,
range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */
/* TODO: Find real 'good' to 'bad' threshol value for RSSI */
range->avg_qual.level = 20 + -98;
range->avg_qual.level = 178; /* -78 dBm */
range->avg_qual.noise = 0;
range->avg_qual.updated = 7; /* Updated all three */
@ -1074,7 +1074,7 @@ static int rtw_wx_get_range(struct net_device *dev,
/* The following code will proivde the security capability to network manager. */
/* If the driver doesn't provide this capability to network manager, */
/* the WPA/WPA2 routers can't be choosen in the network manager. */
/* the WPA/WPA2 routers can't be chosen in the network manager. */
/*
#define IW_SCAN_CAPA_NONE 0x00
@ -1373,7 +1373,7 @@ _func_enter_;
}
}
/* it has still some scan paramater to parse, we only do this now... */
/* it has still some scan parameter to parse, we only do this now... */
_status = rtw_set_802_11_bssid_list_scan(padapter, ssid, RTW_SSID_SCAN_AMOUNT);
} else {
_status = rtw_set_802_11_bssid_list_scan(padapter, NULL, 0);
@ -2626,7 +2626,7 @@ static int rtw_get_ap_info(struct net_device *dev,
return -EINVAL;
}
if (!memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN) == true) {
if (!memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN)) {
/* BSSID match, then check if supporting wpa/wpa2 */
DBG_88E("BSSID:%pM\n", (bssid));
@ -2961,7 +2961,7 @@ static int rtw_p2p_get_status(struct net_device *dev,
/* Commented by Albert 20110520 */
/* This function will return the config method description */
/* This config method description will show us which config method the remote P2P device is intented to use */
/* This config method description will show us which config method the remote P2P device is intended to use */
/* by sending the provisioning discovery request frame. */
static int rtw_p2p_get_req_cm(struct net_device *dev,
@ -3413,7 +3413,7 @@ static int rtw_p2p_get_invitation_procedure(struct net_device *dev,
/* +8 is for the str "InvProc =", we have to clear it at wrqu->data.pointer */
/* Commented by Ouden 20121226 */
/* The application wants to know P2P initation procedure is support or not. */
/* The application wants to know P2P initiation procedure is supported or not. */
/* Format: iwpriv wlanx p2p_get2 InvProc = 00:E0:4C:00:00:05 */
DBG_88E("[%s] data = %s\n", __func__, (char *)extra);
@ -4040,7 +4040,7 @@ static int rtw_rereg_nd_name(struct net_device *dev,
if (0 != ret)
goto exit;
if (!memcmp(rereg_priv->old_ifname, "disable%d", 9) == true) {
if (!memcmp(rereg_priv->old_ifname, "disable%d", 9)) {
padapter->ledpriv.bRegUseLed = rereg_priv->old_bRegUseLed;
rtw_hal_sw_led_init(padapter);
rtw_ips_mode_req(&padapter->pwrctrlpriv, rereg_priv->old_ips_mode);
@ -4049,7 +4049,7 @@ static int rtw_rereg_nd_name(struct net_device *dev,
strncpy(rereg_priv->old_ifname, new_ifname, IFNAMSIZ);
rereg_priv->old_ifname[IFNAMSIZ-1] = 0;
if (!memcmp(new_ifname, "disable%d", 9) == true) {
if (!memcmp(new_ifname, "disable%d", 9)) {
DBG_88E("%s disable\n", __func__);
/* free network queue for Android's timming issue */
rtw_free_network_queue(padapter, true);
@ -4884,7 +4884,6 @@ static int set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
case _TKIP_:
case _TKIP_WTMIC_:
case _AES_:
keylen = 16;
default:
keylen = 16;
}
@ -6146,7 +6145,7 @@ static int rtw_mp_efuse_set(struct net_device *dev,
for (jj = 0, kk = 0; jj < cnts; jj++, kk += 2)
setdata[jj] = key_2char2num(tmp[2][kk], tmp[2][kk + 1]);
/* Change to check TYPE_EFUSE_MAP_LEN, beacuse 8188E raw 256, logic map over 256. */
/* Change to check TYPE_EFUSE_MAP_LEN, because 8188E raw 256, logic map over 256. */
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&max_available_size, false);
if ((addr+cnts) > max_available_size) {
DBG_88E("%s: addr(0x%X)+cnts(%d) parameter error!\n", __func__, addr, cnts);
@ -6221,7 +6220,7 @@ static int rtw_mp_efuse_set(struct net_device *dev,
for (jj = 0, kk = 0; jj < cnts; jj++, kk += 2)
setdata[jj] = key_2char2num(tmp[1][kk], tmp[1][kk + 1]);
/* Change to check TYPE_EFUSE_MAP_LEN, beacuse 8188E raw 256, logic map over 256. */
/* Change to check TYPE_EFUSE_MAP_LEN, because 8188E raw 256, logic map over 256. */
EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (void *)&max_available_size, false);
if ((addr+cnts) > max_available_size) {
DBG_88E("%s: addr(0x%X)+cnts(%d) parameter error!\n", __func__, addr, cnts);

View file

@ -35,7 +35,6 @@ MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
MODULE_AUTHOR("Realtek Semiconductor Corp.");
MODULE_VERSION(DRIVERVERSION);
MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin");
#define CONFIG_BR_EXT_BRNAME "br0"
#define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
@ -86,7 +85,7 @@ static int rtw_uapsd_acvi_en;
static int rtw_uapsd_acvo_en;
int rtw_ht_enable = 1;
int rtw_cbw40_enable = 3; /* 0 :diable, bit(0): enable 2.4g, bit(1): enable 5g */
int rtw_cbw40_enable = 3; /* 0 :disable, bit(0): enable 2.4g, bit(1): enable 5g */
int rtw_ampdu_enable = 1;/* for enable tx_ampdu */
static int rtw_rx_stbc = 1;/* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */
static int rtw_ampdu_amsdu;/* 0: disabled, 1:enabled, 2:auto */
@ -1065,7 +1064,7 @@ int _netdev_open(struct net_device *pnetdev)
goto netdev_open_error;
}
pr_info("%sMAC Address = %pM\n", DRIVER_PREFIX, pnetdev->dev_addr);
pr_info("MAC Address = %pM\n", pnetdev->dev_addr);
status = rtw_start_drv_threads(padapter);
if (status == _FAIL) {

View file

@ -356,214 +356,6 @@ inline int ATOMIC_DEC_RETURN(ATOMIC_T *v)
return atomic_dec_return(v);
}
/* Open a file with the specific @param path, @param flag, @param mode
* @param fpp the pointer of struct file pointer to get struct file pointer while file opening is success
* @param path the path of the file to open
* @param flag file operation flags, please refer to linux document
* @param mode please refer to linux document
* @return Linux specific error code
*/
static int openfile(struct file **fpp, char *path, int flag, int mode)
{
struct file *fp;
fp = filp_open(path, flag, mode);
if (IS_ERR(fp)) {
*fpp = NULL;
return PTR_ERR(fp);
} else {
*fpp = fp;
return 0;
}
}
/* Close the file with the specific @param fp
* @param fp the pointer of struct file to close
* @return always 0
*/
static int closefile(struct file *fp)
{
filp_close(fp, NULL);
return 0;
}
static int readfile(struct file *fp, char __user *buf, int len)
{
int rlen = 0, sum = 0;
if (!fp->f_op || !fp->f_op->read)
return -EPERM;
while (sum < len) {
rlen = fp->f_op->read(fp, buf+sum, len-sum, &fp->f_pos);
if (rlen > 0)
sum += rlen;
else if (0 != rlen)
return rlen;
else
break;
}
return sum;
}
static int writefile(struct file *fp, char __user *buf, int len)
{
int wlen = 0, sum = 0;
if (!fp->f_op || !fp->f_op->write)
return -EPERM;
while (sum < len) {
wlen = fp->f_op->write(fp, buf+sum, len-sum, &fp->f_pos);
if (wlen > 0)
sum += wlen;
else if (0 != wlen)
return wlen;
else
break;
}
return sum;
}
/* Test if the specifi @param path is a file and readable
* @param path the path of the file to test
* @return Linux specific error code
*/
static int isfilereadable(char *path)
{
struct file *fp;
int ret = 0;
mm_segment_t oldfs;
char __user buf;
fp = filp_open(path, O_RDONLY, 0);
if (IS_ERR(fp)) {
ret = PTR_ERR(fp);
} else {
oldfs = get_fs(); set_fs(get_ds());
if (1 != readfile(fp, &buf, 1))
ret = PTR_ERR(fp);
set_fs(oldfs);
filp_close(fp, NULL);
}
return ret;
}
/* Open the file with @param path and retrive the file content into
* memory starting from @param buf for @param sz at most
* @param path the path of the file to open and read
* @param buf the starting address of the buffer to store file content
* @param sz how many bytes to read at most
* @return the byte we've read, or Linux specific error code
*/
static int retrievefromfile(char *path, u8 __user *buf, u32 sz)
{
int ret = -1;
mm_segment_t oldfs;
struct file *fp;
if (path && buf) {
ret = openfile(&fp, path, O_RDONLY, 0);
if (0 == ret) {
DBG_88E("%s openfile path:%s fp =%p\n", __func__,
path, fp);
oldfs = get_fs(); set_fs(get_ds());
ret = readfile(fp, buf, sz);
set_fs(oldfs);
closefile(fp);
DBG_88E("%s readfile, ret:%d\n", __func__, ret);
} else {
DBG_88E("%s openfile path:%s Fail, ret:%d\n", __func__,
path, ret);
}
} else {
DBG_88E("%s NULL pointer\n", __func__);
ret = -EINVAL;
}
return ret;
}
/*
* Open the file with @param path and wirte @param sz byte of data starting from @param buf into the file
* @param path the path of the file to open and write
* @param buf the starting address of the data to write into file
* @param sz how many bytes to write at most
* @return the byte we've written, or Linux specific error code
*/
static int storetofile(char *path, u8 __user *buf, u32 sz)
{
int ret = 0;
mm_segment_t oldfs;
struct file *fp;
if (path && buf) {
ret = openfile(&fp, path, O_CREAT|O_WRONLY, 0666);
if (0 == ret) {
DBG_88E("%s openfile path:%s fp =%p\n", __func__, path, fp);
oldfs = get_fs(); set_fs(get_ds());
ret = writefile(fp, buf, sz);
set_fs(oldfs);
closefile(fp);
DBG_88E("%s writefile, ret:%d\n", __func__, ret);
} else {
DBG_88E("%s openfile path:%s Fail, ret:%d\n", __func__, path, ret);
}
} else {
DBG_88E("%s NULL pointer\n", __func__);
ret = -EINVAL;
}
return ret;
}
/*
* Test if the specifi @param path is a file and readable
* @param path the path of the file to test
* @return true or false
*/
int rtw_is_file_readable(char *path)
{
if (isfilereadable(path) == 0)
return true;
else
return false;
}
/*
* Open the file with @param path and retrive the file content into memory starting from @param buf for @param sz at most
* @param path the path of the file to open and read
* @param buf the starting address of the buffer to store file content
* @param sz how many bytes to read at most
* @return the byte we've read
*/
int rtw_retrive_from_file(char *path, u8 __user *buf, u32 sz)
{
int ret = retrievefromfile(path, buf, sz);
return ret >= 0 ? ret : 0;
}
/*
* Open the file with @param path and wirte @param sz byte of data
* starting from @param buf into the file
* @param path the path of the file to open and write
* @param buf the starting address of the data to write into file
* @param sz how many bytes to write at most
* @return the byte we've written
*/
int rtw_store_to_file(char *path, u8 __user *buf, u32 sz)
{
int ret = storetofile(path, buf, sz);
return ret >= 0 ? ret : 0;
}
struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv,
void *old_priv)
{
@ -627,13 +419,14 @@ RETURN:
int rtw_change_ifname(struct adapter *padapter, const char *ifname)
{
struct net_device *pnetdev;
struct net_device *cur_pnetdev = padapter->pnetdev;
struct net_device *cur_pnetdev;
struct rereg_nd_name_data *rereg_priv;
int ret;
if (!padapter)
goto error;
cur_pnetdev = padapter->pnetdev;
rereg_priv = &padapter->rereg_nd_name_priv;
/* free the old_pnetdev */
@ -794,7 +587,7 @@ void *rtw_cbuf_pop(struct rtw_cbuf *cbuf)
}
/**
* rtw_cbuf_alloc - allocte a rtw_cbuf with given size and do initialization
* rtw_cbuf_alloc - allocate a rtw_cbuf with given size and do initialization
* @size: size of pointer
*
* Returns: pointer of srtuct rtw_cbuf, NULL for allocation failure

View file

@ -77,7 +77,6 @@ int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
int rtw_os_recvbuf_resource_free(struct adapter *padapter,
struct recv_buf *precvbuf)
{
if (precvbuf->purb)
usb_free_urb(precvbuf->purb);
return _SUCCESS;
}
@ -224,7 +223,6 @@ _func_exit_;
_recv_indicatepkt_drop:
/* enqueue back to free_recv_queue */
if (precv_frame)
rtw_free_recvframe(precv_frame, pfree_recv_queue);
_func_exit_;

View file

@ -737,7 +737,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
status = _SUCCESS;
free_hal_data:
if (status != _SUCCESS && padapter->HalData)
if (status != _SUCCESS)
kfree(padapter->HalData);
handle_dualmac:
if (status != _SUCCESS)