Browse Source

dmaengine: nbpfaxi: convert to tasklet

It is common among dmaengine drivers to use a tasklet for bottom half
interrupt processing. Convert nbpfaxi to do the same.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Guennadi Liakhovetski 11 years ago
parent
commit
f02323ec68
1 changed files with 12 additions and 7 deletions
  1. 12 7
      drivers/dma/nbpfaxi.c

+ 12 - 7
drivers/dma/nbpfaxi.c

@@ -197,6 +197,7 @@ struct nbpf_desc_page {
  */
  */
 struct nbpf_channel {
 struct nbpf_channel {
 	struct dma_chan dma_chan;
 	struct dma_chan dma_chan;
+	struct tasklet_struct tasklet;
 	void __iomem *base;
 	void __iomem *base;
 	struct nbpf_device *nbpf;
 	struct nbpf_device *nbpf;
 	char name[16];
 	char name[16];
@@ -1111,9 +1112,9 @@ static struct dma_chan *nbpf_of_xlate(struct of_phandle_args *dma_spec,
 	return dchan;
 	return dchan;
 }
 }
 
 
-static irqreturn_t nbpf_chan_irqt(int irq, void *dev)
+static void nbpf_chan_tasklet(unsigned long data)
 {
 {
-	struct nbpf_channel *chan = dev;
+	struct nbpf_channel *chan = (struct nbpf_channel *)data;
 	struct nbpf_desc *desc, *tmp;
 	struct nbpf_desc *desc, *tmp;
 	dma_async_tx_callback callback;
 	dma_async_tx_callback callback;
 	void *param;
 	void *param;
@@ -1176,8 +1177,6 @@ static irqreturn_t nbpf_chan_irqt(int irq, void *dev)
 		if (must_put)
 		if (must_put)
 			nbpf_desc_put(desc);
 			nbpf_desc_put(desc);
 	}
 	}
-
-	return IRQ_HANDLED;
 }
 }
 
 
 static irqreturn_t nbpf_chan_irq(int irq, void *dev)
 static irqreturn_t nbpf_chan_irq(int irq, void *dev)
@@ -1186,6 +1185,7 @@ static irqreturn_t nbpf_chan_irq(int irq, void *dev)
 	bool done = nbpf_status_get(chan);
 	bool done = nbpf_status_get(chan);
 	struct nbpf_desc *desc;
 	struct nbpf_desc *desc;
 	irqreturn_t ret;
 	irqreturn_t ret;
+	bool bh = false;
 
 
 	if (!done)
 	if (!done)
 		return IRQ_NONE;
 		return IRQ_NONE;
@@ -1200,7 +1200,8 @@ static irqreturn_t nbpf_chan_irq(int irq, void *dev)
 		ret = IRQ_NONE;
 		ret = IRQ_NONE;
 		goto unlock;
 		goto unlock;
 	} else {
 	} else {
-		ret = IRQ_WAKE_THREAD;
+		ret = IRQ_HANDLED;
+		bh = true;
 	}
 	}
 
 
 	list_move_tail(&desc->node, &chan->done);
 	list_move_tail(&desc->node, &chan->done);
@@ -1216,6 +1217,9 @@ static irqreturn_t nbpf_chan_irq(int irq, void *dev)
 unlock:
 unlock:
 	spin_unlock(&chan->lock);
 	spin_unlock(&chan->lock);
 
 
+	if (bh)
+		tasklet_schedule(&chan->tasklet);
+
 	return ret;
 	return ret;
 }
 }
 
 
@@ -1258,8 +1262,9 @@ static int nbpf_chan_probe(struct nbpf_device *nbpf, int n)
 
 
 	snprintf(chan->name, sizeof(chan->name), "nbpf %d", n);
 	snprintf(chan->name, sizeof(chan->name), "nbpf %d", n);
 
 
-	ret = devm_request_threaded_irq(dma_dev->dev, chan->irq,
-			nbpf_chan_irq, nbpf_chan_irqt, IRQF_SHARED,
+	tasklet_init(&chan->tasklet, nbpf_chan_tasklet, (unsigned long)chan);
+	ret = devm_request_irq(dma_dev->dev, chan->irq,
+			nbpf_chan_irq, IRQF_SHARED,
 			chan->name, chan);
 			chan->name, chan);
 	if (ret < 0)
 	if (ret < 0)
 		return ret;
 		return ret;