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

From: Andy Shevchenko
Date: Fri Oct 12 2012 - 07:25:25 EST


On Fri, Oct 12, 2012 at 2:01 PM, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> 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;
> }
Yes, that what I refer to.

> EXPORT_SYMBOL(dw_generic_filter);
Could we change a name to be more precise, like dw_dma_generic_filter ?


--
With Best Regards,
Andy Shevchenko
--
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/