diff mbox series

[2/2] backports: add tasklet_setup, from_tasklet

Message ID 20201112103546.74014-2-nbd@nbd.name (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Felix Fietkau Nov. 12, 2020, 10:35 a.m. UTC
Add the new tasklet API

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/interrupt.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/interrupt.h b/backport/backport-include/linux/interrupt.h
index f7e7134d8338..f334a9636180 100644
--- a/backport/backport-include/linux/interrupt.h
+++ b/backport/backport-include/linux/interrupt.h
@@ -31,6 +31,23 @@  static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,
 	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 */