Re: [PATCH] asm-generic: add a dma-mapping.h file

From: Arnd Bergmann
Date: Tue May 26 2009 - 08:36:10 EST

On Tuesday 26 May 2009, FUJITA Tomonori wrote:
> > dma_get_cache_alignment() is still less generic than
> > the other functions, as this is still architecture
> > specific. Should I leave that out as well then?
> Yes, I think that only adding generic functions is a better
> approach. Overriding with #ifdef is really ugly.

Ok, will do.

[trimming Cc list a bit, as the subject has changed]

Could you be more specific as to why you think the #ifdef
in this file is ugly? I agree that we should always avoid
#ifdef in a device driver file or around the usage of an
API, but we use it everywhere when defining an optional
API, e.g.

extern void dma_debug_add_bus(struct bus_type *bus);
static inline void dma_debug_add_bus(struct bus_type *bus)


#ifndef clear_user_highpage
static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
void *addr = kmap_atomic(page, KM_USER0);
clear_user_page(addr, vaddr, page);
kunmap_atomic(addr, KM_USER0);

This has always made a lot of sense to me when you are defining
something that you want to become a No-op in certain configurations
or that only needs special handling in a few cases. IIRC, Linus
has stated that he prefers the second of the two styles above when
you have the choice, which is why I started out that way, while
for the dma_debug stuff, the CONFIG_ symbol clearly makes sense.

Arnd <><
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at