Re: [PATCH v2] s390/mm: Make virt_to_pfn() a static inline
From: Heiko Carstens
Date: Tue Aug 15 2023 - 04:10:15 EST
On Sat, Aug 12, 2023 at 05:12:54PM +0200, Linus Walleij wrote:
> 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 do the same with pfn_to_virt() reflecting the
> current layout in asm-generic/page.h.
>
> Doing this reveals a number of offenders in the arch code and
> the S390-specific drivers, so just bite the bullet and fix up
> all of those as well.
>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> ---
> Changes in v2:
> - Just drop the cast to (unsigned long) in drivers/s390/char/vmcp.c,
> we do not need to cast to (void *) from (char *), a pointer is
> a pointer.
> - Link to v1: https://lore.kernel.org/r/20230811-virt-to-phys-s390-v1-1-b661426ca9cd@xxxxxxxxxx
> ---
> arch/s390/include/asm/kfence.h | 2 +-
> arch/s390/include/asm/page.h | 12 ++++++++++--
> arch/s390/mm/cmm.c | 2 +-
> arch/s390/mm/vmem.c | 2 +-
> drivers/s390/block/scm_blk.c | 2 +-
> drivers/s390/char/vmcp.c | 2 +-
> 6 files changed, 15 insertions(+), 7 deletions(-)
Applied, thanks!