From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 12/21] dmaengine: edma: Parameter alignment and long line fixes
Date: Thu, 10 Sep 2015 11:37:41 +0300 [thread overview]
Message-ID: <1441874270-2399-13-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1441874270-2399-1-git-send-email-peter.ujfalusi@ti.com>
Makes the code a bit more readable.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
drivers/dma/edma.c | 84 ++++++++++++++++++++++++++++--------------------------
1 file changed, 44 insertions(+), 40 deletions(-)
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 153869c9e13c..bed09ce22ff2 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -294,31 +294,33 @@ static inline void edma_or(struct edma_cc *ecc, int offset, unsigned or)
val |= or;
edma_write(ecc, offset, val);
}
-static inline unsigned int edma_read_array(struct edma_cc *ecc, int offset, int i)
+static inline unsigned int edma_read_array(struct edma_cc *ecc, int offset,
+ int i)
{
return edma_read(ecc, offset + (i << 2));
}
static inline void edma_write_array(struct edma_cc *ecc, int offset, int i,
- unsigned val)
+ unsigned val)
{
edma_write(ecc, offset + (i << 2), val);
}
static inline void edma_modify_array(struct edma_cc *ecc, int offset, int i,
- unsigned and, unsigned or)
+ unsigned and, unsigned or)
{
edma_modify(ecc, offset + (i << 2), and, or);
}
-static inline void edma_or_array(struct edma_cc *ecc, int offset, int i, unsigned or)
+static inline void edma_or_array(struct edma_cc *ecc, int offset, int i,
+ unsigned or)
{
edma_or(ecc, offset + (i << 2), or);
}
static inline void edma_or_array2(struct edma_cc *ecc, int offset, int i, int j,
- unsigned or)
+ unsigned or)
{
edma_or(ecc, offset + ((i*2 + j) << 2), or);
}
-static inline void edma_write_array2(struct edma_cc *ecc, int offset, int i, int j,
- unsigned val)
+static inline void edma_write_array2(struct edma_cc *ecc, int offset, int i,
+ int j, unsigned val)
{
edma_write(ecc, offset + ((i*2 + j) << 2), val);
}
@@ -326,42 +328,43 @@ static inline unsigned int edma_shadow0_read(struct edma_cc *ecc, int offset)
{
return edma_read(ecc, EDMA_SHADOW0 + offset);
}
-static inline unsigned int edma_shadow0_read_array(struct edma_cc *ecc, int offset,
- int i)
+static inline unsigned int edma_shadow0_read_array(struct edma_cc *ecc,
+ int offset, int i)
{
return edma_read(ecc, EDMA_SHADOW0 + offset + (i << 2));
}
-static inline void edma_shadow0_write(struct edma_cc *ecc, int offset, unsigned val)
+static inline void edma_shadow0_write(struct edma_cc *ecc, int offset,
+ unsigned val)
{
edma_write(ecc, EDMA_SHADOW0 + offset, val);
}
-static inline void edma_shadow0_write_array(struct edma_cc *ecc, int offset, int i,
- unsigned val)
+static inline void edma_shadow0_write_array(struct edma_cc *ecc, int offset,
+ int i, unsigned val)
{
edma_write(ecc, EDMA_SHADOW0 + offset + (i << 2), val);
}
static inline unsigned int edma_parm_read(struct edma_cc *ecc, int offset,
- int param_no)
+ int param_no)
{
return edma_read(ecc, EDMA_PARM + offset + (param_no << 5));
}
-static inline void edma_parm_write(struct edma_cc *ecc, int offset, int param_no,
- unsigned val)
+static inline void edma_parm_write(struct edma_cc *ecc, int offset,
+ int param_no, unsigned val)
{
edma_write(ecc, EDMA_PARM + offset + (param_no << 5), val);
}
-static inline void edma_parm_modify(struct edma_cc *ecc, int offset, int param_no,
- unsigned and, unsigned or)
+static inline void edma_parm_modify(struct edma_cc *ecc, int offset,
+ int param_no, unsigned and, unsigned or)
{
edma_modify(ecc, EDMA_PARM + offset + (param_no << 5), and, or);
}
static inline void edma_parm_and(struct edma_cc *ecc, int offset, int param_no,
- unsigned and)
+ unsigned and)
{
edma_and(ecc, EDMA_PARM + offset + (param_no << 5), and);
}
static inline void edma_parm_or(struct edma_cc *ecc, int offset, int param_no,
- unsigned or)
+ unsigned or)
{
edma_or(ecc, EDMA_PARM + offset + (param_no << 5), or);
}
@@ -388,8 +391,8 @@ static void edma_map_dmach_to_queue(struct edma_cc *ecc, unsigned ch_no,
queue_no = ecc->default_queue;
queue_no &= 7;
- edma_modify_array(ecc, EDMA_DMAQNUM, (ch_no >> 3),
- ~(0x7 << bit), queue_no << bit);
+ edma_modify_array(ecc, EDMA_DMAQNUM, (ch_no >> 3), ~(0x7 << bit),
+ queue_no << bit);
}
static void edma_assign_priority_to_queue(struct edma_cc *ecc, int queue_no,
@@ -1134,8 +1137,7 @@ static inline struct edma_chan *to_edma_chan(struct dma_chan *c)
return container_of(c, struct edma_chan, vchan.chan);
}
-static inline struct edma_desc
-*to_edma_desc(struct dma_async_tx_descriptor *tx)
+static inline struct edma_desc *to_edma_desc(struct dma_async_tx_descriptor *tx)
{
return container_of(tx, struct edma_desc, vdesc.tx);
}
@@ -1256,8 +1258,7 @@ static int edma_terminate_all(struct dma_chan *chan)
edma_stop(echan->ecc, echan->ch_num);
/* Move the cyclic channel back to default queue */
if (echan->edesc->cyclic)
- edma_assign_channel_eventq(echan->ecc,
- echan->ch_num,
+ edma_assign_channel_eventq(echan->ecc, echan->ch_num,
EVENTQ_DEFAULT);
/*
* free the running request descriptor
@@ -1319,9 +1320,10 @@ static int edma_dma_resume(struct dma_chan *chan)
* @direction: Direction of the transfer
*/
static int edma_config_pset(struct dma_chan *chan, struct edma_pset *epset,
- dma_addr_t src_addr, dma_addr_t dst_addr, u32 burst,
- enum dma_slave_buswidth dev_width, unsigned int dma_length,
- enum dma_transfer_direction direction)
+ dma_addr_t src_addr, dma_addr_t dst_addr, u32 burst,
+ enum dma_slave_buswidth dev_width,
+ unsigned int dma_length,
+ enum dma_transfer_direction direction)
{
struct edma_chan *echan = to_edma_chan(chan);
struct device *dev = chan->device->dev;
@@ -1467,8 +1469,8 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
return NULL;
}
- edesc = kzalloc(sizeof(*edesc) + sg_len *
- sizeof(edesc->pset[0]), GFP_ATOMIC);
+ edesc = kzalloc(sizeof(*edesc) + sg_len * sizeof(edesc->pset[0]),
+ GFP_ATOMIC);
if (!edesc) {
dev_err(dev, "%s: Failed to allocate a descriptor\n", __func__);
return NULL;
@@ -1620,8 +1622,8 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
if (nslots > MAX_NR_SG)
return NULL;
- edesc = kzalloc(sizeof(*edesc) + nslots *
- sizeof(edesc->pset[0]), GFP_ATOMIC);
+ edesc = kzalloc(sizeof(*edesc) + nslots * sizeof(edesc->pset[0]),
+ GFP_ATOMIC);
if (!edesc) {
dev_err(dev, "%s: Failed to allocate a descriptor\n", __func__);
return NULL;
@@ -1724,13 +1726,17 @@ static void edma_callback(unsigned ch_num, u16 ch_status, void *data)
vchan_cyclic_callback(&edesc->vdesc);
goto out;
} else if (edesc->processed == edesc->pset_nr) {
- dev_dbg(dev, "Transfer complete, stopping channel %d\n", ch_num);
+ dev_dbg(dev,
+ "Transfer completed on channel %d\n",
+ ch_num);
edesc->residue = 0;
edma_stop(ecc, echan->ch_num);
vchan_cookie_complete(&edesc->vdesc);
echan->edesc = NULL;
} else {
- dev_dbg(dev, "Intermediate transfer complete on channel %d\n", ch_num);
+ dev_dbg(dev,
+ "Sub transfer completed on channel %d\n",
+ ch_num);
edma_pause(ecc, echan->ch_num);
@@ -1758,14 +1764,14 @@ static void edma_callback(unsigned ch_num, u16 ch_status, void *data)
* slot. So we avoid doing so and set the missed flag.
*/
if (p.a_b_cnt == 0 && p.ccnt == 0) {
- dev_dbg(dev, "Error occurred, looks like slot is null, just setting miss\n");
+ dev_dbg(dev, "Error on null slot, setting miss\n");
echan->missed = 1;
} else {
/*
* The slot is already programmed but the event got
* missed, so its safe to issue it here.
*/
- dev_dbg(dev, "Error occurred but slot is non-null, TRIGGERING\n");
+ dev_dbg(dev, "Missed event, TRIGGERING\n");
edma_clean_channel(ecc, echan->ch_num);
edma_stop(ecc, echan->ch_num);
edma_start(ecc, echan->ch_num);
@@ -1870,8 +1876,7 @@ static u32 edma_residue(struct edma_desc *edesc)
* We always read the dst/src position from the first RamPar
* pset. That's the one which is active now.
*/
- pos = edma_get_position(edesc->echan->ecc, edesc->echan->slot[0],
- dst);
+ pos = edma_get_position(edesc->echan->ecc, edesc->echan->slot[0], dst);
/*
* Cyclic is simple. Just subtract pset[0].addr from pos.
@@ -1932,8 +1937,7 @@ static enum dma_status edma_tx_status(struct dma_chan *chan,
return ret;
}
-static void __init edma_chan_init(struct edma_cc *ecc,
- struct dma_device *dma,
+static void __init edma_chan_init(struct edma_cc *ecc, struct dma_device *dma,
struct edma_chan *echans)
{
int i, j;
--
2.5.1
next prev parent reply other threads:[~2015-09-10 8:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 8:37 [PATCH 00/21] dmaengine/ARM: Merge the edma drivers into one Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 01/21] ARM: common: edma: Fix channel parameter for irq callbacks Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 02/21] ARM: common: edma: Remove unused functions Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 03/21] dmaengine: edma: Simplify and optimize the edma_execute path Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 04/21] ARM: davinci/common: Convert edma driver to handle one eDMA instance per driver Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 05/21] ARM/dmaengine: edma: Move of_dma_controller_register to the dmaengine driver Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 06/21] ARM: common: edma: Internal API to use pointer to 'struct edma' Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 07/21] ARM/dmaengine: edma: Public API to use private struct pointer Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 08/21] ARM/dmaengine: edma: Remove limitation on the number of eDMA controllers Peter Ujfalusi
2015-09-10 8:40 ` Arnd Bergmann
2015-09-10 9:09 ` Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 09/21] ARM: davinci: Add set dma_mask to eDMA devices Peter Ujfalusi
2015-09-10 8:45 ` Arnd Bergmann
2015-09-10 9:13 ` Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 10/21] ARM/dmaengine: edma: Merge the two drivers under drivers/dmaengine Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 11/21] dmaengine: edma: Allocate memory dynamically for bitmaps and structures Peter Ujfalusi
2015-09-10 8:37 ` Peter Ujfalusi [this message]
2015-09-10 8:37 ` [PATCH 13/21] dmaengine: edma: Use devm_kcalloc when possible Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 14/21] dmaengine: edma: Cleanup regarding the use of dev around the code Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 15/21] dmaengine: edma: Use dev_dbg instead pr_debug Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 16/21] dmaengine: edma: Use the edma_write_slot instead open coded memcpy_toio Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 17/21] dmaengine: edma: Print warning when linking slots from different eDMA Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 18/21] dmaengine: edma: Consolidate the comments for functions Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 19/21] dmaengine: edma: Simplify the interrupt handling Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 20/21] dmaengine: edma: Move the pending error check into helper function Peter Ujfalusi
2015-09-10 8:37 ` [PATCH 21/21] dmaengine: edma: Simplify and optimize ccerr interrupt handler Peter Ujfalusi
2015-09-10 8:47 ` [PATCH 00/21] dmaengine/ARM: Merge the edma drivers into one Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441874270-2399-13-git-send-email-peter.ujfalusi@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox