aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/subsys/073-backports-backport-tasklet_setup-from_tasklet.patch
blob: 486d10ea58f83886f7c14db73c5396c64137fad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 11 Nov 2020 13:34:26 +0100
Subject: [PATCH] backports: backport tasklet_setup, from_tasklet

Backport the new tasklet API

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---

--- a/backport-include/linux/interrupt.h
+++ b/backport-include/linux/interrupt.h
@@ -31,6 +31,23 @@ static inline void backport_hrtimer_star
 	hrtimer_start(timer, _time, mode);
 }
 #define hrtimer_start LINUX_BACKPORT(hrtimer_start)
+
+#endif
+
+#if LINUX_VERSION_IS_LESS(5,9,0)
+
+static inline void
+tasklet_setup(struct tasklet_struct *t,
+	      void (*callback)(struct tasklet_struct *))
+{
+	void (*cb)(unsigned long data) = (void *)callback;
+
+	tasklet_init(t, cb, (unsigned long)t);
+}
+
+#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
+	container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
+
 #endif
 
 #endif /* _BP_LINUX_INTERRUPT_H */