[PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap()

Arnd Bergmann arnd at arndb.de
Tue May 24 05:35:27 PDT 2022


On Tue, May 24, 2022 at 11:48 AM Kefeng Wang <wangkefeng.wang at huawei.com> wrote:
> >>> mm/ioremap.c:59:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const *addr @@     got void [noderef] __iomem *vaddr @@
> >     mm/ioremap.c:59:16: sparse:     expected void const *addr
> >     mm/ioremap.c:59:16: sparse:     got void [noderef] __iomem *vaddr
> >
> > vim +59 mm/ioremap.c
> >
> >      51
> >      52       void iounmap(volatile void __iomem *addr)
> >      53       {
> >      54               void __iomem *vaddr = (void __iomem *)((unsigned long)addr & PAGE_MASK);
> >      55
> >      56               if (arch_iounmap(vaddr))
> >      57                       return;
> >      58
> >    > 59               vunmap(vaddr);
>
> 1) Will add generic "arch_ioremap/arch_iounmap define"
>
> 2) and change this to vunmap((void *)vaddr);

I think this need an extra __force to actually suppress the sparse
warning, as in

        vunmap((void __force *)vaddr);

Using __force is usually wrong, this is one of the exceptions, so
maybe add a comment
as well.

         Arnd



More information about the linux-arm-kernel mailing list