ALSA: convert tasklets to use new
Subsystems (6)
v2 cover ALSA: convert tasklets to use new
Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")' introduced a new tasklet initialization API. This series converts all the sound drivers to use the new tasklet_setup() API
The series is based on 5.9-rc3 (f75aef392f86)
v2:
Fixed subject lines.
Allen Pais (10):
ALSA: core: convert tasklets to use new tasklet_setup() API
ALSA: firewire: convert tasklets to use new tasklet_setup() API
ALSA: pci/asihpi: convert tasklets to use new tasklet_setup() API
ALSA: riptide: convert tasklets to use new tasklet_setup() API
ALSA: hdsp: convert tasklets to use new tasklet_setup() API
ASoc: fsl_esai: convert tasklets to use new tasklet_setup() API
ASoC: siu: convert tasklets to use new tasklet_setup() API
ASoC: txx9: convert tasklets to use new tasklet_setup() API
ALSA: usb-audio: convert tasklets to use new tasklet_setup() API
ALSA: ua101: convert tasklets to use new tasklet_setup() API
sound/core/timer.c | 7 +++---- sound/firewire/amdtp-stream.c | 8 ++++---- sound/pci/asihpi/asihpi.c | 9 ++++----- sound/pci/riptide/riptide.c | 6 +++--- sound/pci/rme9652/hdsp.c | 6 +++--- sound/pci/rme9652/hdspm.c | 7 +++---- sound/soc/fsl/fsl_esai.c | 7 +++---- sound/soc/sh/siu_pcm.c | 10 ++++------ sound/soc/txx9/txx9aclc.c | 7 +++---- sound/usb/midi.c | 7 +++---- sound/usb/misc/ua101.c | 7 +++---- 11 files changed, 36 insertions(+), 45 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/10 ALSA: core: convert tasklets to use new tasklet_setup() API
In preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/core/timer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/core/timer.c +3 -4
@@ -816,9 +816,9 @@ static void snd_timer_clear_callbacks(struct snd_timer *timer,* timer tasklet * */ -static void snd_timer_tasklet (unsigned long arg) +static void snd_timer_tasklet (struct tasklet_struct *t) { -struct snd_timer *timer = (struct snd_timer *) arg; +struct snd_timer *timer =from_tasklet (timer, t, task_queue);unsigned long flags;if (timer->card && timer->card->shutdown) {
@@ -967,8 +967,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid,INIT_LIST_HEAD (&timer->ack_list_head);INIT_LIST_HEAD (&timer->sack_list_head);spin_lock_init (&timer->lock); -tasklet_init (&timer->task_queue, snd_timer_tasklet, - (unsigned long )timer); +tasklet_setup (&timer->task_queue, snd_timer_tasklet); timer->max_instances =1000 ;/* default limit per timer */ if (card !=NULL ) { timer->module = card->module;
Signature · 1 line
2.25.1
PATCH v2 2/10 ALSA: firewire: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/firewire/amdtp-stream.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/firewire/amdtp-stream.c +4 -4
@@ -64,7 +64,7 @@#define IT_PKT_HEADER_SIZE_CIP 8 // For 2 CIP header.#define IT_PKT_HEADER_SIZE_NO_CIP 0 // Nothing. -static void pcm_period_tasklet (unsigned long data); +static void pcm_period_tasklet (struct tasklet_struct *t);/** * amdtp_stream_init - initialize an AMDTP stream structure
@@ -94,7 +94,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, s->flags = flags; s->context =ERR_PTR (-1 );mutex_init (&s->mutex); -tasklet_init (&s->period_tasklet, pcm_period_tasklet, (unsigned long )s); +tasklet_setup (&s->period_tasklet, pcm_period_tasklet); s->packet_index =0 ;init_waitqueue_head (&s->callback_wait);
@@ -441,9 +441,9 @@ static void update_pcm_pointers(struct amdtp_stream *s, } } -static void pcm_period_tasklet (unsigned long data) +static void pcm_period_tasklet (struct tasklet_struct *t) { -struct amdtp_stream *s = (void *)data; +struct amdtp_stream *s =from_tasklet (s, t, period_tasklet);struct snd_pcm_substream *pcm =READ_ONCE (s->pcm);if (pcm)
Signature · 1 line
2.25.1
Re: [PATCH v2 02/10] ALSA: firewire: convert tasklets to use new tasklet_setup() API
Hi,
Quoted 10 lines · Allen Pais
In preparation for unconditionally passing the struct
tasklet_structpointer to all tasklet callbacks, switch to using the newtasklet_setup()andfrom_tasklet()to pass the tasklet pointer explicitly.Signed-off-by Romain Perier <[email protected]>Signed-off-by Allen Pais <[email protected]>--- sound/firewire/amdtp-stream.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
This looks good to me.
To Iwai-san,
I'm review your patch in 'test/kill-tasklet' branch in sound.git[1]. Although I agree with the direction to obsolete tasklet usage with workqueue, 'in_interrupt()' helper function is used in two lines in 'sound/firewire/amdtp-stream.c' since it's convenient to distinguish running context (any softirq or user task). We need enough care of the cases about which below two patches mention:
* 1dba9db0eaa6 ('ALSA: firewire-lib: permit to flush queued packets only in process context for better PCM period granularity')
* 4a9bfafc64f4 ('ALSA: firewire-lib: Fix stall of process context at packet error)
As long as I know, we have no helper function to distinguish workqueue task from user task. The simple replacement is not good way in the case. I'm investigating better solution but not find yet...
Thanks
Takashi Sakamoto
Re: [PATCH v2 02/10] ALSA: firewire: convert tasklets to use new tasklet_setup() API
Quoted 10 lines · Takashi Sakamoto
To Iwai-san,
I'm review your patch in 'test/kill-tasklet' branch in sound.git[1]. Although I agree with the direction to obsolete tasklet usage with workqueue, '
in_interrupt()' helper function is used in two lines in 'sound/firewire/amdtp-stream.c' since it's convenient to distinguish running context (any softirq or user task). We need enough care of the cases about which below two patches mention:
Quoted 7 lines
*
1dba9db0eaa6('ALSA: firewire-lib: permit to flush queued packets only in process context for better PCM period granularity')
*4a9bfafc64f4('ALSA: firewire-lib: Fix stall of process context at packet error)As long as I know, we have no helper function to distinguish workqueue task from user task. The simple replacement is not good way in the case.
Thanks for pointing this out, it was indeed an overlook.
We can use current_work() to check whether the current task comes from the dedicated work or not, e.g.
if (current_work() == &myobject->some_work) its_from_my_work();
Takashi
PATCH v2 3/10 ALSA: pci/asihpi: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/pci/asihpi/asihpi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
sound/pci/asihpi/asihpi.c +4 -5
@@ -921,10 +921,10 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)add_timer (&dpcm->timer); } -static void snd_card_asihpi_int_task (unsigned long data) +static void snd_card_asihpi_int_task (struct tasklet_struct *t) { -struct hpi_adapter *a = (struct hpi_adapter *)data; -struct snd_card_asihpi *asihpi; +struct snd_card_asihpi *asihpi =from_tasklet (asihpi, t, t); +struct hpi_adapter *a = asihpi->hpi;WARN_ON (!a || !a->snd_card || !a->snd_card->private_data); asihpi = (struct snd_card_asihpi *)a->snd_card->private_data;
@@ -2871,8 +2871,7 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev,if (hpi->interrupt_mode) { asihpi->pcm_start = snd_card_asihpi_pcm_int_start; asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop; -tasklet_init (&asihpi->t, snd_card_asihpi_int_task, - (unsigned long )hpi); +tasklet_setup (&asihpi->t, snd_card_asihpi_int_task); hpi->interrupt_callback = snd_card_asihpi_isr; }else { asihpi->pcm_start = snd_card_asihpi_pcm_timer_start;
Signature · 1 line
2.25.1
PATCH v2 4/10 ALSA: riptide: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/pci/riptide/riptide.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/pci/riptide/riptide.c +3 -3
@@ -1070,9 +1070,9 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval,return 0 ; } -static void riptide_handleirq (unsigned long dev_id) +static void riptide_handleirq (struct tasklet_struct *t) { -struct snd_riptide *chip = (void *)dev_id; +struct snd_riptide *chip =from_tasklet (chip, t, riptide_tq);struct cmdif *cif = chip->cif;struct snd_pcm_substream *substream[PLAYBACK_SUBSTREAMS +1 ];struct snd_pcm_runtime *runtime;
@@ -1843,7 +1843,7 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci, chip->received_irqs =0 ; chip->handled_irqs =0 ; chip->cif =NULL ; -tasklet_init (&chip->riptide_tq, riptide_handleirq, (unsigned long )chip); +tasklet_setup (&chip->riptide_tq, riptide_handleirq);if ((chip->res_port =request_region (chip->port,64 ,"RIPTIDE" )) ==NULL ) {
Signature · 1 line
2.25.1
PATCH v2 5/10 ALSA: hdsp: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/pci/rme9652/hdsp.c | 6 +++--- sound/pci/rme9652/hdspm.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-)
sound/pci/rme9652/hdsp.c +3 -3
@@ -3791,9 +3791,9 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp)return 0 ; } -static void hdsp_midi_tasklet (unsigned long arg) +static void hdsp_midi_tasklet (struct tasklet_struct *t) { -struct hdsp *hdsp = (struct hdsp *)arg; +struct hdsp *hdsp =from_tasklet (hdsp, t, midi_tasklet);if (hdsp->midi[0 ].pending)snd_hdsp_midi_input_read (&hdsp->midi[0 ]);
@@ -5182,7 +5182,7 @@ static int snd_hdsp_create(struct snd_card *card,spin_lock_init (&hdsp->lock); -tasklet_init (&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long )hdsp); +tasklet_setup (&hdsp->midi_tasklet, hdsp_midi_tasklet);pci_read_config_word (hdsp->pci,PCI_CLASS_REVISION , &hdsp->firmware_rev); hdsp->firmware_rev &=0xff ;
sound/pci/rme9652/hdspm.c +3 -4
@@ -2169,9 +2169,9 @@ static int snd_hdspm_create_midi(struct snd_card *card, } -static void hdspm_midi_tasklet (unsigned long arg) +static void hdspm_midi_tasklet (struct tasklet_struct *t) { -struct hdspm *hdspm = (struct hdspm *)arg; +struct hdspm *hdspm =from_tasklet (hdspm, t, midi_tasklet);int i =0 ;while (i < hdspm->midiPorts) {
@@ -6836,8 +6836,7 @@ static int snd_hdspm_create(struct snd_card *card, } -tasklet_init (&hdspm->midi_tasklet, - hdspm_midi_tasklet, (unsigned long ) hdspm); +tasklet_setup (&hdspm->midi_tasklet, hdspm_midi_tasklet);if (hdspm->io_type != MADIface) {
Signature · 1 line
2.25.1
PATCH v2 6/10 ASoc: fsl_esai: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/soc/fsl/fsl_esai.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/fsl/fsl_esai.c +3 -4
@@ -708,9 +708,9 @@ static void fsl_esai_trigger_stop(struct fsl_esai *esai_priv, bool tx) ESAI_xFCR_xFR, 0); } -static void fsl_esai_hw_reset (unsigned long arg) +static void fsl_esai_hw_reset (struct tasklet_struct *t) { -struct fsl_esai *esai_priv = (struct fsl_esai *)arg; +struct fsl_esai *esai_priv =from_tasklet (esai_priv, t, task);bool tx = true, rx = false, enabled[2 ];unsigned long lock_flags;u32 tfcr, rfcr;
@@ -1070,8 +1070,7 @@ static int fsl_esai_probe(struct platform_device *pdev)return ret; } -tasklet_init (&esai_priv->task, fsl_esai_hw_reset, - (unsigned long )esai_priv); +tasklet_setup (&esai_priv->task, fsl_esai_hw_reset);pm_runtime_enable (&pdev->dev);
Signature · 1 line
2.25.1
Re: [PATCH v2 06/10] ASoc: fsl_esai: convert tasklets to use new tasklet_setup() API
Quoted 4 lines · Allen Pais
In preparation for unconditionally passing the struct
tasklet_structpointer to all tasklet callbacks, switch to using the newtasklet_setup()andfrom_tasklet()to pass the tasklet pointer explicitly.
PATCH v2 7/10 ASoC: siu: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/soc/sh/siu_pcm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
sound/soc/sh/siu_pcm.c +4 -6
@@ -198,9 +198,9 @@ static int siu_pcm_rd_set(struct siu_port *port_info,return 0 ; } -static void siu_io_tasklet (unsigned long data) +static void siu_io_tasklet (struct tasklet_struct *t) { -struct siu_stream *siu_stream = (struct siu_stream *)data; +struct siu_stream *siu_stream =from_tasklet (siu_stream, t, tasklet);struct snd_pcm_substream *substream = siu_stream->substream;struct device *dev = substream->pcm->card->dev;struct snd_pcm_runtime *rt = substream->runtime;
@@ -520,10 +520,8 @@ static int siu_pcm_new(struct snd_soc_component *component, (*port_info)->pcm = pcm;/* IO tasklets */ -tasklet_init (&(*port_info)->playback.tasklet, siu_io_tasklet, - (unsigned long )&(*port_info)->playback); -tasklet_init (&(*port_info)->capture.tasklet, siu_io_tasklet, - (unsigned long )&(*port_info)->capture); +tasklet_setup (&(*port_info)->playback.tasklet, siu_io_tasklet); +tasklet_setup (&(*port_info)->capture.tasklet, siu_io_tasklet); }dev_info (card->dev,"SuperH SIU driver initialized.\n" );
Signature · 1 line
2.25.1
Re: [PATCH v2 07/10] ASoC: siu: convert tasklets to use new tasklet_setup() API
Quoted 4 lines · Allen Pais
In preparation for unconditionally passing the struct
tasklet_structpointer to all tasklet callbacks, switch to using the newtasklet_setup()andfrom_tasklet()to pass the tasklet pointer explicitly.
PATCH v2 8/10 ASoC: txx9: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/soc/txx9/txx9aclc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/txx9/txx9aclc.c +3 -4
@@ -134,9 +134,9 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr)#define NR_DMA_CHAIN 2 -static void txx9aclc_dma_tasklet (unsigned long data) +static void txx9aclc_dma_tasklet (struct tasklet_struct *t) { -struct txx9aclc_dmadata *dmadata = (struct txx9aclc_dmadata *)data; +struct txx9aclc_dmadata *dmadata =from_tasklet (dmadata, t, tasklet);struct dma_chan *chan = dmadata->dma_chan;struct dma_async_tx_descriptor *desc;struct snd_pcm_substream *substream = dmadata->substream;
@@ -352,8 +352,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev, "playback" : "capture"); return -EBUSY ; } -tasklet_init (&dmadata->tasklet, txx9aclc_dma_tasklet, - (unsigned long )dmadata); +tasklet_setup (&dmadata->tasklet, txx9aclc_dma_tasklet);return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH v2 08/10] ASoC: txx9: convert tasklets to use new tasklet_setup() API
Quoted 4 lines · Allen Pais
In preparation for unconditionally passing the struct
tasklet_structpointer to all tasklet callbacks, switch to using the newtasklet_setup()andfrom_tasklet()to pass the tasklet pointer explicitly.
PATCH v2 9/10 ALSA: usb-audio: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/usb/midi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/usb/midi.c +3 -4
@@ -344,10 +344,9 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep)spin_unlock_irqrestore (&ep->buffer_lock, flags); } -static void snd_usbmidi_out_tasklet (unsigned long data) +static void snd_usbmidi_out_tasklet (struct tasklet_struct *t) { -struct snd_usb_midi_out_endpoint *ep = - (struct snd_usb_midi_out_endpoint *) data; +struct snd_usb_midi_out_endpoint *ep =from_tasklet (ep, t, tasklet);snd_usbmidi_do_output (ep); }
@@ -1441,7 +1440,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi, }spin_lock_init (&ep->buffer_lock); -tasklet_init (&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long )ep); +tasklet_setup (&ep->tasklet, snd_usbmidi_out_tasklet);init_waitqueue_head (&ep->drain_wait);for (i =0 ; i <0x10 ; ++i)
Signature · 1 line
2.25.1
PATCH v2 10/10 ALSA: ua101: convert tasklets to use new tasklet_setup() API
In reply to Allen PaisIn preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly.
--- sound/usb/misc/ua101.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/usb/misc/ua101.c +3 -4
@@ -247,9 +247,9 @@ static inline void add_with_wraparound(struct ua101 *ua, *value -= ua->playback.queue_length; } -static void playback_tasklet (unsigned long data) +static void playback_tasklet (struct tasklet_struct *t) { -struct ua101 *ua = (void *)data; +struct ua101 *ua =from_tasklet (ua, t, playback_tasklet);unsigned long flags;unsigned int frames;struct ua101_urb *urb;
@@ -1218,8 +1218,7 @@ static int ua101_probe(struct usb_interface *interface,spin_lock_init (&ua->lock);mutex_init (&ua->mutex);INIT_LIST_HEAD (&ua->ready_playback_urbs); -tasklet_init (&ua->playback_tasklet, - playback_tasklet, (unsigned long )ua); +tasklet_setup (&ua->playback_tasklet, playback_tasklet);init_waitqueue_head (&ua->alsa_capture_wait);init_waitqueue_head (&ua->rate_feedback_wait);init_waitqueue_head (&ua->alsa_playback_wait);
Signature · 1 line
2.25.1
Quoted 10 lines · Allen Pais
Commit
12cc923f1ccc("tasklet: Introduce new initialization API")' introduced a new tasklet initialization API. This series converts all the sound drivers to use the newtasklet_setup()APIThe series is based on 5.9-rc3 (
f75aef392f86)v2:
Fixed subject lines.
Quoted 11 lines
Allen Pais (10):
ALSA: core: convert tasklets to use newtasklet_setup()API
ALSA: firewire: convert tasklets to use newtasklet_setup()API
ALSA: pci/asihpi: convert tasklets to use newtasklet_setup()API
ALSA: riptide: convert tasklets to use newtasklet_setup()API
ALSA: hdsp: convert tasklets to use newtasklet_setup()API
ASoc:fsl_esai: convert tasklets to use newtasklet_setup()API
ASoC: siu: convert tasklets to use newtasklet_setup()API
ASoC: txx9: convert tasklets to use newtasklet_setup()API
ALSA: usb-audio: convert tasklets to use newtasklet_setup()API
ALSA: ua101: convert tasklets to use newtasklet_setup()API
Thanks, now applied all 10 patches.
Mark, the applied branch is found in topic/tasklet-convert. If you need for further development of ASoC stuff, feel free to pull in. Meanwhile the branch will be merged into my for-linus branch and for-next branch, and will be likely included in the next pull request in this week.
Takashi