Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: hdspm: Replace tasklet with work

The tasklet is an old API that should be deprecated, usually can be
converted to another decent API. In HDSP-MADI driver, a tasklet is
still used for offloading the MIDI I/O handling (optional via mixer
switch). It can be achieved gracefully with a work queued, too.

This patch replaces the tasklet usage in HDSP-MADI driver with a
simple work. The conversion is fairly straightforward. The only
significant difference is that the work initialization is moved to the
right place in snd_hdspm_create() and cancel_work_sync() is always
called in snd_hdspm_free() to assure killing the pending works.

Link: https://lore.kernel.org/r/20200903104131.21097-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+6 -7
+6 -7
sound/pci/rme9652/hdspm.c
··· 997 997 u32 settings_register; /* cached value for AIO / RayDat (sync reference, master/slave) */ 998 998 999 999 struct hdspm_midi midi[4]; 1000 - struct tasklet_struct midi_tasklet; 1000 + struct work_struct midi_work; 1001 1001 1002 1002 size_t period_bytes; 1003 1003 unsigned char ss_in_channels; ··· 2169 2169 } 2170 2170 2171 2171 2172 - static void hdspm_midi_tasklet(struct tasklet_struct *t) 2172 + static void hdspm_midi_work(struct work_struct *work) 2173 2173 { 2174 - struct hdspm *hdspm = from_tasklet(hdspm, t, midi_tasklet); 2174 + struct hdspm *hdspm = container_of(work, struct hdspm, midi_work); 2175 2175 int i = 0; 2176 2176 2177 2177 while (i < hdspm->midiPorts) { ··· 5449 5449 } 5450 5450 5451 5451 if (schedule) 5452 - tasklet_hi_schedule(&hdspm->midi_tasklet); 5452 + queue_work(system_highpri_wq, &hdspm->midi_work); 5453 5453 } 5454 5454 5455 5455 return IRQ_HANDLED; ··· 6538 6538 hdspm->card = card; 6539 6539 6540 6540 spin_lock_init(&hdspm->lock); 6541 + INIT_WORK(&hdspm->midi_work, hdspm_midi_work); 6541 6542 6542 6543 pci_read_config_word(hdspm->pci, 6543 6544 PCI_CLASS_REVISION, &hdspm->firmware_rev); ··· 6837 6836 6838 6837 } 6839 6838 6840 - tasklet_setup(&hdspm->midi_tasklet, hdspm_midi_tasklet); 6841 - 6842 - 6843 6839 if (hdspm->io_type != MADIface) { 6844 6840 hdspm->serial = (hdspm_read(hdspm, 6845 6841 HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; ··· 6871 6873 { 6872 6874 6873 6875 if (hdspm->port) { 6876 + cancel_work_sync(&hdspm->midi_work); 6874 6877 6875 6878 /* stop th audio, and cancel all interrupts */ 6876 6879 hdspm->control_register &=