diff mbox

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

Message ID CAKohponxbjTTDMOA_0=MT36wRh1NpzTAH4LdkaE=Z-ahup4BFg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Viresh Kumar Oct. 12, 2012, 11:01 a.m. UTC
On 12 October 2012 16:10, Andy Shevchenko <andy.shevchenko@gmail.com> 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 ;)

Comments

Andy Shevchenko Oct. 12, 2012, 11:25 a.m. UTC | #1
On Fri, Oct 12, 2012 at 2:01 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 12 October 2012 16:10, Andy Shevchenko <andy.shevchenko@gmail.com> 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 ?
Viresh Kumar Oct. 12, 2012, 1:44 p.m. UTC | #2
On 12 October 2012 16:55, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>>  EXPORT_SYMBOL(dw_generic_filter);
> Could we change a name to be more precise, like dw_dma_generic_filter ?

Sure.
diff mbox

Patch

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);