Re: [patch 2/2] m68k: Discontinuous memory support

Andrew Morton
2007-05-30T00:46:19Z

On Mon, 28 May 2007 21:16:32 +0200
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> -#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
> -#define page_to_phys(page) virt_to_phys((void *)__page_address(page))
> +#ifdef CONFIG_SINGLE_MEMORY_CHUNK
> +#define page_to_phys(page) \
> + __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
> +#else
> +#define page_to_phys(page) ({ \
> + struct pglist_data *pgdat; \
> + pgdat = pg_data_table[page_to_nid(page)]; \
> + page_to_pfn(page) << PAGE_SHIFT; \
> +})
> +#endif

macros which evaluate their args more than once are dangerous.