[PATCH] ARM: Stricten arguments to virt_to_pfn()

Linus Walleij linus.walleij at linaro.org
Mon May 16 05:29:34 PDT 2022


On Mon, May 16, 2022 at 2:27 PM Russell King (Oracle)
<linux at armlinux.org.uk> wrote:
> On Mon, May 16, 2022 at 02:16:07PM +0200, Linus Walleij wrote:

> > The kernel convention is that the argument passed to virt_to_pfn()
> > (virtual address to page frame number) needs to be an unsigned long,
> > but ARM has avoided this by including a cast to (unsigned long)
> > inside the definition of virt_to_pfn() itself. This creates problems
> > if we want to make virt_to_pfn() an actual function with a typed argument,
> > so fix up the offending call sites.
>
> Why do we need all these additional messy casts all over the place?
> We should not be creating messy code with stupid casts all over the
> place.
>
> virt_*() should be taking a _virtual_ address - in other words, a
> pointer.

That makes a lot of sense. I'll try to rewrite it like such.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list