All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: Kill tasklet usage
@ 2020-09-03 10:47 Takashi Iwai
  2020-09-03 10:47 ` [PATCH 1/3] ASoC: fsl: Replace tasklet with work Takashi Iwai
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Takashi Iwai @ 2020-09-03 10:47 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicolin Chen, Mark Brown, Shengjiu Wang, Timur Tabi, Xiubo Li

Hi,

this is another series of patches to kill tasklet usages in sound
tree, at this time, applied to ASoC drivers.
The patches are applied on top the tasklet API conversion patches,
found in topic/tasklet-convert branch of sound git tree, which will be
included in 5.9-rc4.


Takashi

===

Takashi Iwai (3):
  ASoC: fsl: Replace tasklet with work
  ASoC: sh: Replace tasklet with work
  ASoC: txx9: Replace tasklet with work

 sound/soc/fsl/fsl_esai.c  | 14 +++++++-------
 sound/soc/sh/siu.h        |  2 +-
 sound/soc/sh/siu_pcm.c    | 21 +++++++++++----------
 sound/soc/txx9/txx9aclc.c | 11 ++++++-----
 sound/soc/txx9/txx9aclc.h |  2 +-
 5 files changed, 26 insertions(+), 24 deletions(-)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] ASoC: fsl: Replace tasklet with work
  2020-09-03 10:47 [PATCH 0/3] ASoC: Kill tasklet usage Takashi Iwai
@ 2020-09-03 10:47 ` Takashi Iwai
  2020-09-09 14:16   ` Mark Brown
  2020-09-03 10:47 ` [PATCH 2/3] ASoC: sh: " Takashi Iwai
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2020-09-03 10:47 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicolin Chen, Mark Brown, Shengjiu Wang, Timur Tabi, Xiubo Li

The tasklet is an old API that should be deprecated, usually can be
converted to another decent API.  In ASoC FSL ESAI CPU DAI 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 fsl esai driver with a simple
work.  The conversion is fairly straightforward.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/fsl/fsl_esai.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 79b861afd986..39637ca78cdb 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -41,7 +41,7 @@ struct fsl_esai_soc_data {
  * @extalclk: esai clock source to derive HCK, SCK and FS
  * @fsysclk: system clock source to derive HCK, SCK and FS
  * @spbaclk: SPBA clock (optional, depending on SoC design)
- * @task: tasklet to handle the reset operation
+ * @work: work to handle the reset operation
  * @soc: soc specific data
  * @lock: spin lock between hw_reset() and trigger()
  * @fifo_depth: depth of tx/rx FIFO
@@ -67,7 +67,7 @@ struct fsl_esai {
 	struct clk *extalclk;
 	struct clk *fsysclk;
 	struct clk *spbaclk;
-	struct tasklet_struct task;
+	struct work_struct work;
 	const struct fsl_esai_soc_data *soc;
 	spinlock_t lock; /* Protect hw_reset and trigger */
 	u32 fifo_depth;
@@ -117,7 +117,7 @@ static irqreturn_t esai_isr(int irq, void *devid)
 				   ESAI_xCR_xEIE_MASK, 0);
 		regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR,
 				   ESAI_xCR_xEIE_MASK, 0);
-		tasklet_schedule(&esai_priv->task);
+		schedule_work(&esai_priv->work);
 	}
 
 	if (esr & ESAI_ESR_TINIT_MASK)
