[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f9bbfe38-ce1d-b4c4-6acf-4b81e6587e2d@huawei.com>
Date: Tue, 24 May 2022 22:53:54 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Arnd Bergmann <arnd@...db.de>
CC: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
"Christoph Hellwig" <hch@...radead.org>,
Anshuman Khandual <anshuman.khandual@....com>
Subject: Re: [PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap()
On 2022/5/24 22:47, Arnd Bergmann wrote:
> On Tue, May 24, 2022 at 4:32 PM Kefeng Wang <wangkefeng.wang@...wei.com> wrote:
>> On 2022/5/24 20:37, Arnd Bergmann wrote:
>>> On Thu, May 19, 2022 at 10:25 AM Kefeng Wang <wangkefeng.wang@...wei.com> wrote:
>>>> Add special hook for architecture to verify or setup addr, size
>>>> or prot when ioremap() or iounmap(), which will make the generic
>>>> ioremap more useful.
>>>>
>>>> arch_ioremap() return a pointer,
>>>> - IS_ERR means return an error
>>>> - NULL means continue to remap
>>>> - a non-NULL, non-IS_ERR pointer is directly returned
>>>> arch_iounmap() return a int value,
>>>> - 0 means continue to vunmap
>>>> - error code means skip vunmap and return directly
>>>>
>>>> Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
>>> I don't really like interfaces that mix error pointers and NULL pointer
>>> returns.
>>>
>>> Would it be possible to have a special error code other than NULL
>>> for the fallback case?
>> I don't find a good error code, maybe ENOTSUPP, any better suggestion?
> I had another look at the resulting arm64 function, and it appears that
> you never actually return a non-error pointer here. If I didn't miss anything,
> I think the best way would be to change the return type to just indicate
> success or an error code, and drop the case of returning the actual result,
> and changing the function name accordingly.
>
> Would that work, or do you actually require returning an __iomem
> token from somewhere else?
Christoph suggested in the first version,
https://lore.kernel.org/linux-arm-kernel/Ymq2uX%2FY15HlIpo7@infradead.org/
> Arnd
>
> .
Powered by blists - more mailing lists