public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: akepner@sgi.com
Cc: Tony Luck <tony.luck@intel.com>,
	Grant Grundler <grundler@parisc-linux.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Jes Sorensen <jes@sgi.com>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Roland Dreier <rdreier@cisco.com>,
	James Bottomley <James.Bottomley@steeleye.com>,
	David Miller <davem@davemloft.net>,
	Muli Ben-Yehuda <muli@il.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC/PARTIAL PATCH 1/3] dma: create linux/dma-direction.h
Date: Tue, 8 Jan 2008 09:58:31 +0100	[thread overview]
Message-ID: <20080108085831.GA27671@elte.hu> (raw)
In-Reply-To: <20080108023559.GQ23661@sgi.com>


* akepner@sgi.com <akepner@sgi.com> wrote:

> +enum dma_data_attr {
> +	DMA_ATTR_BARRIER = (1 << 0),
> +	DMA_ATTR_FOO = (1 << 1),
> +	DMA_ATTR_GOO = (1 << 2),
> +	DMA_ATTR_MAX = (1 << 3),
> +};

FOO/GOO we dont need i guess ...

> +#define DMA_FLAGS_ATTR_SHIFT	8
> +#define DMA_FLAGS_DIR_MASK	((1 << DMA_FLAGS_ATTR_SHIFT) - 1)
> +#define DMA_FLAGS_ATTR_MASK	~DMA_FLAGS_DIR_MASK
> +
> +static inline enum dma_data_direction dma_flags_get_dir(u32 fin)
> +{
> +	return (fin & DMA_FLAGS_DIR_MASK);
> +}

the u32 looks a bit weird. Why not unsigned int ?

also, are the new dma_map_*() API compatible with the old one? I.e. does 
dma_map_*(...,0) and dma_map_*(...,1) map to the right thing? If yes 
then perhaps dont change 'int direction' to 'u32 flags' at all but just 
rename 'direction' to 'flags' and be done with it.

also, this conversion:

+       enum dma_data_direction direction = dma_flags_get_dir(flags);

would be unnecessary if callers passed in the bitmap already, instead of 
'flags'. 0 and 1 would still map to the right thing i think.

	Ingo

  reply	other threads:[~2008-01-08  8:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08  2:35 [RFC/PARTIAL PATCH 1/3] dma: create linux/dma-direction.h akepner
2008-01-08  8:58 ` Ingo Molnar [this message]
2008-01-08 18:10   ` akepner

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=20080108085831.GA27671@elte.hu \
    --to=mingo@elte.hu \
    --cc=James.Bottomley@steeleye.com \
    --cc=akepner@sgi.com \
    --cc=davem@davemloft.net \
    --cc=grundler@parisc-linux.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=jes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muli@il.ibm.com \
    --cc=randy.dunlap@oracle.com \
    --cc=rdreier@cisco.com \
    --cc=tony.luck@intel.com \
    /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