Re: [PATCHv2 1/2] dw_dmac: backlink to dw_dma in dw_dma_chan is superfluous

From: Viresh Kumar
Date: Mon Dec 10 2012 - 09:50:55 EST


On 10 December 2012 20:10, Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx>
> ---
> 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.
--
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/