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: ua101: Replace tasklet with work

The tasklet is an old API that should be deprecated, usually can be
converted to another decent API. In UA101 driver, a tasklet is still
used for handling the output URBs. It can be achieved gracefully with
a work queued in the high-prio system workqueue, too.

This patch replaces the tasklet usage in UA101 driver with a simple
work.

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

+8 -8
+8 -8
sound/usb/misc/ua101.c
··· 96 96 u8 rate_feedback[MAX_QUEUE_LENGTH]; 97 97 98 98 struct list_head ready_playback_urbs; 99 - struct tasklet_struct playback_tasklet; 99 + struct work_struct playback_work; 100 100 wait_queue_head_t alsa_capture_wait; 101 101 wait_queue_head_t rate_feedback_wait; 102 102 wait_queue_head_t alsa_playback_wait; ··· 188 188 spin_lock_irqsave(&ua->lock, flags); 189 189 list_add_tail(&urb->ready_list, &ua->ready_playback_urbs); 190 190 if (ua->rate_feedback_count > 0) 191 - tasklet_schedule(&ua->playback_tasklet); 191 + queue_work(system_highpri_wq, &ua->playback_work); 192 192 ua->playback.substream->runtime->delay -= 193 193 urb->urb.iso_frame_desc[0].length / 194 194 ua->playback.frame_bytes; ··· 247 247 *value -= ua->playback.queue_length; 248 248 } 249 249 250 - static void playback_tasklet(struct tasklet_struct *t) 250 + static void playback_work(struct work_struct *work) 251 251 { 252 - struct ua101 *ua = from_tasklet(ua, t, playback_tasklet); 252 + struct ua101 *ua = container_of(work, struct ua101, playback_work); 253 253 unsigned long flags; 254 254 unsigned int frames; 255 255 struct ua101_urb *urb; ··· 401 401 } 402 402 if (test_bit(USB_PLAYBACK_RUNNING, &ua->states) && 403 403 !list_empty(&ua->ready_playback_urbs)) 404 - tasklet_schedule(&ua->playback_tasklet); 404 + queue_work(system_highpri_wq, &ua->playback_work); 405 405 } 406 406 407 407 spin_unlock_irqrestore(&ua->lock, flags); ··· 532 532 533 533 kill_stream_urbs(&ua->playback); 534 534 535 - tasklet_kill(&ua->playback_tasklet); 535 + cancel_work_sync(&ua->playback_work); 536 536 537 537 disable_iso_interface(ua, INTF_PLAYBACK); 538 538 } ··· 550 550 return 0; 551 551 552 552 kill_stream_urbs(&ua->playback); 553 - tasklet_kill(&ua->playback_tasklet); 553 + cancel_work_sync(&ua->playback_work); 554 554 555 555 err = enable_iso_interface(ua, INTF_PLAYBACK); 556 556 if (err < 0) ··· 1218 1218 spin_lock_init(&ua->lock); 1219 1219 mutex_init(&ua->mutex); 1220 1220 INIT_LIST_HEAD(&ua->ready_playback_urbs); 1221 - tasklet_setup(&ua->playback_tasklet, playback_tasklet); 1221 + INIT_WORK(&ua->playback_work, playback_work); 1222 1222 init_waitqueue_head(&ua->alsa_capture_wait); 1223 1223 init_waitqueue_head(&ua->rate_feedback_wait); 1224 1224 init_waitqueue_head(&ua->alsa_playback_wait);