From 8b485b79bed3ae1f9bb0ae41c030c09d85065d09 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 7 Nov 2023 17:09:16 +0100 Subject: [PATCH 1/2] Make use of MODULE_IMPORT_NS conditional Commit 8954f2b8d8a06db44bef9a1318f6e1cdb001b98d added an unconditional: MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); For compatibility with old kernel versions, guard this declaration with #ifdef MODULE_IMPORT_NS. This specific symbol namespace is also Android-specific, so the declaration should also be conditional on building for Android, but there doesn't seem to be a single preprocessor symbol that indicates that. Signed-off-by: Ben Hutchings --- os_dep/linux/usb_intf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 2ef96b3..be0f654 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -1640,7 +1640,9 @@ static void __exit rtw_drv_halt(void) rtw_mstat_dump(RTW_DBGDUMP); } +#ifdef MODULE_IMPORT_NS MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); +#endif module_init(rtw_drv_entry); module_exit(rtw_drv_halt); From b3f7e7a428fcb225b862102e3172bbc44b7cf263 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 7 Nov 2023 18:12:18 +0100 Subject: [PATCH 2/2] Fix eth_hw_addr_set() definition for compatibility with stable branches eth_hw_addr_set() was added in Linux 5.15 but has now been backported to 4.19.291, 5.4.251, and 5.10.188. This currently results in build failure for these stable branches. There's no simple way to test for the addition of this function since LINUX_VERSION_CODE limits version components to 255. Work around this by defining an inline function rtw_eth_hw_addr_set() and a macro eth_hw_addr_set(). This effectively shadows any backported definition of the eth_hw_addr_set() function without any conflict. Signed-off-by: Ben Hutchings --- include/drv_types_linux.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/drv_types_linux.h b/include/drv_types_linux.h index 6264a4d..56435c8 100644 --- a/include/drv_types_linux.h +++ b/include/drv_types_linux.h @@ -17,10 +17,11 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) /* Porting from linux kernel v5.15 48eab831ae8b9f7002a533fa4235eed63ea1f1a3 3f6cffb8604b537e3d7ea040d7f4368689638eaf*/ -static inline void eth_hw_addr_set(struct net_device *dev, const u8 *addr) +static inline void rtw_eth_hw_addr_set(struct net_device *dev, const u8 *addr) { memcpy(dev->dev_addr, addr, ETH_ALEN); } +#define eth_hw_addr_set rtw_eth_hw_addr_set #endif #endif