[PATCH 2/6] dma: mxs-dma: let dma_is_apbh and apbh_is_old take parameter

Marek Vasut marex at denx.de
Wed May 9 05:16:40 EDT 2012


Dear Vinod Koul,

> On Wed, 2012-05-09 at 11:00 +0200, Marek Vasut wrote:
> > Dear Vinod Koul,
> > 
> > > On Mon, 2012-05-07 at 22:23 +0800, Shawn Guo wrote:
> > > > Let macros dma_is_apbh and apbh_is_old take mxs_dma as parameter
> > > > to make the code easy to read.
> > > > 
> > > > Signed-off-by: Shawn Guo <shawn.guo at linaro.org>
> > > > ---
> > > > 
> > > >  drivers/dma/mxs-dma.c |   24 ++++++++++++------------
> > > >  1 files changed, 12 insertions(+), 12 deletions(-)
> > > > 
> > > > diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
> > > > index bd27818..e801fbf 100644
> > > > --- a/drivers/dma/mxs-dma.c
> > > > +++ b/drivers/dma/mxs-dma.c
> > > > @@ -38,10 +38,10 @@
> > > > 
> > > >  #define MXS_DMA_APBH		0
> > > >  #define MXS_DMA_APBX		1
> > > > 
> > > > -#define dma_is_apbh()		(mxs_dma->dev_id == MXS_DMA_APBH)
> > > > +#define dma_is_apbh(mxs_dma)	(mxs_dma->dev_id == MXS_DMA_APBH)
> > > > 
> > > >  #define APBH_VERSION_LATEST	3
> > > > 
> > > > -#define apbh_is_old()		(mxs_dma->version < APBH_VERSION_LATEST)
> > > > +#define apbh_is_old(mxs_dma)	(mxs_dma->version <
> > > > APBH_VERSION_LATEST)
> > > > 
> > > >  #define HW_APBHX_CTRL0				0x000
> > > >  #define BM_APBH_CTRL0_APB_BURST8_EN		(1 << 29)
> > > > 
> > > > @@ -54,10 +54,10 @@
> > > > 
> > > >  #define HW_APBH_VERSION				(cpu_is_mx23() ? 
0x3f0 :
> > 0x800)
> > 
> > > >  #define HW_APBX_VERSION				0x800
> > > >  #define BP_APBHX_VERSION_MAJOR			24
> > > > 
> > > > -#define HW_APBHX_CHn_NXTCMDAR(n) \
> > > > -	(((dma_is_apbh() && apbh_is_old()) ? 0x050 : 0x110) + (n) * 
0x70)
> > > > -#define HW_APBHX_CHn_SEMA(n) \
> > > > -	(((dma_is_apbh() && apbh_is_old()) ? 0x080 : 0x140) + (n) * 
0x70)
> > > > +#define HW_APBHX_CHn_NXTCMDAR(d, n) \
> > > > +	(((dma_is_apbh(d) && apbh_is_old(d)) ? 0x050 : 0x110) + (n) * 
0x70)
> > > > +#define HW_APBHX_CHn_SEMA(d, n) \
> > > > +	(((dma_is_apbh(d) && apbh_is_old(d)) ? 0x080 : 0x140) + (n) * 
0x70)
> > > 
> > > while at it, care to say what the above magic numbers mean. Isnt
> > > terrible clear to me.
> > 
> > Check the email above ;-) I think simple comment would be enough here,
> > but defining those would not hurt either.
> 
> what does 050, 080... and other magic numbers here mean? Why is
> everything getting multiplied by 0x70.

Yep, I'm on the same boat with you. Check Shawn's reply to my mail, carrying the 
same concern. Well ... Shawn, I guess now that we're two, you better make 
another set of macros ;-)

Best regards,
Marek Vasut



More information about the linux-arm-kernel mailing list