[PATCH 17/19] staging: comedi: mite: move the mite dma arm/disarm/reset functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For aesthetics, move these functions to a more logical spot in the
code and add docbook comments for the exported functions.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/mite.c | 76 +++++++++++++++++++----------------
 drivers/staging/comedi/drivers/mite.h |  5 ++-
 2 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c
index 82f4fda..ce479ad 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -213,12 +213,6 @@ static unsigned int mite_drq_reqs(unsigned int drq_line)
 	return CR_REQS((drq_line & 0x3) | 0x4);
 }
 
-static void mite_dma_reset(struct mite_channel *mite_chan)
-{
-	writel(CHOR_DMARESET | CHOR_FRESET,
-	       mite_chan->mite->mmio + MITE_CHOR(mite_chan->channel));
-}
-
 static unsigned int mite_fifo_size(struct mite *mite, unsigned int channel)
 {
 	unsigned int fcr_bits = readl(mite->mmio + MITE_FCR(channel));
@@ -228,25 +222,6 @@ static unsigned int mite_fifo_size(struct mite *mite, unsigned int channel)
 	return empty_count + full_count;
 }
 
-void mite_dma_arm(struct mite_channel *mite_chan)
-{
-	struct mite *mite = mite_chan->mite;
-	unsigned long flags;
-
-	/*
-	 * memory barrier is intended to insure any twiddling with the buffer
-	 * is done before writing to the mite to arm dma transfer
-	 */
-	smp_mb();
-	spin_lock_irqsave(&mite->lock, flags);
-	mite_chan->done = 0;
-	/* arm */
-	writel(CHOR_START, mite->mmio + MITE_CHOR(mite_chan->channel));
-	mmiowb();
-	spin_unlock_irqrestore(&mite->lock, flags);
-}
-EXPORT_SYMBOL_GPL(mite_dma_arm);
-
 static u32 mite_device_bytes_transferred(struct mite_channel *mite_chan)
 {
 	struct mite *mite = mite_chan->mite;
@@ -298,15 +273,6 @@ static u32 mite_bytes_read_from_memory_ub(struct mite_channel *mite_chan)
 	return mite_device_bytes_transferred(mite_chan) + in_transit_count;
 }
 
-void mite_dma_disarm(struct mite_channel *mite_chan)
-{
-	struct mite *mite = mite_chan->mite;
-
-	/* disarm */
-	writel(CHOR_ABORT, mite->mmio + MITE_CHOR(mite_chan->channel));
-}
-EXPORT_SYMBOL_GPL(mite_dma_disarm);
-
 static void mite_sync_input_dma(struct mite_channel *mite_chan,
 				struct comedi_subdevice *s)
 {
@@ -447,6 +413,48 @@ int mite_done(struct mite_channel *mite_chan)
 }
 EXPORT_SYMBOL_GPL(mite_done);
 
+static void mite_dma_reset(struct mite_channel *mite_chan)
+{
+	writel(CHOR_DMARESET | CHOR_FRESET,
+	       mite_chan->mite->mmio + MITE_CHOR(mite_chan->channel));
+}
+
+/**
+ * mite_dma_arm() - Start a MITE dma transfer.
+ * @mite_chan: MITE dma channel.
+ */
+void mite_dma_arm(struct mite_channel *mite_chan)
+{
+	struct mite *mite = mite_chan->mite;
+	unsigned long flags;
+
+	/*
+	 * memory barrier is intended to insure any twiddling with the buffer
+	 * is done before writing to the mite to arm dma transfer
+	 */
+	smp_mb();
+	spin_lock_irqsave(&mite->lock, flags);
+	mite_chan->done = 0;
+	/* arm */
+	writel(CHOR_START, mite->mmio + MITE_CHOR(mite_chan->channel));
+	mmiowb();
+	spin_unlock_irqrestore(&mite->lock, flags);
+}
+EXPORT_SYMBOL_GPL(mite_dma_arm);
+
+/**
+ * mite_dma_disarm() - Stop a MITE dma transfer.
+ * @mite_chan: MITE dma channel.
+ */
+void mite_dma_disarm(struct mite_channel *mite_chan)
+{
+	struct mite *mite = mite_chan->mite;
+
+	/* disarm */
+	writel(CHOR_ABORT, mite->mmio + MITE_CHOR(mite_chan->channel));
+}
+EXPORT_SYMBOL_GPL(mite_dma_disarm);
+
 /**
  * mite_prep_dma() - Prepare a MITE dma channel for transfers.
  * @mite_chan: MITE dma channel.
diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h
index 4017ddb..c7ae3db 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -60,14 +60,15 @@ struct mite {
 	spinlock_t lock;
 };
 
-void mite_dma_arm(struct mite_channel *mite_chan);
-void mite_dma_disarm(struct mite_channel *mite_chan);
 void mite_sync_dma(struct mite_channel *mite_chan, struct comedi_subdevice *s);
 u32 mite_bytes_in_transit(struct mite_channel *mite_chan);
 void mite_ack_linkc(struct mite_channel *, struct comedi_subdevice *,
 		    bool sync);
 int mite_done(struct mite_channel *mite_chan);
 
+void mite_dma_arm(struct mite_channel *);
+void mite_dma_disarm(struct mite_channel *);
+
 void mite_prep_dma(struct mite_channel *,
 		   unsigned int num_device_bits, unsigned int num_memory_bits);
 
-- 
2.6.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux