From b4effa4f4a573f76b3a95c055d037712fa35b57d Mon Sep 17 00:00:00 2001 From: FSE Date: Fri, 8 Aug 2025 02:45:36 +0200 Subject: [PATCH] Fix dev_set_mac_address() call for Linux 6.16+ API change --- r8152.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/r8152.c b/r8152.c index 1d12099..9512720 100644 --- a/r8152.c +++ b/r8152.c @@ -35,6 +35,9 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,10) #include #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,10) */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) +#include +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,16,0) */ /* Version Information */ #define DRIVER_SUFFIX @@ -26240,9 +26243,12 @@ static int rtl8152_post_reset(struct usb_interface *intf) rtnl_lock(); #if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) dev_set_mac_address(tp->netdev, &sa); -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6,16,0) dev_set_mac_address(tp->netdev, &sa, NULL); -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) */ +#else /* >= 6.16: __kernel_sockaddr_storage API change */ + dev_set_mac_address(tp->netdev, + (struct __kernel_sockaddr_storage *)&sa, NULL); +#endif rtnl_unlock(); }