lkml.org 
[lkml]   [2012]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCHv2 1/2] dw_dmac: backlink to dw_dma in dw_dma_chan is superfluous
From
On 10 December 2012 20:10, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> The same information could be exctracted from the struct dma_chan.
> The patch introduces helper function dwc_get_data_width() as well.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/dma/dw_dmac.c | 19 ++++++++++++-------
> drivers/dma/dw_dmac_regs.h | 3 ---
> 2 files changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index fdae96f..427d35b 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -73,6 +73,14 @@ static inline unsigned int dwc_get_sms(struct dw_dma_slave *slave)
> */
> #define NR_DESCS_PER_CHANNEL 64
>
> +static inline unsigned int dwc_get_data_width(struct dma_chan *chan, bool d)
> +{
> + struct dw_dma *dw = to_dw_dma(chan->device);
> + struct dw_dma_slave *dws = chan->private;
> +
> + return dw->data_width[d ? dwc_get_dms(dws) : dwc_get_sms(dws)];
> +}

I am so sorry to ask for V3 for this patch, but i didn't like the bool d at all.
Logically the variable name is not good enough in describing its purpose.

What i would have done here is:
#define SRC_MASTER 0
#define DST_MASTER 1

And used them here. :)

Rest is fine.


\
 
 \ /
  Last update: 2012-12-10 16:21    [W:0.049 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site