Skip to content

Commit 08a1cac

Browse files
committed
kernel: r8101: fix build with linux v6.16+
Fix r8101 module build with kernels >= v6.16. Signed-off-by: Álvaro Fernández Rojas <[email protected]>
1 parent 7f3537e commit 08a1cac

File tree

3 files changed

+69
-2
lines changed

3 files changed

+69
-2
lines changed

package/kernel/r8101/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
22

33
PKG_NAME:=r8101
44
PKG_VERSION:=1.039.00
5-
PKG_RELEASE:=3
5+
PKG_RELEASE:=4
66

77
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
88
PKG_SOURCE_URL:=https://github.com/openwrt/rtl8101/releases/download/$(PKG_VERSION)
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From 37bbdad26212b500f80d099e50b635c4ec387510 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <[email protected]>
3+
Date: Sat, 27 Dec 2025 12:08:47 +0100
4+
Subject: [PATCH] r8101: fix build with kernels > 6.16
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
10+
---
11+
src/r8101.h | 5 +++++
12+
src/r8101_n.c | 8 ++++----
13+
2 files changed, 9 insertions(+), 4 deletions(-)
14+
15+
--- a/src/r8101.h
16+
+++ b/src/r8101.h
17+
@@ -109,6 +109,12 @@ static inline void ether_addr_copy(u8 *d
18+
}
19+
#endif
20+
21+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,16,0)
22+
+#define timer_container_of(var, callback_timer, timer_fieldname) \
23+
+ from_timer(var, callback_timer, timer_fieldname)
24+
+#define timer_delete_sync(timer) del_timer_sync(timer)
25+
+#endif
26+
+
27+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
28+
#define setup_timer(_timer, _function, _data) \
29+
do { \
30+
--- a/src/r8101_n.c
31+
+++ b/src/r8101_n.c
32+
@@ -10163,7 +10163,7 @@ rtl8101_hw_phy_config(struct net_device
33+
34+
static inline void rtl8101_delete_link_timer(struct net_device *dev, struct timer_list *timer)
35+
{
36+
- del_timer_sync(timer);
37+
+ timer_delete_sync(timer);
38+
}
39+
40+
static inline void rtl8101_request_link_timer(struct net_device *dev)
41+
@@ -10181,7 +10181,7 @@ static inline void rtl8101_request_link_
42+
43+
static inline void rtl8101_delete_esd_timer(struct net_device *dev, struct timer_list *timer)
44+
{
45+
- del_timer_sync(timer);
46+
+ timer_delete_sync(timer);
47+
}
48+
49+
static inline void rtl8101_request_esd_timer(struct net_device *dev)
50+
@@ -11600,7 +11600,7 @@ rtl8101_esd_timer(struct timer_list *t)
51+
struct rtl8101_private *tp = netdev_priv(dev);
52+
struct timer_list *timer = &tp->esd_timer;
53+
#else
54+
- struct rtl8101_private *tp = from_timer(tp, t, esd_timer);
55+
+ struct rtl8101_private *tp = timer_container_of(tp, t, esd_timer);
56+
struct net_device *dev = tp->dev;
57+
struct timer_list *timer = t;
58+
#endif
59+
@@ -11776,7 +11776,7 @@ rtl8101_link_timer(struct timer_list *t)
60+
struct rtl8101_private *tp = netdev_priv(dev);
61+
struct timer_list *timer = &tp->link_timer;
62+
#else
63+
- struct rtl8101_private *tp = from_timer(tp, t, link_timer);
64+
+ struct rtl8101_private *tp = timer_container_of(tp, t, link_timer);
65+
struct net_device *dev = tp->dev;
66+
struct timer_list *timer = t;
67+
#endif

package/kernel/r8101/patches/200-r8101-print-link-speed-and-duplex-mode.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Signed-off-by: Álvaro Fernández Rojas <[email protected]>
1717

1818
--- a/src/r8101.h
1919
+++ b/src/r8101.h
20-
@@ -1162,6 +1162,8 @@ enum RTL8101_register_content {
20+
@@ -1168,6 +1168,8 @@ enum RTL8101_register_content {
2121
LinkStatus = 0x02,
2222
FullDup = 0x01,
2323

0 commit comments

Comments
 (0)