@@ -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(struct tasklet_struct *t)
+static void fsl_esai_hw_reset(struct work_struct *work)
 {
-	struct fsl_esai *esai_priv = from_tasklet(esai_priv, t, task);
+	struct fsl_esai *esai_priv = container_of(work, struct fsl_esai, work);
 	bool tx = true, rx = false, enabled[2];
 	unsigned long lock_flags;
 	u32 tfcr, rfcr;
@@ -1070,7 +1070,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	tasklet_setup(&esai_priv->task, fsl_esai_hw_reset);
+	INIT_WORK(&esai_priv->work, fsl_esai_hw_reset);
 
 	pm_runtime_enable(&pdev->dev);
 
@@ -1088,7 +1088,7 @@ static int fsl_esai_remove(struct platform_device *pdev)
 	struct fsl_esai *esai_priv = platform_get_drvdata(pdev);
 
 	pm_runtime_disable(&pdev->dev);
-	tasklet_kill(&esai_priv->task);
+	cancel_work_sync(&esai_priv->work);
 
 	return 0;
 }
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ASoC: sh: Replace tasklet with work
  2020-09-03 10:47 [PATCH 0/3] ASoC: Kill tasklet usage Takashi Iwai
  2020-09-03 10:47 ` [PATCH 1/3] ASoC: fsl: Replace tasklet with work Takashi Iwai
@ 2020-09-03 10:47 ` Takashi Iwai
  2020-09-03 10:47 ` [PATCH 3/3] ASoC: txx9: " Takashi Iwai
  2020-09-09 15:28 ` [PATCH 0/3] ASoC: Kill tasklet usage Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2020-09-03 10:47 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicolin Chen, Mark Brown, Shengjiu Wang, Timur Tabi, Xiubo Li

The tasklet is an old API that should be deprecated, usually can be
converted to another decent API.  In ASoC SH SIU 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 SH SIU driver with a simple
work.  The conversion is fairly straightforward.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/sh/siu.h     |  2 +-
 sound/soc/sh/siu_pcm.c | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h
index 63a508fdfe78..6201840f1bc0 100644
--- a/sound/soc/sh/siu.h
+++ b/sound/soc/sh/siu.h
@@ -96,7 +96,7 @@ struct siu_info {
 };
 
 struct siu_stream {
-	struct tasklet_struct		tasklet;
+	struct work_struct		work;
 	struct snd_pcm_substream	*substream;
 	snd_pcm_format_t		format;
 	size_t				buf_bytes;
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c
index 50fc7810723e..45c4320976ab 100644
--- a/sound/soc/sh/siu_pcm.c
+++ b/sound/soc/sh/siu_pcm.c
@@ -70,7 +70,7 @@ static int siu_pcm_stmwrite_start(struct siu_port *port_info)
 	siu_stream->rw_flg = RWF_STM_WT;
 
 	/* DMA transfer start */
-	tasklet_schedule(&siu_stream->tasklet);
+	queue_work(system_highpri_wq, &siu_stream->work);
 
 	return 0;
 }
@@ -93,7 +93,7 @@ static void siu_dma_tx_complete(void *arg)
 		siu_stream->cur_period * siu_stream->period_bytes,
 		siu_stream->buf_bytes, siu_stream->cookie);
 
-	tasklet_schedule(&siu_stream->tasklet);
+	queue_work(system_highpri_wq, &siu_stream->work);
 
 	/* Notify alsa: a period is done */
 	snd_pcm_period_elapsed(siu_stream->substream);
@@ -198,9 +198,10 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
 	return 0;
 }
 
-static void siu_io_tasklet(struct tasklet_struct *t)
+static void siu_io_work(struct work_struct *work)
 {
-	struct siu_stream *siu_stream = from_tasklet(siu_stream, t, tasklet);
+	struct siu_stream *siu_stream = container_of(work, struct siu_stream,
+						     work);
 	struct snd_pcm_substream *substream = siu_stream->substream;
 	struct device *dev = substream->pcm->card->dev;
 	struct snd_pcm_runtime *rt = substream->runtime;
@@ -253,7 +254,7 @@ static int siu_pcm_stmread_start(struct siu_port *port_info)
 	/* during stmread flag set */
 	siu_stream->rw_flg = RWF_STM_RD;
 
-	tasklet_schedule(&siu_stream->tasklet);
+	queue_work(system_highpri_wq, &siu_stream->work);
 
 	return 0;
 }
@@ -519,9 +520,9 @@ static int siu_pcm_new(struct snd_soc_component *component,
 
 		(*port_info)->pcm = pcm;
 
-		/* IO tasklets */
-		tasklet_setup(&(*port_info)->playback.tasklet, siu_io_tasklet);
-		tasklet_setup(&(*port_info)->capture.tasklet, siu_io_tasklet);
+		/* IO works */
+		INIT_WORK(&(*port_info)->playback.work, siu_io_work);
+		INIT_WORK(&(*port_info)->capture.work, siu_io_work);
 	}
 
 	dev_info(card->dev, "SuperH SIU driver initialized.\n");
