From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3C8FBEC2.4030206@pacbell.net> Date: Wed, 13 Mar 2002 21:04:02 +0000 From: Armin MIME-Version: 1.0 To: David Gibson Cc: Armin Kuster , linuxppc-embedded@lists.linuxppc.org Subject: Re: ppc405_dma warnings References: <20020314022146.GP22020@zax> Content-Type: text/plain; charset=us-ascii; format=flowed Sender: owner-linuxppc-embedded@lists.linuxppc.org List-Id: David Gibson wrote: > Armin, > > ppc405_dma.c has several constructs like: > p_dma_ch->polarity = polarity & GET_DMA_POLARITY(0); > where GET_DMA_POLARITY() is defined: > #define GET_DMA_POLARITY(chan) DMAReq##chan##_ActiveLow | \ > DMAAck##chan##_ActiveLow | EOT##chan##_ActiveLow > > Note the macro has no parentheses around its definition, which is > unusual. IIRC C precedence will mean this code turns out as: > p_dma_ch->polarity = (polarity & DMAReq0_ActiveLow) | \ > DMAAck0_ActiveLow | EOT0_ActiveLow > which looks wrong to me and if correct is an insane use of a macro. > It's also giving compiler warnings. > > I'm guessing that the macro should just get parentheses, but that's a > semantic change so I don't want to make it without knowing for sure. > Could you check this? > > -- > David Gibson | For every complex problem there is a > david@gibson.dropbear.id.au | solution which is simple, neat and > | wrong. -- H.L. Mencken > http://www.ozlabs.org/people/dgibson > > > > > Thanks.. I missed the parentheses. The macro is there to allow me to use the same driver for the 405gp dma and the stb0xxxx cpu since the the stbxxxx does not have a polarity. I could have poluted the driver with #ifdefs or mask the deltas with a few macros. I went with macros. armin PS I am insane ** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/