Re: [PATCH 2/3] dmaengine: dw_dmac: Enhance device tree support

From: Viresh Kumar
Date: Fri Oct 12 2012 - 07:01:23 EST


On 12 October 2012 16:10, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
>>>> + if (!found) {
>>>> + last_dw = dw;
>>>> + last_bus_id = param;
>>>> + return false;
>>> Because of return here you could eliminate 'found' flag at all.

Here is the stuff copied from you ;)


diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index a4ff04c..c24859e 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1184,7 +1184,7 @@ bool dw_generic_filter(struct dma_chan *chan, void *param)
struct dw_dma *dw = to_dw_dma(chan->device);
static struct dw_dma *last_dw;
static char *last_bus_id;
- int found = 0, i = -1;
+ int i = -1;

/*
* dmaengine framework calls this routine for all channels of all dma
@@ -1212,22 +1212,17 @@ bool dw_generic_filter(struct dma_chan *chan,
void *param)

while (++i < dw->sd_count) {
if (!strcmp(dw->sd[i].bus_id, param)) {
- found = 1;
- break;
- }
- }
+ chan->private = &dw->sd[i];
+ last_dw = NULL;
+ last_bus_id = NULL;

- if (!found) {
- last_dw = dw;
- last_bus_id = param;
- return false;
+ return true;
+ }
}

- chan->private = &dw->sd[i];
- last_dw = NULL;
- last_bus_id = NULL;
-
- return true;
+ last_dw = dw;
+ last_bus_id = param;
+ return false;
}
EXPORT_SYMBOL(dw_generic_filter);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/