Skip to content

Commit 427714f

Browse files
committed
Merge tag 'tasklets-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull tasklets API update from Kees Cook: "These are the infrastructure updates needed to support converting the tasklet API to something more modern (and hopefully for removal further down the road). There is a 300-patch series waiting in the wings to get set out to subsystem maintainers, but these changes need to be present in the kernel first. Since this has some treewide changes, I carried this series for -next instead of paining Thomas with it in -tip, but it's got his Ack. This is similar to the timer_struct modernization from a while back, but not nearly as messy (I hope). :) - Prepare for tasklet API modernization (Romain Perier, Allen Pais, Kees Cook)" * tag 'tasklets-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: tasklet: Introduce new initialization API treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD() usb: gadget: udc: Avoid tasklet passing a global
2 parents 5b5d3be + 12cc923 commit 427714f

File tree

17 files changed

+70
-25
lines changed

17 files changed

+70
-25
lines changed

drivers/input/keyboard/omap-keypad.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct omap_kp {
4646
unsigned short keymap[];
4747
};
4848

49-
static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0);
49+
static DECLARE_TASKLET_DISABLED_OLD(kp_tasklet, omap_kp_tasklet);
5050

5151
static unsigned int *row_gpios;
5252
static unsigned int *col_gpios;

drivers/input/serio/hil_mlc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static struct timer_list hil_mlcs_kicker;
7777
static int hil_mlcs_probe;
7878

7979
static void hil_mlcs_process(unsigned long unused);
80-
static DECLARE_TASKLET_DISABLED(hil_mlcs_tasklet, hil_mlcs_process, 0);
80+
static DECLARE_TASKLET_DISABLED_OLD(hil_mlcs_tasklet, hil_mlcs_process);
8181

8282

8383
/* #define HIL_MLC_DEBUG */

drivers/net/wan/farsync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,8 @@ static void do_bottom_half_rx(struct fst_card_info *card);
569569
static void fst_process_tx_work_q(unsigned long work_q);
570570
static void fst_process_int_work_q(unsigned long work_q);
571571

572-
static DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0);
573-
static DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0);
572+
static DECLARE_TASKLET_OLD(fst_tx_task, fst_process_tx_work_q);
573+
static DECLARE_TASKLET_OLD(fst_int_task, fst_process_int_work_q);
574574

575575
static struct fst_card_info *fst_card_array[FST_MAX_CARDS];
576576
static spinlock_t fst_work_q_lock;

drivers/s390/crypto/ap_bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static DECLARE_WORK(ap_scan_work, ap_scan_bus);
9292
* Tasklet & timer for AP request polling and interrupts
9393
*/
9494
static void ap_tasklet_fn(unsigned long);
95-
static DECLARE_TASKLET(ap_tasklet, ap_tasklet_fn, 0);
95+
static DECLARE_TASKLET_OLD(ap_tasklet, ap_tasklet_fn);
9696
static DECLARE_WAIT_QUEUE_HEAD(ap_poll_wait);
9797
static struct task_struct *ap_poll_kthread;
9898
static DEFINE_MUTEX(ap_poll_thread_mutex);

drivers/staging/most/dim2/dim2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ MODULE_PARM_DESC(fcnt, "Num of frames per sub-buffer for sync channels as a powe
4646
static DEFINE_SPINLOCK(dim_lock);
4747

4848
static void dim2_tasklet_fn(unsigned long data);
49-
static DECLARE_TASKLET(dim2_tasklet, dim2_tasklet_fn, 0);
49+
static DECLARE_TASKLET_OLD(dim2_tasklet, dim2_tasklet_fn);
5050

5151
/**
5252
* struct hdm_channel - private structure to keep channel specific data

drivers/staging/octeon/ethernet-tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#endif
4242

4343
static void cvm_oct_tx_do_cleanup(unsigned long arg);
44-
static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
44+
static DECLARE_TASKLET_OLD(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup);
4545

4646
/* Maximum number of SKBs to try to free per xmit packet. */
4747
#define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2)

drivers/tty/vt/keyboard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ static void kbd_bh(unsigned long dummy)
12361236
}
12371237
}
12381238

