linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Armin <akuster@pacbell.net>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Armin Kuster <akuster@mvista.com>, linuxppc-embedded@lists.linuxppc.org
Subject: Re: ppc405_dma warnings
Date: Wed, 13 Mar 2002 21:04:02 +0000	[thread overview]
Message-ID: <3C8FBEC2.4030206@pacbell.net> (raw)
In-Reply-To: 20020314022146.GP22020@zax


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/

  reply	other threads:[~2002-03-13 21:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-14  2:21 ppc405_dma warnings David Gibson
2002-03-13 21:04 ` Armin [this message]
2002-03-14  6:17   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C8FBEC2.4030206@pacbell.net \
    --to=akuster@pacbell.net \
    --cc=akuster@mvista.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).