@@ -534,8 +535,8 @@ static void siu_pcm_free(struct snd_soc_component *component,
 	struct platform_device *pdev = to_platform_device(pcm->card->dev);
 	struct siu_port *port_info = siu_ports[pdev->id];
 
-	tasklet_kill(&port_info->capture.tasklet);
-	tasklet_kill(&port_info->playback.tasklet);
+	cancel_work_sync(&port_info->capture.work);
+	cancel_work_sync(&port_info->playback.work);
 
 	siu_free_port(port_info);
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ASoC: txx9: Replace tasklet with work
  2020-09-03 10:47 [PATCH 0/3] ASoC: Kill tasklet usage Takashi Iwai
  2020-09-03 10:47 ` [PATCH 1/3] ASoC: fsl: Replace tasklet with work Takashi Iwai
  2020-09-03 10:47 ` [PATCH 2/3] ASoC: sh: " Takashi Iwai
@ 2020-09-03 10:47 ` Takashi Iwai
  2020-09-09 15:28 ` [PATCH 0/3] ASoC: Kill tasklet usage Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2020-09-03 10:47 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nicolin Chen, Mark Brown, Shengjiu Wang, Timur Tabi, Xiubo Li

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>
---
 sound/soc/txx9/txx9aclc.c | 11 ++++++-----
 sound/soc/txx9/txx9aclc.h |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c
index 939b33ec39f5..1d2d0d9b57b0 100644
--- a/sound/soc/txx9/txx9aclc.c
+++ b/sound/soc/txx9/txx9aclc.c
@@ -102,7 +102,7 @@ static void txx9aclc_dma_complete(void *arg)
 	if (dmadata->frag_count >= 0) {
 		dmadata->dmacount--;
 		if (!WARN_ON(dmadata->dmacount < 0))
-			tasklet_schedule(&dmadata->tasklet);
+			queue_work(system_highpri_wq, &dmadata->work);
 	}
 	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
 
-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_async_tx_descriptor *desc;
 	struct snd_pcm_substream *substream = dmadata->substream;
@@ -208,7 +209,7 @@ static int txx9aclc_pcm_trigger(struct snd_soc_component *component,
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		dmadata->frag_count = -1;
-		tasklet_schedule(&dmadata->tasklet);
+		queue_work(system_highpri_wq, &dmadata->work);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
@@ -352,7 +353,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev,
 			"playback" : "capture");
 		return -EBUSY;
 	}
-	tasklet_setup(&dmadata->tasklet, txx9aclc_dma_tasklet);
+	INIT_WORK(&dmadata->work, txx9aclc_dma_work);
 	return 0;
 }
 