1239-
DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
1239+
DECLARE_TASKLET_DISABLED_OLD(keyboard_tasklet, kbd_bh);
12401240

12411241
#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\
12421242
defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\

drivers/usb/gadget/udc/snps_udc_core.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ static int stop_pollstall_timer;
9696
static DECLARE_COMPLETION(on_pollstall_exit);
9797

9898
/* tasklet for usb disconnect */
99-
static DECLARE_TASKLET(disconnect_tasklet, udc_tasklet_disconnect,
100-
(unsigned long) &udc);
101-
99+
static DECLARE_TASKLET_OLD(disconnect_tasklet, udc_tasklet_disconnect);
102100

103101
/* endpoint names used for print */
104102
static const char ep0_string[] = "ep0in";
@@ -1661,7 +1659,7 @@ static void usb_disconnect(struct udc *dev)
16611659
/* Tasklet for disconnect to be outside of interrupt context */
16621660
static void udc_tasklet_disconnect(unsigned long par)
16631661
{
1664-
struct udc *dev = (struct udc *)(*((struct udc **) par));
1662+
struct udc *dev = udc;
16651663
u32 tmp;
16661664

16671665
DBG(dev, "Tasklet disconnect\n");

drivers/usb/host/fhci-sched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ static void process_done_list(unsigned long data)
677677
enable_irq(fhci_to_hcd(fhci)->irq);
678678
}
679679

680-
DECLARE_TASKLET(fhci_tasklet, process_done_list, 0);
680+
DECLARE_TASKLET_OLD(fhci_tasklet, process_done_list);
681681

682682
/* transfer complted callback */
683683
u32 fhci_transfer_confirm_callback(struct fhci_hcd *fhci)

include/linux/interrupt.h

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)
585585

586586
/* Tasklets --- multithreaded analogue of BHs.
587587
588+
This API is deprecated. Please consider using threaded IRQs instead:
589+
https://lore.kernel.org/lkml/[email protected]
590+
588591
Main feature differing them of generic softirqs: tasklet
589592
is running only on one CPU simultaneously.
590593
@@ -608,16 +611,42 @@ struct tasklet_struct
608611
struct tasklet_struct *next;
609612
unsigned long state;
610613
atomic_t count;
611-
void (*func)(unsigned long);
614+
bool use_callback;
615+
union {
616+
void (*func)(unsigned long data);
617+
void (*callback)(struct tasklet_struct *t);
618+
};
612619
unsigned long data;
613620
};
614621

615-
#define DECLARE_TASKLET(name, func, data) \
616-
struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
622+
#define DECLARE_TASKLET(name, _callback) \
623+
struct tasklet_struct name = { \
624+
.count = ATOMIC_INIT(0), \
625+
.callback = _callback, \
626+
.use_callback = true, \
627+
}
628+
629+
#define DECLARE_TASKLET_DISABLED(name, _callback) \
630+
struct tasklet_struct name = { \
631+
.count = ATOMIC_INIT(1), \
632+
.callback = _callback, \
633+
.use_callback = true, \
634+
}
617635

618-
#define DECLARE_TASKLET_DISABLED(name, func, data) \
619-
struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
636+
#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
637+
container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
620638

639+
#define DECLARE_TASKLET_OLD(name, _func) \
640+
struct tasklet_struct name = { \
641+
.count = ATOMIC_INIT(0), \
642+
.func = _func, \
643+
}
644+
645+
#define DECLARE_TASKLET_DISABLED_OLD(name, _func) \
646+
struct tasklet_struct name = { \
647+
.count = ATOMIC_INIT(1), \
648+
.func = _func, \
649+
}
621650

622651
enum
623652
{
@@ -686,6 +715,8 @@ extern void tasklet_kill(struct tasklet_struct *t);
686715
extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
687716
extern void tasklet_init(struct tasklet_struct *t,
688717
void (*func)(unsigned long), unsigned long data);
718+
extern void tasklet_setup(struct tasklet_struct *t,
719+
void (*callback)(struct tasklet_struct *));
689720

690721
/*
691722
* Autoprobing for irqs:

0 commit comments

Comments
 (0)