Skip to content

Commit b824479

Browse files
committed
rtl8192: Fixes for newer kernel versions
Sync with version from https://github.com/pvaret/rtl8192cu-fixes
1 parent f2c248f commit b824479

22 files changed

+188
-114
lines changed

drivers/net/wireless/realtek/rtl8192cu/Makefile

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,23 @@
11
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
22
EXTRA_CFLAGS += -O1
33
#EXTRA_CFLAGS += -O3
4-
EXTRA_CFLAGS += -Wall
5-
EXTRA_CFLAGS += -Wextra
4+
#EXTRA_CFLAGS += -Wall
5+
#EXTRA_CFLAGS += -Wextra
66
#EXTRA_CFLAGS += -Werror
77
#EXTRA_CFLAGS += -pedantic
88
#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
99

10-
# The "$(call cc-option,-Wxxx)" macro only includes that option when it's
11-
# supported by the compiler used. It may only work on Debian systems.
12-
13-
# Wdate-time was added in gcc-4.9
14-
EXTRA_CFLAGS += $(call cc-option,-Werror=date-time)
15-
# Wincompatible-pointer-types was added in gcc-5.0
16-
EXTRA_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
17-
1810
EXTRA_CFLAGS += -Wno-unused-variable
1911
EXTRA_CFLAGS += -Wno-unused-value
2012
EXTRA_CFLAGS += -Wno-unused-label
2113
EXTRA_CFLAGS += -Wno-unused-parameter
2214
EXTRA_CFLAGS += -Wno-unused-function
2315
EXTRA_CFLAGS += -Wno-unused
2416

25-
# Relax some warnings from '-Wextra' so we won't get flooded with warnings
26-
EXTRA_CFLAGS += -Wno-sign-compare
27-
EXTRA_CFLAGS += -Wno-missing-field-initializers
28-
29-
#EXTRA_CFLAGS += -Wno-uninitialized
17+
EXTRA_CFLAGS += -Wno-uninitialized
3018

3119
EXTRA_CFLAGS += -I$(src)/include
3220

33-
EXTRA_LDFLAGS += --strip-debug
34-
3521
CONFIG_AUTOCFG_CP = n
3622

3723
CONFIG_RTL8192C = y
@@ -402,7 +388,7 @@ KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source
402388
endif
403389

404390
ifeq ($(CONFIG_PLATFORM_FS_MX61), y)
405-
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
391+
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
406392
ARCH := arm
407393
CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi-
408394
KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env
@@ -627,3 +613,4 @@ clean:
627613
cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
628614
cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
629615
endif
616+

drivers/net/wireless/realtek/rtl8192cu/clean

100755100644
File mode changed.

drivers/net/wireless/realtek/rtl8192cu/core/rtw_ioctl_set.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern void indicate_wx_scan_complete_event(_adapter *padapter);
4343
(addr[4] == 0xff) && (addr[5] == 0xff) ) ? _TRUE : _FALSE \
4444
)
4545

46-
u8 rtw_validate_bssid(u8 *bssid)
46+
u8 rtw_validate_bssid(const u8 *bssid)
4747
{
4848
u8 ret = _TRUE;
4949

@@ -535,7 +535,7 @@ _func_exit_;
535535

536536
}
537537

538-
u8 rtw_set_802_11_connect(_adapter* padapter, u8 *bssid, NDIS_802_11_SSID *ssid)
538+
u8 rtw_set_802_11_connect(_adapter *padapter, const u8 *bssid, NDIS_802_11_SSID *ssid)
539539
{
540540
_irqL irqL;
541541
u8 status = _SUCCESS;

drivers/net/wireless/realtek/rtl8192cu/core/rtw_mlme_ext.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,10 +733,9 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
733733
case WIFI_AUTH:
734734
if(check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE)
735735
ptable->func = &OnAuth;
736-
/* falls through */
737736
else
738737
ptable->func = &OnAuthClient;
739-
/* falls through */
738+
//pass through
740739
case WIFI_ASSOCREQ:
741740
case WIFI_REASSOCREQ:
742741
_mgt_dispatcher(padapter, ptable, precv_frame);

drivers/net/wireless/realtek/rtl8192cu/core/rtw_p2p.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,9 +3598,17 @@ _func_enter_;
35983598
_func_exit_;
35993599
}
36003600

3601+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
36013602
static void ro_ch_timer_process (void *FunctionContext)
3603+
#else
3604+
static void ro_ch_timer_process(struct timer_list *t)
3605+
#endif
36023606
{
3607+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
36033608
_adapter *adapter = (_adapter *)FunctionContext;
3609+
#else
3610+
_adapter *adapter = from_timer(adapter, t, cfg80211_wdinfo.remain_on_ch_timer);
3611+
#endif
36043612
struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(adapter->rtw_wdev);
36053613

36063614
//printk("%s \n", __FUNCTION__);
@@ -4372,7 +4380,11 @@ void rtw_init_cfg80211_wifidirect_info( _adapter* padapter)
43724380

43734381
_rtw_memset(pcfg80211_wdinfo, 0x00, sizeof(struct cfg80211_wifidirect_info) );
43744382

4383+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
43754384
_init_timer( &pcfg80211_wdinfo->remain_on_ch_timer, padapter->pnetdev, ro_ch_timer_process, padapter );
4385+
#else
4386+
timer_setup(&pcfg80211_wdinfo->remain_on_ch_timer, ro_ch_timer_process, 0);
4387+
#endif
43764388
}
43774389
#endif //CONFIG_IOCTL_CFG80211
43784390

