Re: [PATCH] gurantee DMA area for alloc_bootmem_low() ver. 2.

Peter Chubb
2005-08-09T23:02:35Z

>>>>> "Yasunori" == Yasunori Goto <y-goto@jp.fujitsu.com> writes:

Yasunori> (Note: Mike Kravez-san's code was defined by MACRO like
Yasunori> this. #ifndef MAX_DMA_PHYSADDR #if MAX_DMA_ADDRESS == ~0UL
Yasunori> : : However, MAX_DMA_ADDRESS is defined with cast "(unsigned
Yasunori> long)" in some architecture like i386. And, preprocessor
Yasunori> doesn't like this cast in #IF sentence and displays error
Yasunori> message as "missing binary operator befor token "long"".
Yasunori> So, I changed it to static inline function.)

Yasunori> +static inline unsigned long max_dma_physaddr(void)
Yasunori> +{
Yasunori> +
Yasunori> + if (MAX_DMA_ADDRESS == ~0UL)
Yasunori> + return MAX_DMA_ADDRESS;
Yasunori> + else
Yasunori> + return __pa(MAX_DMA_ADDRESS);
Yasunori> +}

This code illustrates one of my pet coding-style hates: there's no
need for the `else' as the return statement means it'll never be
reached.

if (MAX_DMA_ADDRESS == ~0UL)
return MAX_DMA_ADDRESS;
return __pa(MAX_DMA_ADDRESS);

is all that's needed.

--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
The technical we do immediately, the political takes *forever*