Skip to content

Commit

Permalink
rtl8723ds: Fix build on kernel 5.17
Browse files Browse the repository at this point in the history
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
  • Loading branch information
lwfinger committed Feb 5, 2022
1 parent 2c218a3 commit 76fb806
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 3 deletions.
4 changes: 2 additions & 2 deletions hal/rtl8723d/rtl8723d_hal_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -5250,7 +5250,7 @@ void SetHwReg8723D(PADAPTER padapter, u8 variable, u8 *val)
val32 |= RCR_CBSSID_DATA | RCR_CBSSID_BCN;
else
val32 &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);
rtw_write32(padapter, REG_RCR, val32);
rtw_write32(padapter, REG_RCR, val32);
}
break;

Expand Down Expand Up @@ -5339,7 +5339,7 @@ void SetHwReg8723D(PADAPTER padapter, u8 variable, u8 *val)
regTmp = 0;
if (bShortPreamble)
regTmp |= 0x80;
rtw_write8(padapter, REG_RRSR + 2, regTmp);
rtw_write8(padapter, REG_RRSR + 2, regTmp);
}
break;

Expand Down
2 changes: 1 addition & 1 deletion hal/rtl8723d/sdio/rtl8723ds_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ s32 rtl8723ds_init_recv_priv(PADAPTER padapter)

/* 3 2. init tasklet */
tasklet_init(&precvpriv->recv_tasklet,
(void(*)(unsigned long))rtl8723ds_recv_tasklet,
(void *)rtl8723ds_recv_tasklet,
(unsigned long)padapter);

goto exit;
Expand Down
4 changes: 4 additions & 0 deletions include/osdep_service_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ typedef void *_thread_hdl_;
typedef int thread_return;
typedef void *thread_context;

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
#define thread_exit() complete_and_exit(NULL, 0)
#else
#define thread_exit() kthread_complete_and_exit(NULL, 0)
#endif

typedef void timer_hdl_return;
typedef void *timer_hdl_context;
Expand Down
4 changes: 4 additions & 0 deletions os_dep/linux/ioctl_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -10213,7 +10213,11 @@ static int rtw_mp_efuse_set(struct net_device *dev,
rtw_hal_read_chip_info(padapter);
/* set mac addr*/
rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter));
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
_rtw_memcpy(padapter->pnetdev->dev_addr, get_hal_mac_addr(padapter), ETH_ALEN); /* set mac addr to net_device */
#else
dev_addr_set(padapter->pnetdev, get_hal_mac_addr(padapter)); /* set mac addr to net_device */
#endif

#ifdef CONFIG_P2P
rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter));
Expand Down
16 changes: 16 additions & 0 deletions os_dep/linux/os_intfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,11 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *addr)
}

_rtw_memcpy(adapter_mac_addr(padapter), sa->sa_data, ETH_ALEN); /* set mac addr to adapter */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
_rtw_memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */
#else
dev_addr_set(pnetdev, sa->sa_data); /* set mac addr to net_device */
#endif

#if 0
if (rtw_is_hw_init_completed(padapter)) {
Expand Down Expand Up @@ -1386,7 +1390,11 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name)
/* alloc netdev name */
rtw_init_netdev_name(ndev, name);

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
_rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN);
#else
dev_addr_set(ndev, adapter_mac_addr(adapter));
#endif

/* Tell the network stack we exist */

Expand Down Expand Up @@ -2212,7 +2220,11 @@ int _netdev_vir_if_open(struct net_device *pnetdev)
rtw_mbid_camid_alloc(padapter, adapter_mac_addr(padapter));
#endif
rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter));
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
_rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN);
#else
dev_addr_set(pnetdev, adapter_mac_addr(padapter);
#endif
}
#endif /*CONFIG_PLATFORM_INTEL_BYT*/

Expand Down Expand Up @@ -2715,7 +2727,11 @@ int _netdev_open(struct net_device *pnetdev)
rtw_mbid_camid_alloc(padapter, adapter_mac_addr(padapter));
#endif
rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter));
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
_rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN);
#else
dev_addr_set(pnetdev, adapter_mac_addr(padapter));
#endif
#endif /* CONFIG_PLATFORM_INTEL_BYT */

rtw_clr_surprise_removed(padapter);
Expand Down
32 changes: 32 additions & 0 deletions os_dep/linux/rtw_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ const int drv_proc_hdls_num = sizeof(drv_proc_hdls) / sizeof(struct rtw_proc_hdl
static int rtw_drv_proc_open(struct inode *inode, struct file *file)
{
/* struct net_device *dev = proc_get_parent_data(inode); */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)pde_data(inode);
#endif
const struct rtw_proc_hdl *hdl = drv_proc_hdls + index;
void *private = NULL;

Expand All @@ -215,7 +219,11 @@ static int rtw_drv_proc_open(struct inode *inode, struct file *file)

static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)pde_data(file_inode(file));
#endif
const struct rtw_proc_hdl *hdl = drv_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;

Expand Down Expand Up @@ -2319,7 +2327,11 @@ const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_

static int rtw_adapter_proc_open(struct inode *inode, struct file *file)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)pde_data(inode);
#endif
const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index;
void *private = proc_get_parent_data(inode);

Expand All @@ -2341,7 +2353,11 @@ static int rtw_adapter_proc_open(struct inode *inode, struct file *file)

static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)pde_data(file_inode(file));
#endif
const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;

Expand Down Expand Up @@ -2674,7 +2690,11 @@ const int odm_proc_hdls_num = sizeof(odm_proc_hdls) / sizeof(struct rtw_proc_hdl

static int rtw_odm_proc_open(struct inode *inode, struct file *file)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)pde_data(inode);
#endif
const struct rtw_proc_hdl *hdl = odm_proc_hdls + index;
void *private = proc_get_parent_data(inode);

Expand All @@ -2696,7 +2716,11 @@ static int rtw_odm_proc_open(struct inode *inode, struct file *file)

static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)pde_data(file_inode(file));
#endif
const struct rtw_proc_hdl *hdl = odm_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;

Expand Down Expand Up @@ -2833,7 +2857,11 @@ const int mcc_proc_hdls_num = sizeof(mcc_proc_hdls) / sizeof(struct rtw_proc_hdl

static int rtw_mcc_proc_open(struct inode *inode, struct file *file)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)pde_data(inode);
#endif
const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index;
void *private = proc_get_parent_data(inode);

Expand All @@ -2855,7 +2883,11 @@ static int rtw_mcc_proc_open(struct inode *inode, struct file *file)

static ssize_t rtw_mcc_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)pde_data(file_inode(file));
#endif
const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;

Expand Down
4 changes: 4 additions & 0 deletions os_dep/osdep_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,7 +1558,11 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname)

rtw_init_netdev_name(pnetdev, ifname);

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
_rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN);
#else
dev_addr_set(pnetdev, adapter_mac_addr(padapter));
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26))
if (!rtnl_is_locked())
Expand Down

0 comments on commit 76fb806

Please sign in to comment.