linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup()
@ 2020-08-17  8:34 Allen Pais
  2020-08-17  8:34 ` [PATCH 01/10] mmc: atmel-mci: convert tasklets to use new tasklet_setup() API Allen Pais
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:34 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais

Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts 
all the mmc drivers to use the new tasklet_setup() API

Allen Pais (10):
  mmc: atmel-mci: convert tasklets to use new tasklet_setup() API
  mmc: au1xmmc: convert tasklets to use new tasklet_setup() API
  mmc: cb710: convert tasklets to use new tasklet_setup() API
  mmc: dw_mmc: convert tasklets to use new tasklet_setup() API
  mmc: omap: convert tasklets to use new tasklet_setup() API
  mmc: renesas: convert tasklets to use new tasklet_setup() API
  mmc: s3cmci: convert tasklets to use new tasklet_setup() API
  mmc: tifm_sd: convert tasklets to use new tasklet_setup() API
  mmc: uniphier: convert tasklets to use new tasklet_setup() API
  mmc: via-sdmmc: convert tasklets to use new tasklet_setup() API

 drivers/mmc/host/atmel-mci.c                  |  6 +++---
 drivers/mmc/host/au1xmmc.c                    | 15 ++++++--------
 drivers/mmc/host/cb710-mmc.c                  | 11 +++++-----
 drivers/mmc/host/dw_mmc.c                     |  6 +++---
 drivers/mmc/host/omap.c                       |  7 +++----
 drivers/mmc/host/renesas_sdhi.h               |  1 +
 drivers/mmc/host/renesas_sdhi_core.c          |  2 ++
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 20 +++++++++----------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c      |  9 ++++-----
 drivers/mmc/host/s3cmci.c                     |  6 +++---
 drivers/mmc/host/tifm_sd.c                    |  7 +++----
 drivers/mmc/host/uniphier-sd.c                | 14 ++++++-------
 drivers/mmc/host/via-sdmmc.c                  |  7 +++----
 13 files changed, 53 insertions(+), 58 deletions(-)

-- 
2.17.1


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

* [PATCH 01/10] mmc: atmel-mci: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
@ 2020-08-17  8:34 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 02/10] mmc: au1xmmc: " Allen Pais
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:34 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/atmel-mci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 300901415aa2..562cf8eb993f 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1719,9 +1719,9 @@ static void atmci_detect_change(struct timer_list *t)
 	}
 }
 
-static void atmci_tasklet_func(unsigned long priv)
+static void atmci_tasklet_func(struct tasklet_struct *t)
 {
-	struct atmel_mci	*host = (struct atmel_mci *)priv;
+	struct atmel_mci	*host = from_tasklet(host, t, tasklet);
 	struct mmc_request	*mrq = host->mrq;
 	struct mmc_data		*data = host->data;
 	enum atmel_mci_state	state = host->state;
@@ -2496,7 +2496,7 @@ static int atmci_probe(struct platform_device *pdev)
 
 	host->mapbase = regs->start;
 
-	tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)host);
+	tasklet_setup(&host->tasklet, atmci_tasklet_func);
 
 	ret = request_irq(irq, atmci_interrupt, 0, dev_name(&pdev->dev), host);
 	if (ret) {
-- 
2.17.1


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

* [PATCH 02/10] mmc: au1xmmc: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
  2020-08-17  8:34 ` [PATCH 01/10] mmc: atmel-mci: convert tasklets to use new tasklet_setup() API Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 03/10] mmc: cb710: " Allen Pais
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/au1xmmc.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index 9bb1910268ca..f9b1d69290a3 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -253,9 +253,9 @@ static void au1xmmc_finish_request(struct au1xmmc_host *host)
 	mmc_request_done(host->mmc, mrq);
 }
 
-static void au1xmmc_tasklet_finish(unsigned long param)
+static void au1xmmc_tasklet_finish(struct tasklet_struct *t)
 {
-	struct au1xmmc_host *host = (struct au1xmmc_host *) param;
+	struct au1xmmc_host *host = from_tasklet(host, t, finish_task);
 	au1xmmc_finish_request(host);
 }
 
@@ -363,9 +363,9 @@ static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status)
 	au1xmmc_finish_request(host);
 }
 