drivers/net/wireless/realtek/rtl8192cu/core/rtw_recv.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,7 +3903,7 @@ int process_recv_indicatepkts(_adapter *padapter, union recv_frame *prframe)
39033903

39043904
}
39053905

3906-
int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe)
3906+
static int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe)
39073907
{
39083908
int ret = _SUCCESS;
39093909
struct rx_pkt_attrib *pattrib = &rframe->u.hdr.attrib;
@@ -3944,7 +3944,7 @@ int recv_func_prehandle(_adapter *padapter, union recv_frame *rframe)
39443944
return ret;
39453945
}
39463946

3947-
int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe)
3947+
static int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe)
39483948
{
39493949
int ret = _SUCCESS;
39503950
union recv_frame *orig_prframe = prframe;
@@ -4116,8 +4116,7 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe)
41164116
}
41174117

41184118

4119-
int recv_func(_adapter *padapter, union recv_frame *rframe);
4120-
int recv_func(_adapter *padapter, union recv_frame *rframe)
4119+
static int recv_func(_adapter *padapter, union recv_frame *rframe)
41214120
{
41224121
int ret;
41234122
struct rx_pkt_attrib *prxattrib = &rframe->u.hdr.attrib;

drivers/net/wireless/realtek/rtl8192cu/core/rtw_security.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ _func_enter_;
14771477
bitwise_xor(aes_out, mic_header2, chain_buffer);
14781478
aes128k128d(key, chain_buffer, aes_out);
14791479

1480-
for (i = 0; i < num_blocks; i++)
1480+
for (i = 0; i < num_blocks; i++)
14811481
{
14821482
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);//bitwise_xor(aes_out, &message[payload_index], chain_buffer);
14831483

@@ -1504,8 +1504,8 @@ _func_enter_;
15041504
for (j = 0; j < 8; j++)
15051505
pframe[payload_index+j] = mic[j]; //message[payload_index+j] = mic[j];
15061506

1507-
payload_index = hdrlen + 8;
1508-
for (i=0; i< num_blocks; i++)
1507+
payload_index = hdrlen + 8;
1508+
for (i=0; i< num_blocks; i++)
15091509
{
15101510
construct_ctr_preload(
15111511
ctr_preload,
@@ -1878,8 +1878,8 @@ _func_enter_;
18781878
for (j = 0; j < 8; j++)
18791879
message[payload_index+j] = mic[j];
18801880

1881-
payload_index = hdrlen + 8;
1882-
for (i=0; i< num_blocks; i++)
1881+
payload_index = hdrlen + 8;
1882+
for (i=0; i< num_blocks; i++)
18831883
{
18841884
construct_ctr_preload(
18851885
ctr_preload,

drivers/net/wireless/realtek/rtl8192cu/core/rtw_sta_mgt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ _func_exit_;
685685
}
686686

687687
/* any station allocated can be searched by hash list */
688-
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
688+
struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr)
689689
{
690690

691691
_irqL irqL;
@@ -696,7 +696,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
696696

697697
u32 index;
698698

699-
u8 *addr;
699+
const u8 *addr;
700700

701701
u8 bc_addr[ETH_ALEN] = {0xff,0xff,0xff,0xff,0xff,0xff};
702702

drivers/net/wireless/realtek/rtl8192cu/hal/rtl8192c/rtl8192c_phycfg.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,6 @@ phy_TxPwrIdxToDbm(
23632363
case WIRELESS_MODE_G:
23642364
case WIRELESS_MODE_N_24G:
23652365
Offset = -8;
2366-
break;
23672366
default:
23682367
Offset = -8;
23692368
break;

drivers/net/wireless/realtek/rtl8192cu/hal/rtl8192c/usb/usb_halinit.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5692,7 +5692,6 @@ _func_enter_;
56925692
{
56935693
case HW_VAR_BASIC_RATE:
56945694
*((u16 *)(val)) = pHalData->BasicRateSet;
5695-
/* falls through */
56965695
case HW_VAR_TXPAUSE:
56975696
val[0] = rtw_read8(Adapter, REG_TXPAUSE);
56985697
break;

drivers/net/wireless/realtek/rtl8192cu/include/autoconf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131

3232
#define PLATFORM_LINUX 1
3333

34-
//#define CONFIG_IOCTL_CFG80211 1
34+
#define CONFIG_IOCTL_CFG80211 1
3535
#ifdef CONFIG_IOCTL_CFG80211
36-
//#define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */
37-
#define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
36+
#define RTW_USE_CFG80211_STA_EVENT /* Indicate new sta asoc through cfg80211_new_sta */
37+
//#define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
3838
//#define CONFIG_DEBUG_CFG80211 1
3939
//#define CONFIG_DRV_ISSUE_PROV_REQ // IOT FOR S2
4040
#define CONFIG_SET_SCAN_DENY_TIMER
@@ -324,7 +324,7 @@
324324

325325
//#define DBG_MEMORY_LEAK 1
326326

327-
#define DBG_CONFIG_ERROR_DETECT
327+
//#define DBG_CONFIG_ERROR_DETECT
328328
//#define DBG_CONFIG_ERROR_RESET
329329

330330
//TX use 1 urb

drivers/net/wireless/realtek/rtl8192cu/include/ioctl_cfg80211.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,12 @@ bool rtw_cfg80211_pwr_mgmt(_adapter *adapter);
149149
#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, buf, len, gfp)
150150
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
151151
#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->pnetdev, freq, sig_dbm, buf, len, gfp)
152-
#else
152+
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
153153
#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, gfp)
154+
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0))
155+
#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, 0, gfp)
156+
#else
157+
#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len, 0)
154158
#endif
155159

156160
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(COMPAT_KERNEL_RELEASE)

drivers/net/wireless/realtek/rtl8192cu/include/osdep_service.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,8 +1401,8 @@ void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr, dma_a
14011401
extern void* rtw_malloc2d(int h, int w, int size);
14021402
extern void rtw_mfree2d(void *pbuf, int h, int w, int size);
14031403

1404-
extern void _rtw_memcpy(void* dec, void* sour, u32 sz);
1405-
extern int _rtw_memcmp(void *dst, void *src, u32 sz);
1404+
extern void _rtw_memcpy(void *dec, const void *sour, u32 sz);
1405+
extern int _rtw_memcmp(const void *dst, const void *src, u32 sz);
14061406
extern void _rtw_memset(void *pbuf, int c, u32 sz);
14071407

14081408
extern void _rtw_init_listhead(_list *list);

drivers/net/wireless/realtek/rtl8192cu/include/rtw_ioctl_set.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ u8 rtw_set_802_11_bssid_list_scan(_adapter* padapter, NDIS_802_11_SSID *pssid, i
6363
u8 rtw_set_802_11_infrastructure_mode(_adapter * padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
6464
u8 rtw_set_802_11_remove_wep(_adapter * padapter, u32 keyindex);
6565
u8 rtw_set_802_11_ssid(_adapter * padapter, NDIS_802_11_SSID * ssid);
66-
u8 rtw_set_802_11_connect(_adapter* padapter, u8 *bssid, NDIS_802_11_SSID *ssid);
66+
u8 rtw_set_802_11_connect(_adapter *padapter, const u8 *bssid, NDIS_802_11_SSID *ssid);
6767
u8 rtw_set_802_11_remove_key(_adapter * padapter, NDIS_802_11_REMOVE_KEY * key);
6868

69-
u8 rtw_validate_bssid(u8 *bssid);
69+
u8 rtw_validate_bssid(const u8 *bssid);
7070
u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid);
7171

7272
u16 rtw_get_cur_max_rate(_adapter *adapter);

drivers/net/wireless/realtek/rtl8192cu/include/sta_info.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ struct sta_priv {
395395
};
396396

397397

398-
__inline static u32 wifi_mac_hash(u8 *mac)
398+
__inline static u32 wifi_mac_hash(const u8 *mac)
399399
{
400400
u32 x;
401401

@@ -423,7 +423,7 @@ struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
423423
extern struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
424424
extern u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta);
425425
extern void rtw_free_all_stainfo(_adapter *padapter);
426-
extern struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr);
426+
extern struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr);
427427
extern u32 rtw_init_bcmc_stainfo(_adapter* padapter);
428428
extern struct sta_info* rtw_get_bcmc_stainfo(_adapter* padapter);
429429
extern u8 rtw_access_ctrl(_adapter *padapter, u8 *mac_addr);

drivers/net/wireless/realtek/rtl8192cu/include/wifi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ enum WIFI_REG_DOMAIN {
425425
(addr[4] == 0xff) && (addr[5] == 0xff) ) ? _TRUE : _FALSE \
426426
)
427427

428-
__inline static int IS_MCAST(unsigned char *da)
428+
__inline static int IS_MCAST(const unsigned char *da)
429429
{
430430
if ((*da) & 0x01)
431431
return _TRUE;
@@ -887,7 +887,9 @@ struct ADDBA_request
887887
* According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
888888
*/
889889
#define IEEE80211_MIN_AMPDU_BUF 0x8
890+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0))
890891
#define IEEE80211_MAX_AMPDU_BUF 0x40
892+
#endif
891893

892894

893895
/* Spatial Multiplexing Power Save Modes */

0 commit comments

Comments
 (0)