Re: [PATCH 00/12] arch: Make virt_to_pfn into a static inline

From: Geert Uytterhoeven
Date: Fri May 12 2023 - 05:57:56 EST


Hi Linus,

On Thu, May 11, 2023 at 1:59 PM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> This is an attempt to harden the typing on virt_to_pfn()
> and pfn_to_virt().
>
> Making virt_to_pfn() a static inline taking a strongly typed
> (const void *) makes the contract of a passing a pointer of that
> type to the function explicit and exposes any misuse of the
> macro virt_to_pfn() acting polymorphic and accepting many types
> such as (void *), (unitptr_t) or (unsigned long) as arguments
> without warnings.
>
> For symmetry, we do the same with pfn_to_virt().
>
> The problem with this inconsistent typing was pointed out by
> Russell King:
> https://lore.kernel.org/linux-arm-kernel/YoJDKJXc0MJ2QZTb@xxxxxxxxxxxxxxxxxxxxx/
>
> And confirmed by Andrew Morton:
> https://lore.kernel.org/linux-mm/20220701160004.2ffff4e5ab59a55499f4c736@xxxxxxxxxxxxxxxxxxxx/
>
> So the recognition of the problem is widespread.
>
> These platforms have been chosen as initial conversion targets:
>
> - ARC
> - ARM
> - ARM64/Aarch64
> - asm-generic (including for example x86)
> - m68k

Thanks, builds fine on m68k with MMU, and boots fine on ARAnyM,
with the extra changes I replied on patch 2/12.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds