[PATCH 14/15] mmc: bcm2835: Rearrange bcm2835_dma_complete_work()

Stefan Wahren stefan.wahren at i2se.com
Tue Feb 7 12:45:53 PST 2017


This patch moves bcm2835_dma_complete_work() down so we can
remove the forward declaration of bcm2385_finish_data().

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 drivers/mmc/host/bcm2835.c |   93 ++++++++++++++++++++++----------------------
 1 file changed, 46 insertions(+), 47 deletions(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 4051028..2eec187 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -288,7 +288,6 @@ static void bcm2835_reset(struct mmc_host *mmc)
 	bcm2835_reset_internal(host);
 }
 
-static void bcm2835_finish_data(struct bcm2835_host *host);
 static void bcm2835_finish_command(struct bcm2835_host *host);
 
 static void bcm2835_wait_transfer_complete(struct bcm2835_host *host)
@@ -329,52 +328,6 @@ static void bcm2835_wait_transfer_complete(struct bcm2835_host *host)
 	}
 }
 
-static void bcm2835_dma_complete_work(struct work_struct *work)
-{
-	struct bcm2835_host *host =
-		container_of(work, struct bcm2835_host, dma_work);
-	struct mmc_data *data = host->data;
-
-	mutex_lock(&host->mutex);
-
-	if (host->dma_chan) {
-		dma_unmap_sg(host->dma_chan->device->dev,
-			     data->sg, data->sg_len,
-			     host->dma_dir);
-
-		host->dma_chan = NULL;
-	}
-
-	if (host->drain_words) {
-		unsigned long flags;
-		void *page;
-		u32 *buf;
-
-		if (host->drain_offset & PAGE_MASK) {
-			host->drain_page += host->drain_offset >> PAGE_SHIFT;
-			host->drain_offset &= ~PAGE_MASK;
-		}
-		local_irq_save(flags);
-		page = kmap_atomic(host->drain_page);
-		buf = page + host->drain_offset;
-
-		while (host->drain_words) {
-			u32 edm = readl(host->ioaddr + SDEDM);
-
-			if ((edm >> 4) & 0x1f)
-				*(buf++) = readl(host->ioaddr + SDDATA);
-			host->drain_words--;
-		}
-
-		kunmap_atomic(page);
-		local_irq_restore(flags);
-	}
-
-	bcm2835_finish_data(host);
-
-	mutex_unlock(&host->mutex);
-}
-
 static void bcm2835_dma_complete(void *param)
 {
 	struct bcm2835_host *host = param;
@@ -1120,6 +1073,52 @@ static irqreturn_t bcm2835_threaded_irq(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static void bcm2835_dma_complete_work(struct work_struct *work)
+{
+	struct bcm2835_host *host =
+		container_of(work, struct bcm2835_host, dma_work);
+	struct mmc_data *data = host->data;
+
+	mutex_lock(&host->mutex);
+
+	if (host->dma_chan) {
+		dma_unmap_sg(host->dma_chan->device->dev,
+			     data->sg, data->sg_len,
+			     host->dma_dir);
+
+		host->dma_chan = NULL;
+	}
+
+	if (host->drain_words) {
+		unsigned long flags;
+		void *page;
+		u32 *buf;
+
+		if (host->drain_offset & PAGE_MASK) {
+			host->drain_page += host->drain_offset >> PAGE_SHIFT;
+			host->drain_offset &= ~PAGE_MASK;
+		}
+		local_irq_save(flags);
+		page = kmap_atomic(host->drain_page);
+		buf = page + host->drain_offset;
+
+		while (host->drain_words) {
+			u32 edm = readl(host->ioaddr + SDEDM);
+
+			if ((edm >> 4) & 0x1f)
+				*(buf++) = readl(host->ioaddr + SDDATA);
+			host->drain_words--;
+		}
+
+		kunmap_atomic(page);
+		local_irq_restore(flags);
+	}
+
+	bcm2835_finish_data(host);
+
+	mutex_unlock(&host->mutex);
+}
+
 void bcm2835_set_clock(struct bcm2835_host *host, unsigned int clock)
 {
 	int div;
-- 
1.7.9.5




More information about the linux-rpi-kernel mailing list