diff --git a/sound/soc/txx9/txx9aclc.h b/sound/soc/txx9/txx9aclc.h
index 7b3d57e8e546..37c691ba56ed 100644
--- a/sound/soc/txx9/txx9aclc.h
+++ b/sound/soc/txx9/txx9aclc.h
@@ -43,7 +43,7 @@ struct txx9aclc_dmadata {
 	struct resource *dma_res;
 	struct txx9dmac_slave dma_slave;
 	struct dma_chan *dma_chan;
-	struct tasklet_struct tasklet;
+	struct work_struct work;
 	spinlock_t dma_lock;
 	int stream; /* SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE */
 	struct snd_pcm_substream *substream;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ASoC: fsl: Replace tasklet with work
  2020-09-03 10:47 ` [PATCH 1/3] ASoC: fsl: Replace tasklet with work Takashi Iwai
@ 2020-09-09 14:16   ` Mark Brown
  2020-09-09 14:21     ` Takashi Iwai
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2020-09-09 14:16 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Nicolin Chen, alsa-devel, Shengjiu Wang, Timur Tabi, Xiubo Li

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

On Thu, Sep 03, 2020 at 12:47:47PM +0200, Takashi Iwai wrote:
> The tasklet is an old API that should be deprecated, usually can be
> converted to another decent API.  In ASoC FSL ESAI CPU DAI driver, a
> tasklet is still used for offloading the hardware reset function.
> It can be achieved gracefully with a work queued, too.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ASoC: fsl: Replace tasklet with work
  2020-09-09 14:16   ` Mark Brown
@ 2020-09-09 14:21     ` Takashi Iwai
  2020-09-09 14:48       ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2020-09-09 14:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: Nicolin Chen, alsa-devel, Shengjiu Wang, Timur Tabi, Xiubo Li

On Wed, 09 Sep 2020 16:16:59 +0200,
Mark Brown wrote:
> 
> On Thu, Sep 03, 2020 at 12:47:47PM +0200, Takashi Iwai wrote:
> > The tasklet is an old API that should be deprecated, usually can be
> > converted to another decent API.  In ASoC FSL ESAI CPU DAI driver, a
> > tasklet is still used for offloading the hardware reset function.
> > It can be achieved gracefully with a work queued, too.
> 
> This doesn't apply against current code, please check and resend.

Did you merge either Linus tree (v5.9-rc4) or my topic/tasklet-convert
branch into yours beforehand?  There are tasklet API conversions
landed in 5.9-rc4, and these patches are based on it.


Takashi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] ASoC: fsl: Replace tasklet with work
  2020-09-09 14:21     ` Takashi Iwai
@ 2020-09-09 14:48       ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-09-09 14:48 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Nicolin Chen, alsa-devel, Shengjiu Wang, Timur Tabi, Xiubo Li

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

On Wed, Sep 09, 2020 at 04:21:35PM +0200, Takashi Iwai wrote:
> Mark Brown wrote:

> > This doesn't apply against current code, please check and resend.

> Did you merge either Linus tree (v5.9-rc4) or my topic/tasklet-convert
> branch into yours beforehand?  There are tasklet API conversions
> landed in 5.9-rc4, and these patches are based on it.

Yeah, since sending this I think I got your branch - I'd misread the
cover as saying it worked with that not that it was a dependency.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] ASoC: Kill tasklet usage
  2020-09-03 10:47 [PATCH 0/3] ASoC: Kill tasklet usage Takashi Iwai
                   ` (2 preceding siblings ...)
  2020-09-03 10:47 ` [PATCH 3/3] ASoC: txx9: " Takashi Iwai
@ 2020-09-09 15:28 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-09-09 15:28 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai
  Cc: Nicolin Chen, Shengjiu Wang, Timur Tabi, Xiubo Li

On Thu, 3 Sep 2020 12:47:46 +0200, Takashi Iwai wrote:
> this is another series of patches to kill tasklet usages in sound
> tree, at this time, applied to ASoC drivers.
> The patches are applied on top the tasklet API conversion patches,
> found in topic/tasklet-convert branch of sound git tree, which will be
> included in 5.9-rc4.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: fsl: Replace tasklet with work
      commit: a3d1f931ea4af3a9cae0098a957ce55293ce9ab6
[2/3] ASoC: sh: Replace tasklet with work
      commit: d668e640d50a981e35ccf0c87d2742b0ad26fe0c
[3/3] ASoC: txx9: Replace tasklet with work
      commit: dd8c0c0b37f1692a1202ea2c6f9d43aa0485faac

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-09 15:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 10:47 [PATCH 0/3] ASoC: Kill tasklet usage Takashi Iwai
2020-09-03 10:47 ` [PATCH 1/3] ASoC: fsl: Replace tasklet with work Takashi Iwai
2020-09-09 14:16   ` Mark Brown
2020-09-09 14:21     ` Takashi Iwai
2020-09-09 14:48       ` Mark Brown
2020-09-03 10:47 ` [PATCH 2/3] ASoC: sh: " Takashi Iwai
2020-09-03 10:47 ` [PATCH 3/3] ASoC: txx9: " Takashi Iwai
2020-09-09 15:28 ` [PATCH 0/3] ASoC: Kill tasklet usage Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.