blk-mq: Record nr_active_requests per queue for when using shared sbitmap
[linux-2.6-microblaze.git] / include / linux / interrupt.h
index 80f637c..f9aee35 100644 (file)
@@ -585,6 +585,9 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)
 
 /* Tasklets --- multithreaded analogue of BHs.
 
+   This API is deprecated. Please consider using threaded IRQs instead:
+   https://lore.kernel.org/lkml/20200716081538.2sivhkj4hcyrusem@linutronix.de
+
    Main feature differing them of generic softirqs: tasklet
    is running only on one CPU simultaneously.
 
@@ -608,16 +611,42 @@ struct tasklet_struct
        struct tasklet_struct *next;
        unsigned long state;
        atomic_t count;
-       void (*func)(unsigned long);
+       bool use_callback;
+       union {
+               void (*func)(unsigned long data);
+               void (*callback)(struct tasklet_struct *t);
+       };
        unsigned long data;
 };
 
-#define DECLARE_TASKLET(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
+#define DECLARE_TASKLET(name, _callback)               \
+struct tasklet_struct name = {                         \
+       .count = ATOMIC_INIT(0),                        \
+       .callback = _callback,                          \
+       .use_callback = true,                           \
+}
 
-#define DECLARE_TASKLET_DISABLED(name, func, data) \
-struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
+#define DECLARE_TASKLET_DISABLED(name, _callback)      \
+struct tasklet_struct name = {                         \
+       .count = ATOMIC_INIT(1),                        \
+       .callback = _callback,                          \
+       .use_callback = true,                           \
+}
 
+#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
+       container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
+
+#define DECLARE_TASKLET_OLD(name, _func)               \
+struct tasklet_struct name = {                         \
+       .count = ATOMIC_INIT(0),                        \
+       .func = _func,                                  \
+}
+
+#define DECLARE_TASKLET_DISABLED_OLD(name, _func)      \
+struct tasklet_struct name = {                         \
+       .count = ATOMIC_INIT(1),                        \
+       .func = _func,                                  \
+}
 
 enum
 {
@@ -686,6 +715,8 @@ extern void tasklet_kill(struct tasklet_struct *t);
 extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
 extern void tasklet_init(struct tasklet_struct *t,
                         void (*func)(unsigned long), unsigned long data);
+extern void tasklet_setup(struct tasklet_struct *t,
+                         void (*callback)(struct tasklet_struct *));
 
 /*
  * Autoprobing for irqs:
@@ -760,8 +791,10 @@ extern int arch_early_irq_init(void);
 /*
  * We want to know which function is an entrypoint of a hardirq or a softirq.
  */
-#define __irq_entry             __attribute__((__section__(".irqentry.text")))
-#define __softirq_entry  \
-       __attribute__((__section__(".softirqentry.text")))
+#ifndef __irq_entry
+# define __irq_entry    __attribute__((__section__(".irqentry.text")))
+#endif
+
+#define __softirq_entry  __attribute__((__section__(".softirqentry.text")))
 
 #endif