lkml.org 
[lkml]   [2013]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 05/32] dmaengine: ste_dma40: Supply macros to resolve 'src' and 'dst' directions
From
On Thu, Apr 18, 2013 at 12:11 PM, Lee Jones <lee.jones@linaro.org> wrote:

> There are lots of lengthy if() statements located sporadically up and
> down the driver. This simple macro should make many of them a little
> simpler to decipher. The remainder have to stay in place, as they
> detail slightly more specific settings.
>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <djbw@fb.com>
> Cc: Per Forlin <per.forlin@stericsson.com>
> Cc: Rabin Vincent <rabin@rab.in>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
(...)

> +#define D40_IS_SRC(dir) ((dir == STEDMA40_PERIPH_TO_MEM) ? true : false)

And when I reas the code and see D40_IS_SRC, what does that
mean? That the channel is a source of .. what exactly?

The older explicit comparison would be more informative.

> +#define D40_IS_DST(dir) (((dir == STEDMA40_MEM_TO_PERIPH) || \
> + (dir == STEDMA40_MEM_TO_MEM)) ? true : false)
> +

The comparison to STEDMA40_MEM_TO_MEM is unintelligible, if I see
that macro it has a very unintuitive name, since it is not just
DST but also SRC.

The latter macro would be named somthing like D40_IS_DST_OR_MEM2MEM
and then it will not simplify the code very much.

You need to come up with something different here, this is just making the
driver harder to understand.

I think this patch should be just dropped.

Yours,
Linus Walleij


\
 
 \ /
  Last update: 2013-04-25 11:01    [W:0.914 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site