Fix for interface changes for 5.10

This commit is contained in:
Juan José Gutiérrez de Quevedo Pérez 2021-03-27 22:02:36 +01:00
parent 2371a976e3
commit bdd61e6735
5 changed files with 15 additions and 47 deletions

View file

@ -15121,7 +15121,9 @@ u8 set_chplan_hdl(_adapter *padapter, unsigned char *pbuf)
rtw_hal_set_odm_var(padapter,HAL_ODM_REGULATION,NULL,_TRUE); rtw_hal_set_odm_var(padapter,HAL_ODM_REGULATION,NULL,_TRUE);
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
rtw_reg_notify_by_driver(padapter); if (padapter->rtw_wdev != NULL) {
rtw_reg_notify_by_driver(padapter->rtw_wdev->wiphy);
}
#endif //CONFIG_IOCTL_CFG80211 #endif //CONFIG_IOCTL_CFG80211
return H2C_SUCCESS; return H2C_SUCCESS;

View file

@ -19,8 +19,8 @@ enum country_code_type_t {
COUNTRY_CODE_MAX COUNTRY_CODE_MAX
}; };
int rtw_regd_init(_adapter *padapter); void rtw_regd_init(struct wiphy *wiphy);
void rtw_reg_notify_by_driver(_adapter *adapter); void rtw_reg_notify_by_driver(struct wiphy *wiphy);
#endif /* __RTW_WIFI_REGD_H__ */ #endif /* __RTW_WIFI_REGD_H__ */

View file

@ -6444,9 +6444,6 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter)
rtw_cfg80211_init_ht_capab(padapter, &bands->ht_cap, NL80211_BAND_5GHZ, rf_type); rtw_cfg80211_init_ht_capab(padapter, &bands->ht_cap, NL80211_BAND_5GHZ, rf_type);
} }
#endif #endif
/* init regulary domain */
rtw_regd_init(padapter);
/* copy mac_addr to wiphy */ /* copy mac_addr to wiphy */
_rtw_memcpy(wiphy->perm_addr, adapter_mac_addr(padapter), ETH_ALEN); _rtw_memcpy(wiphy->perm_addr, adapter_mac_addr(padapter), ETH_ALEN);
@ -6679,6 +6676,8 @@ struct wiphy *rtw_wiphy_alloc(_adapter *padapter, struct device *dev)
*((_adapter**)wiphy_priv(wiphy)) = padapter; *((_adapter**)wiphy_priv(wiphy)) = padapter;
rtw_cfg80211_preinit_wiphy(padapter, wiphy); rtw_cfg80211_preinit_wiphy(padapter, wiphy);
/* init regulatory domain */
rtw_regd_init(wiphy);
DBG_871X(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy)); DBG_871X(FUNC_WIPHY_FMT"\n", FUNC_WIPHY_ARG(wiphy));

View file

@ -476,12 +476,12 @@ void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
#endif #endif
} }
void rtw_reg_notify_by_driver(_adapter *adapter) void rtw_reg_notify_by_driver(struct wiphy *wiphy)
{ {
if ((adapter->rtw_wdev != NULL) && (adapter->rtw_wdev->wiphy)) { if (wiphy) {
struct regulatory_request request; struct regulatory_request request;
request.initiator = NL80211_REGDOM_SET_BY_DRIVER; request.initiator = NL80211_REGDOM_SET_BY_DRIVER;
rtw_reg_notifier(adapter->rtw_wdev->wiphy, &request); rtw_reg_notifier(wiphy, &request);
} }
} }
@ -521,28 +521,9 @@ static struct country_code_to_enum_rd *_rtw_regd_find_country(u16 countrycode)
return NULL; return NULL;
} }
int rtw_regd_init(_adapter * padapter) void rtw_regd_init(struct wiphy *wiphy)
{ {
struct wiphy *wiphy = padapter->rtw_wdev->wiphy;
#if 0
if (rtw_regd == NULL) {
rtw_regd = (struct rtw_regulatory *)
rtw_malloc(sizeof(struct rtw_regulatory));
rtw_regd->alpha2[0] = '9';
rtw_regd->alpha2[1] = '9';
rtw_regd->country_code = COUNTRY_CODE_USER;
}
DBG_8192C("%s: Country alpha2 being used: %c%c\n",
__func__, rtw_regd->alpha2[0], rtw_regd->alpha2[1]);
#endif
_rtw_regd_init_wiphy(NULL, wiphy); _rtw_regd_init_wiphy(NULL, wiphy);
return 0;
} }
#endif //CONFIG_IOCTL_CFG80211 #endif //CONFIG_IOCTL_CFG80211

View file

@ -1949,7 +1949,6 @@ static int isFileReadable(char *path)
{ {
struct file *fp; struct file *fp;
int ret = 0; int ret = 0;
mm_segment_t oldfs;
char buf; char buf;
fp=filp_open(path, O_RDONLY, 0); fp=filp_open(path, O_RDONLY, 0);
@ -1957,13 +1956,8 @@ static int isFileReadable(char *path)
ret = PTR_ERR(fp); ret = PTR_ERR(fp);
} }
else { else {
oldfs = get_fs(); set_fs(KERNEL_DS); ret = kernel_read(fp, &buf, 1, NULL);
closeFile(fp);
if(1!=readFile(fp, &buf, 1))
ret = PTR_ERR(fp);
set_fs(oldfs);
filp_close(fp,NULL);
} }
return ret; return ret;
} }
@ -1978,16 +1972,12 @@ static int isFileReadable(char *path)
static int retriveFromFile(char *path, u8* buf, u32 sz) static int retriveFromFile(char *path, u8* buf, u32 sz)
{ {
int ret =-1; int ret =-1;
mm_segment_t oldfs;
struct file *fp; struct file *fp;
if(path && buf) { if(path && buf) {
if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){ if( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ){
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
ret = kernel_read(fp, buf, sz, NULL);
oldfs = get_fs(); set_fs(KERNEL_DS);
ret=readFile(fp, buf, sz);
set_fs(oldfs);
closeFile(fp); closeFile(fp);
DBG_871X("%s readFile, ret:%d\n",__FUNCTION__, ret); DBG_871X("%s readFile, ret:%d\n",__FUNCTION__, ret);
@ -2012,16 +2002,12 @@ static int retriveFromFile(char *path, u8* buf, u32 sz)
static int storeToFile(char *path, u8* buf, u32 sz) static int storeToFile(char *path, u8* buf, u32 sz)
{ {
int ret =0; int ret =0;
mm_segment_t oldfs;
struct file *fp; struct file *fp;
if(path && buf) { if(path && buf) {
if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) { if( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) {
DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); DBG_871X("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
ret = kernel_write(fp, buf, sz, NULL);
oldfs = get_fs(); set_fs(KERNEL_DS);
ret=writeFile(fp, buf, sz);
set_fs(oldfs);
closeFile(fp); closeFile(fp);
DBG_871X("%s writeFile, ret:%d\n",__FUNCTION__, ret); DBG_871X("%s writeFile, ret:%d\n",__FUNCTION__, ret);