Re: [PATCH 0/4 v4] dma: dma_{un}map_{single|sg}_attrs() interface

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Thursday, March 13, 2008 - 1:41 am

On Wed, 12 Mar 2008 21:00:22 -0700 akepner@sgi.com wrote:


Please comment the above.  Describe the semantic meaning of the enums and
how they are mapped into `struct dma_attrs' (which is what I assume they
do).  I see there's a documentation update here so if you think it's best
to direct the code reader to that file then fine, add a suitable reference.

Why did we need to implement a struct for a plain old flags word?


Does this need to exist?


This is a definition, not a declaration.  Please rename it to
DEFINE_DMA_ATTRS().


So if I do

	if (expr)
		INIT_DMA_ATTRS(bar);
	else
		something_else();

it won't compile.

Golden rule: implement not in cpp that which can be implemented in C.

static inline void init_dma_attrs(struct dma_attrs *attrs)
{
	attrs->flags = 0;
}

is much nicer, no?


There is no precedent for ARCH_USES_*.

There is a little bit of precedent for ARCH_HAVE_*

There is lots of precendence for ARCH_HAS_*.

We don't like ARCH_HAS_* anyway ;) What can we do to get rid of this? 
Ideally, make it available on all architectures at zero cost to those which
don't need it.  If that is impractical (why?) then it is preferable to do
this in Kconfig.


Is there any non-buggy reason why code would pass an out-of-range attribute
into this function?  If not, BUG_ON() would be appropriate treatment.

This function might already be too large to inline, and a BUG_ON() might
make it larger.


The two callers to this function just do a WARN_ON_ONCE() if it failed.  It
looks like adding a BUG_ON() and removing those WARN_ONs is the way to go.


We have a dma_set_attr() stub but no dma_get_attr() stub?


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 0/4 v4] dma: dma_{un}map_{single|sg}_attrs() in ..., Andrew Morton, (Thu Mar 13, 1:41 am)