Skip to content

Commit

Permalink
rtl8852au: Fix build for kernel 5.17 API changes
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 3, 2022
1 parent 11d0e0a commit d51e571
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
4 changes: 0 additions & 4 deletions core/rtw_p2p.c
Expand Up @@ -1483,11 +1483,7 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l

rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_DEVICE_INFO , pattr_content, (uint *)&attr_contentlen);

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
_rtw_memcpy(psta->dev_addr, pattr_content, ETH_ALEN);/* P2P Device Address */
#else
dev_addr_set(psta, pattr_content);
#endif
pattr_content += ETH_ALEN;

_rtw_memcpy(&psta->config_methods, pattr_content, 2);/* Config Methods */
Expand Down
4 changes: 4 additions & 0 deletions include/osdep_service_linux.h
Expand Up @@ -484,7 +484,11 @@ static inline void rtw_thread_enter(char *name)

static inline void rtw_thread_exit(_completion *comp)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
complete_and_exit(comp, 0);
#else
kthread_complete_and_exit(comp, 0);
#endif
}

static inline _thread_hdl_ rtw_thread_start(int (*threadfn)(void *data),
Expand Down
24 changes: 24 additions & 0 deletions os_dep/linux/rtw_proc.c
Expand Up @@ -235,7 +235,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 Down Expand Up @@ -264,7 +268,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 @@ -5119,7 +5127,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 Down Expand Up @@ -5149,7 +5161,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 @@ -5380,7 +5396,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 Down Expand Up @@ -5410,7 +5430,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
2 changes: 1 addition & 1 deletion phl/pltfm_ops_linux.h
Expand Up @@ -578,7 +578,7 @@ static inline u8 _os_tasklet_init(void *drv_priv, _os_tasklet *task,
void (*call_back_func)(void* context), void *context)
{
rtw_tasklet_init(task,
(void(*)(unsigned long))call_back_func,
(void *)call_back_func,
(unsigned long)task);
return 0;
}
Expand Down

2 comments on commit d51e571

@Sujan-Roy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to install.
But i can't install.
I show here the full error message.
pi@raspberrypi:~ $ git clone http://github.com/lwfinger/rtl8852au.git
Cloning into 'rtl8852au'...
warning: redirecting to https://github.com/lwfinger/rtl8852au.git/
remote: Enumerating objects: 1097, done.
remote: Counting objects: 100% (96/96), done.
remote: Compressing objects: 100% (79/79), done.
remote: Total 1097 (delta 30), reused 42 (delta 16), pack-reused 1001
Receiving objects: 100% (1097/1097), 10.82 MiB | 4.69 MiB/s, done.
Resolving deltas: 100% (341/341), done.
pi@raspberrypi:~ $ cd rtl8852au/
pi@raspberrypi:~/rtl8852au $ make
#rm -f .symvers.8852au
make ARCH=armv7l CROSS_COMPILE= -C /lib/modules/5.15.61-v7l+/build M=/home/pi/rtl8852au modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.61-v7l+'
Makefile:706: arch/armv7l/Makefile: No such file or directory
make[1]: *** No rule to make target 'arch/armv7l/Makefile'. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-5.15.61-v7l+'
make: *** [Makefile:636: modules] Error 2
pi@raspberrypi:~/rtl8852au $ sudo make install
install -p -m 644 8852au.ko /lib/modules/5.15.61-v7l+/kernel/drivers/net/wireless/realtek/rtw89/
install: cannot stat '8852au.ko': No such file or directory
make: *** [Makefile:646: install] Error 1

@lwfinger
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot "install" until the "make" succeeds.

I already answered another post with this problem. Do a 'git pull' and make as usual.

Please sign in to comment.