Re: [PATCH] Fix virt_to_phys() warnings

From: Ralf Baechle
Date: Thu Jul 02 2009 - 04:28:07 EST


On Thu, Jul 02, 2009 at 09:07:46AM +0200, Andi Kleen wrote:
> From: Andi Kleen <andi@xxxxxxxxxxxxxx>
> Date: Thu, 02 Jul 2009 09:07:46 +0200
> To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Kevin Cernekee <cernekee@xxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx,
> Ralf Baechle <ralf@xxxxxxxxxxxxxx>
> Subject: Re: [PATCH] Fix virt_to_phys() warnings
> Content-Type: text/plain; charset=us-ascii
>
> Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:
> >
> > #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
> >
> > thereby passing an `unsigned long' where a void* was expected.
> >
> >
> > So perhaps something along these lines:
>
> I'm not quite sure it's the case on MIPS, but I remember on x86 one of
> the reasons this was done as a macro was to avoid a include dependency
> loop with struct page.

The MIPS <asm/page.h> uses a forward declaration for the same reason since
a very long time. These days struct page is defined in <linux/mm_types.h>
but that file needs pgprot_t (which is defined in <asm/page.h> ...) to be
defined first so can't be included from the to of page.h.

Ralf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/