-static void au1xmmc_tasklet_data(unsigned long param)
+static void au1xmmc_tasklet_data(struct tasklet_struct *t)
 {
-	struct au1xmmc_host *host = (struct au1xmmc_host *)param;
+	struct au1xmmc_host *host = from_tasklet(host, t, data_task);
 
 	u32 status = __raw_readl(HOST_STATUS(host));
 	au1xmmc_data_complete(host, status);
@@ -1037,11 +1037,8 @@ static int au1xmmc_probe(struct platform_device *pdev)
 	if (host->platdata)
 		mmc->caps &= ~(host->platdata->mask_host_caps);
 
-	tasklet_init(&host->data_task, au1xmmc_tasklet_data,
-			(unsigned long)host);
-
-	tasklet_init(&host->finish_task, au1xmmc_tasklet_finish,
-			(unsigned long)host);
+	tasklet_setup(&host->data_task, au1xmmc_tasklet_data);
+	tasklet_setup(&host->finish_task, au1xmmc_tasklet_finish);
 
 	if (has_dbdma()) {
 		ret = au1xmmc_dbdma_init(host);
-- 
2.17.1


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

* [PATCH 03/10] mmc: cb710: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
  2020-08-17  8:34 ` [PATCH 01/10] mmc: atmel-mci: convert tasklets to use new tasklet_setup() API Allen Pais
  2020-08-17  8:35 ` [PATCH 02/10] mmc: au1xmmc: " Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 04/10] mmc: dw_mmc: " Allen Pais
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/cb710-mmc.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index e84ed84ea4cc..3e8fd2850794 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -646,11 +646,12 @@ static int cb710_mmc_irq_handler(struct cb710_slot *slot)
 	return 1;
 }
 
-static void cb710_mmc_finish_request_tasklet(unsigned long data)
+static void cb710_mmc_finish_request_tasklet(struct tasklet_struct *t)
 {
-	struct mmc_host *mmc = (void *)data;
-	struct cb710_mmc_reader *reader = mmc_priv(mmc);
+	struct cb710_mmc_reader *reader = from_tasklet(reader, t,
+						       finish_req_tasklet);
 	struct mmc_request *mrq = reader->mrq;
+	struct mmc_host *mmc = mrq->host;
 
 	reader->mrq = NULL;
 	mmc_request_done(mmc, mrq);
@@ -718,8 +719,8 @@ static int cb710_mmc_init(struct platform_device *pdev)
 
 	reader = mmc_priv(mmc);
 
-	tasklet_init(&reader->finish_req_tasklet,
-		cb710_mmc_finish_request_tasklet, (unsigned long)mmc);
+	tasklet_setup(&reader->finish_req_tasklet,
+		      cb710_mmc_finish_request_tasklet);
 	spin_lock_init(&reader->irq_lock);
 	cb710_dump_regs(chip, CB710_DUMP_REGS_MMC);
 
-- 
2.17.1


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

* [PATCH 04/10] mmc: dw_mmc: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
                   ` (2 preceding siblings ...)
  2020-08-17  8:35 ` [PATCH 03/10] mmc: cb710: " Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 05/10] mmc: omap: " Allen Pais
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/dw_mmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 35ae5737c622..574e5a7a697c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1952,9 +1952,9 @@ static bool dw_mci_clear_pending_data_complete(struct dw_mci *host)
 	return true;
 }
 
-static void dw_mci_tasklet_func(unsigned long priv)
+static void dw_mci_tasklet_func(struct tasklet_struct *t)
 {
-	struct dw_mci *host = (struct dw_mci *)priv;
+	struct dw_mci *host = from_tasklet(host, t, tasklet);
 	struct mmc_data	*data;
 	struct mmc_command *cmd;
 	struct mmc_request *mrq;
@@ -3312,7 +3312,7 @@ int dw_mci_probe(struct dw_mci *host)
 	else
 		host->fifo_reg = host->regs + DATA_240A_OFFSET;
 
-	tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
+	tasklet_setup(&host->tasklet, dw_mci_tasklet_func);
 	ret = devm_request_irq(host->dev, host->irq, dw_mci_interrupt,
 			       host->irq_flags, "dw-mci", host);
 	if (ret)
-- 
2.17.1


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

* [PATCH 05/10] mmc: omap: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
                   ` (3 preceding siblings ...)
  2020-08-17  8:35 ` [PATCH 04/10] mmc: dw_mmc: " Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 06/10] mmc: renesas: " Allen Pais
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/omap.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 33d7af7c7762..9852263cef4d 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -878,9 +878,9 @@ static void mmc_omap_cover_timer(struct timer_list *t)
 	tasklet_schedule(&slot->cover_tasklet);
 }
 
-static void mmc_omap_cover_handler(unsigned long param)
+static void mmc_omap_cover_handler(struct tasklet_struct *t)
 {
-	struct mmc_omap_slot *slot = (struct mmc_omap_slot *)param;
+	struct mmc_omap_slot *slot = from_tasklet(slot, t, cover_tasklet);
 	int cover_open = mmc_omap_cover_is_open(slot);
 
 	mmc_detect_change(slot->mmc, 0);
@@ -1269,8 +1269,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
 
 	if (slot->pdata->get_cover_state != NULL) {
 		timer_setup(&slot->cover_timer, mmc_omap_cover_timer, 0);
-		tasklet_init(&slot->cover_tasklet, mmc_omap_cover_handler,
-			     (unsigned long)slot);
+		tasklet_setup(&slot->cover_tasklet, mmc_omap_cover_handler);
 	}
 
 	r = mmc_add_host(mmc);
-- 
2.17.1


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

* [PATCH 06/10] mmc: renesas: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
                   ` (4 preceding siblings ...)
  2020-08-17  8:35 ` [PATCH 05/10] mmc: omap: " Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 07/10] mmc: s3cmci: " Allen Pais
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/renesas_sdhi.h               |  1 +
 drivers/mmc/host/renesas_sdhi_core.c          |  2 ++
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 20 +++++++++----------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c      |  9 ++++-----
 4 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index 14c64caefc64..79a86bccc0ec 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -48,6 +48,7 @@ struct tmio_mmc_dma {
 };
 
 struct renesas_sdhi {
+	struct platform_device *pdev;
 	struct clk *clk;
 	struct clk *clk_cd;
 	struct tmio_mmc_data mmc_data;
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 15e21894bd44..4a9319743eb6 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -975,6 +975,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 			goto eirq;
 	}
 
+	priv->pdev = pdev;
+
 	dev_info(&pdev->dev, "%s base at %pa, max clock rate %u MHz\n",
 		 mmc_hostname(host->mmc), &res->start, host->mmc->f_max / 1000000);
 
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 32ab991544ef..3d8866581043 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -218,9 +218,9 @@ renesas_sdhi_internal_dmac_start_dma(struct tmio_mmc_host *host,
 	renesas_sdhi_internal_dmac_enable_dma(host, false);
 }
 
-static void renesas_sdhi_internal_dmac_issue_tasklet_fn(unsigned long arg)
+static void renesas_sdhi_internal_dmac_issue_tasklet_fn(struct tasklet_struct *t)
 {
-	struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg;
+	struct tmio_mmc_host *host = from_tasklet(host, t, dma_issue);
 
 	tmio_mmc_enable_mmc_irqs(host, TMIO_STAT_DATAEND);
 
@@ -255,9 +255,11 @@ static bool renesas_sdhi_internal_dmac_complete(struct tmio_mmc_host *host)
 	return true;
 }
 
-static void renesas_sdhi_internal_dmac_complete_tasklet_fn(unsigned long arg)
+static void renesas_sdhi_internal_dmac_complete_tasklet_fn(struct tasklet_struct *t)
 {
-	struct tmio_mmc_host *host = (struct tmio_mmc_host *)arg;
+	struct renesas_sdhi *priv = from_tasklet(priv, t,
+						 dma_priv.dma_complete);
+	struct tmio_mmc_host *host = platform_get_drvdata(priv->pdev);
 
 	spin_lock_irq(&host->lock);
 	if (!renesas_sdhi_internal_dmac_complete(host))
@@ -289,12 +291,10 @@ renesas_sdhi_internal_dmac_request_dma(struct tmio_mmc_host *host,
 	/* Each value is set to non-zero to assume "enabling" each DMA */
 	host->chan_rx = host->chan_tx = (void *)0xdeadbeaf;
 
-	tasklet_init(&priv->dma_priv.dma_complete,
-		     renesas_sdhi_internal_dmac_complete_tasklet_fn,
-		     (unsigned long)host);
-	tasklet_init(&host->dma_issue,
-		     renesas_sdhi_internal_dmac_issue_tasklet_fn,
-		     (unsigned long)host);
+	tasklet_setup(&priv->dma_priv.dma_complete,
+		     renesas_sdhi_internal_dmac_complete_tasklet_fn);
+	tasklet_setup(&host->dma_issue,
+		     renesas_sdhi_internal_dmac_issue_tasklet_fn);
 }
 
 static void
diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index 13ff023fbee9..cd638e638db6 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -310,9 +310,9 @@ static void renesas_sdhi_sys_dmac_start_dma(struct tmio_mmc_host *host,
 	}
 }
 
-static void renesas_sdhi_sys_dmac_issue_tasklet_fn(unsigned long priv)
+static void renesas_sdhi_sys_dmac_issue_tasklet_fn(struct tasklet_struct *t)
 {
-	struct tmio_mmc_host *host = (struct tmio_mmc_host *)priv;
+	struct tmio_mmc_host *host = from_tasklet(host, t, dma_issue);
 	struct dma_chan *chan = NULL;
 
 	spin_lock_irq(&host->lock);
@@ -399,9 +399,8 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host,
 			goto ebouncebuf;
 
 		init_completion(&priv->dma_priv.dma_dataend);
-		tasklet_init(&host->dma_issue,
-			     renesas_sdhi_sys_dmac_issue_tasklet_fn,
-			     (unsigned long)host);
+		tasklet_setup(&host->dma_issue,
+			     renesas_sdhi_sys_dmac_issue_tasklet_fn);
 	}
 
 	renesas_sdhi_sys_dmac_enable_dma(host, true);
-- 
2.17.1


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

* [PATCH 07/10] mmc: s3cmci: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
                   ` (5 preceding siblings ...)
  2020-08-17  8:35 ` [PATCH 06/10] mmc: renesas: " Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 08/10] mmc: tifm_sd: " Allen Pais
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/s3cmci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index 444b2769ae2c..7540221d402d 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -549,9 +549,9 @@ static void do_pio_write(struct s3cmci_host *host)
 	enable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
 }
 
-static void pio_tasklet(unsigned long data)
+static void pio_tasklet(struct tasklet_struct *t)
 {
-	struct s3cmci_host *host = (struct s3cmci_host *) data;
+	struct s3cmci_host *host = from_tasklet(host, t, pio_tasklet);
 
 	s3cmci_disable_irq(host, true);
 
@@ -1565,7 +1565,7 @@ static int s3cmci_probe(struct platform_device *pdev)
 	host->pdata = pdev->dev.platform_data;
 
 	spin_lock_init(&host->complete_lock);
-	tasklet_init(&host->pio_tasklet, pio_tasklet, (unsigned long) host);
+	tasklet_setup(&host->pio_tasklet, pio_tasklet);
 
 	if (host->is2440) {
 		host->sdiimsk	= S3C2440_SDIIMSK;
-- 
2.17.1


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

* [PATCH 08/10] mmc: tifm_sd: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
                   ` (6 preceding siblings ...)
  2020-08-17  8:35 ` [PATCH 07/10] mmc: s3cmci: " Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17  8:35 ` [PATCH 09/10] mmc: uniphier: " Allen Pais
  2020-08-17 12:53 ` [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Masahiro Yamada
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/tifm_sd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index 5987656e0474..c64cf12b117a 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -731,9 +731,9 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq)
 	mmc_request_done(mmc, mrq);
 }
 
-static void tifm_sd_end_cmd(unsigned long data)
+static void tifm_sd_end_cmd(struct tasklet_struct *t)
 {
-	struct tifm_sd *host = (struct tifm_sd*)data;
+	struct tifm_sd *host = from_tasklet(host, t, finish_tasklet);
 	struct tifm_dev *sock = host->dev;
 	struct mmc_host *mmc = tifm_get_drvdata(sock);
 	struct mmc_request *mrq;
@@ -968,8 +968,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)
 	 */
 	mmc->max_busy_timeout = TIFM_MMCSD_REQ_TIMEOUT_MS;
 
-	tasklet_init(&host->finish_tasklet, tifm_sd_end_cmd,
-		     (unsigned long)host);
+	tasklet_setup(&host->finish_tasklet, tifm_sd_end_cmd);
 	timer_setup(&host->timer, tifm_sd_abort, 0);
 
 	mmc->ops = &tifm_sd_ops;
-- 
2.17.1


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

* [PATCH 09/10] mmc: uniphier: convert tasklets to use new tasklet_setup() API
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
                   ` (7 preceding siblings ...)
  2020-08-17  8:35 ` [PATCH 08/10] mmc: tifm_sd: " Allen Pais
@ 2020-08-17  8:35 ` Allen Pais
  2020-08-17 12:53 ` [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Masahiro Yamada
  9 siblings, 0 replies; 12+ messages in thread
From: Allen Pais @ 2020-08-17  8:35 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, manuel.lauss, mirq-linux,
	jh80.chung, oakad, yamada.masahiro, brucechang, HaraldWelte
  Cc: keescook, inux-mmc, linux-arm-kernel, linux-kernel, linux-omap,
	Allen Pais, Romain Perier

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.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/mmc/host/uniphier-sd.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c
index f82baf99fd69..c822bb7beaca 100644
--- a/drivers/mmc/host/uniphier-sd.c
+++ b/drivers/mmc/host/uniphier-sd.c
@@ -81,9 +81,9 @@ static void uniphier_sd_dma_endisable(struct tmio_mmc_host *host, int enable)
 }
 
 /* external DMA engine */
-static void uniphier_sd_external_dma_issue(unsigned long arg)
+static void uniphier_sd_external_dma_issue(struct tasklet_struct *t)
 {
-	struct tmio_mmc_host *host = (void *)arg;
+	struct tmio_mmc_host *host = from_tasklet(host, t, dma_issue);
 	struct uniphier_sd_priv *priv = uniphier_sd_priv(host);
 
 	uniphier_sd_dma_endisable(host, 1);
@@ -190,8 +190,7 @@ static void uniphier_sd_external_dma_request(struct tmio_mmc_host *host,
 	host->chan_rx = chan;
 	host->chan_tx = chan;
 
-	tasklet_init(&host->dma_issue, uniphier_sd_external_dma_issue,
-		     (unsigned long)host);
+	tasklet_setup(&host->dma_issue, uniphier_sd_external_dma_issue);
 }
 
 static void uniphier_sd_external_dma_release(struct tmio_mmc_host *host)
@@ -228,9 +227,9 @@ static const struct tmio_mmc_dma_ops uniphier_sd_external_dma_ops = {
 	.dataend = uniphier_sd_external_dma_dataend,
 };
 
-static void uniphier_sd_internal_dma_issue(unsigned long arg)
+static void uniphier_sd_internal_dma_issue(struct tasklet_struct *t)
 {
-	struct tmio_mmc_host *host = (void *)arg;
+	struct tmio_mmc_host *host = from_tasklet(host, t, dma_issue);
 	unsigned long flags;
 
 	spin_lock_irqsave(&host->lock, flags);
@@ -309,8 +308,7 @@ static void uniphier_sd_internal_dma_request(struct tmio_mmc_host *host,
 
 	host->chan_tx = (void *)0xdeadbeaf;
 
-	tasklet_init(&host->dma_issue, uniphier_sd_internal_dma_issue,
-		     (unsigned long)host);
+	tasklet_setup(&host->dma_issue, uniphier_sd_internal_dma_issue);
 }
 
 static void uniphier_sd_internal_dma_release(struct tmio_mmc_host *host)
-- 
2.17.1


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

* Re: [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup()
  2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
                   ` (8 preceding siblings ...)
  2020-08-17  8:35 ` [PATCH 09/10] mmc: uniphier: " Allen Pais
@ 2020-08-17 12:53 ` Masahiro Yamada
  2020-08-17 19:31   ` Kees Cook
  9 siblings, 1 reply; 12+ messages in thread
From: Masahiro Yamada @ 2020-08-17 12:53 UTC (permalink / raw)
  To: Allen Pais
  Cc: Ludovic Desroches, Ulf Hansson, Manuel Lauss,
	Michał Mirosław, Jaehoon Chung, Alex Dubov,
	Bruce Chang, Harald Welte, Kees Cook, inux-mmc, linux-arm-kernel,
	Linux Kernel Mailing List, Linux-OMAP

On Mon, Aug 17, 2020 at 5:35 PM Allen Pais <allen.lkml@gmail.com> wrote:
>
> Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
> introduced a new tasklet initialization API. This series converts
> all the mmc drivers to use the new tasklet_setup() API


I did not know this was the direction to invest efforts
because I thought the threaded-irq was supposed to replace
the tasklet.





> Allen Pais (10):
>   mmc: atmel-mci: convert tasklets to use new tasklet_setup() API
>   mmc: au1xmmc: convert tasklets to use new tasklet_setup() API
>   mmc: cb710: convert tasklets to use new tasklet_setup() API
>   mmc: dw_mmc: convert tasklets to use new tasklet_setup() API
>   mmc: omap: convert tasklets to use new tasklet_setup() API
>   mmc: renesas: convert tasklets to use new tasklet_setup() API
>   mmc: s3cmci: convert tasklets to use new tasklet_setup() API
>   mmc: tifm_sd: convert tasklets to use new tasklet_setup() API
>   mmc: uniphier: convert tasklets to use new tasklet_setup() API
>   mmc: via-sdmmc: convert tasklets to use new tasklet_setup() API
>
>  drivers/mmc/host/atmel-mci.c                  |  6 +++---
>  drivers/mmc/host/au1xmmc.c                    | 15 ++++++--------
>  drivers/mmc/host/cb710-mmc.c                  | 11 +++++-----
>  drivers/mmc/host/dw_mmc.c                     |  6 +++---
>  drivers/mmc/host/omap.c                       |  7 +++----
>  drivers/mmc/host/renesas_sdhi.h               |  1 +
>  drivers/mmc/host/renesas_sdhi_core.c          |  2 ++
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 20 +++++++++----------
>  drivers/mmc/host/renesas_sdhi_sys_dmac.c      |  9 ++++-----
>  drivers/mmc/host/s3cmci.c                     |  6 +++---
>  drivers/mmc/host/tifm_sd.c                    |  7 +++----
>  drivers/mmc/host/uniphier-sd.c                | 14 ++++++-------
>  drivers/mmc/host/via-sdmmc.c                  |  7 +++----
>  13 files changed, 53 insertions(+), 58 deletions(-)
>
> --
> 2.17.1
>


--
Best Regards
Masahiro Yamada

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

* Re: [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup()
  2020-08-17 12:53 ` [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Masahiro Yamada
@ 2020-08-17 19:31   ` Kees Cook
  0 siblings, 0 replies; 12+ messages in thread
From: Kees Cook @ 2020-08-17 19:31 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Allen Pais, Ludovic Desroches, Ulf Hansson, Manuel Lauss,
	Michał Mirosław, Jaehoon Chung, Alex Dubov,
	Bruce Chang, Harald Welte, inux-mmc, linux-arm-kernel,
	Linux Kernel Mailing List, Linux-OMAP

On Mon, Aug 17, 2020 at 09:53:13PM +0900, Masahiro Yamada wrote:
> On Mon, Aug 17, 2020 at 5:35 PM Allen Pais <allen.lkml@gmail.com> wrote:
> >
> > Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
> > introduced a new tasklet initialization API. This series converts
> > all the mmc drivers to use the new tasklet_setup() API
> 
> 
> I did not know this was the direction to invest efforts
> because I thought the threaded-irq was supposed to replace
> the tasklet.

Both can happen. It seemed to me that mechanical conversions from
tasklet to threaded-irq was not possible, though, so best to convert the
old API away from being a exploit target (saved arguments on the
heap) while conversions to threaded-irq can happen on a case-by-case
basis.

-- 
Kees Cook

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

end of thread, other threads:[~2020-08-17 19:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  8:34 [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Allen Pais
2020-08-17  8:34 ` [PATCH 01/10] mmc: atmel-mci: convert tasklets to use new tasklet_setup() API Allen Pais
2020-08-17  8:35 ` [PATCH 02/10] mmc: au1xmmc: " Allen Pais
2020-08-17  8:35 ` [PATCH 03/10] mmc: cb710: " Allen Pais
2020-08-17  8:35 ` [PATCH 04/10] mmc: dw_mmc: " Allen Pais
2020-08-17  8:35 ` [PATCH 05/10] mmc: omap: " Allen Pais
2020-08-17  8:35 ` [PATCH 06/10] mmc: renesas: " Allen Pais
2020-08-17  8:35 ` [PATCH 07/10] mmc: s3cmci: " Allen Pais
2020-08-17  8:35 ` [PATCH 08/10] mmc: tifm_sd: " Allen Pais
2020-08-17  8:35 ` [PATCH 09/10] mmc: uniphier: " Allen Pais
2020-08-17 12:53 ` [PATCH 00/10] mmc: convert tasklets to use new tasklet_setup() Masahiro Yamada
2020-08-17 19:31   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).