ASoC: txx9: Replace tasklet with work
The tasklet is an old API that should be deprecated, usually can be converted to another decent API. In ASoC TXx9 ACLC driver, a tasklet is still used for offloading the hardware reset function. It can be achieved gracefully with a work queued, too. This patch replaces the tasklet usage in TXx9 ACLC driver with a simple work. The conversion is fairly straightforward. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20200903104749.21435-4-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d668e640d5
commit
dd8c0c0b37
|
@ -102,7 +102,7 @@ static void txx9aclc_dma_complete(void *arg)
|
||||||
if (dmadata->frag_count >= 0) {
|
if (dmadata->frag_count >= 0) {
|
||||||
dmadata->dmacount--;
|
dmadata->dmacount--;
|
||||||
if (!WARN_ON(dmadata->dmacount < 0))
|
if (!WARN_ON(dmadata->dmacount < 0))
|
||||||
tasklet_schedule(&dmadata->tasklet);
|
queue_work(system_highpri_wq, &dmadata->work);
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&dmadata->dma_lock, flags);
|
spin_unlock_irqrestore(&dmadata->dma_lock, flags);
|
||||||
}
|
}
|
||||||
|
@ -134,9 +134,10 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr)
|
||||||
|
|
||||||
#define NR_DMA_CHAIN 2
|
#define NR_DMA_CHAIN 2
|
||||||
|
|
||||||
static void txx9aclc_dma_tasklet(struct tasklet_struct *t)
|
static void txx9aclc_dma_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct txx9aclc_dmadata *dmadata = from_tasklet(dmadata, t, tasklet);
|
struct txx9aclc_dmadata *dmadata =
|
||||||
|
container_of(work, struct txx9aclc_dmadata, work);
|
||||||
struct dma_chan *chan = dmadata->dma_chan;
|
struct dma_chan *chan = dmadata->dma_chan;
|
||||||
struct dma_async_tx_descriptor *desc;
|
struct dma_async_tx_descriptor *desc;
|
||||||
struct snd_pcm_substream *substream = dmadata->substream;
|
struct snd_pcm_substream *substream = dmadata->substream;
|
||||||
|
@ -208,7 +209,7 @@ static int txx9aclc_pcm_trigger(struct snd_soc_component *component,
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SNDRV_PCM_TRIGGER_START:
|
case SNDRV_PCM_TRIGGER_START:
|
||||||
dmadata->frag_count = -1;
|
dmadata->frag_count = -1;
|
||||||
tasklet_schedule(&dmadata->tasklet);
|
queue_work(system_highpri_wq, &dmadata->work);
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_TRIGGER_STOP:
|
case SNDRV_PCM_TRIGGER_STOP:
|
||||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||||
|
@ -352,7 +353,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev,
|
||||||
"playback" : "capture");
|
"playback" : "capture");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
tasklet_setup(&dmadata->tasklet, txx9aclc_dma_tasklet);
|
INIT_WORK(&dmadata->work, txx9aclc_dma_work);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct txx9aclc_dmadata {
|
||||||
struct resource *dma_res;
|
struct resource *dma_res;
|
||||||
struct txx9dmac_slave dma_slave;
|
struct txx9dmac_slave dma_slave;
|
||||||
struct dma_chan *dma_chan;
|
struct dma_chan *dma_chan;
|
||||||
struct tasklet_struct tasklet;
|
struct work_struct work;
|
||||||
spinlock_t dma_lock;
|
spinlock_t dma_lock;
|
||||||
int stream; /* SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE */
|
int stream; /* SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE */
|
||||||
struct snd_pcm_substream *substream;
|
struct snd_pcm_substream *substream;
|
||||||
|
|
Loading…
Reference in New Issue