From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 455CCC433FE for ; Tue, 24 May 2022 14:54:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D05088D0003; Tue, 24 May 2022 10:54:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB4008D0002; Tue, 24 May 2022 10:54:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC53C8D0003; Tue, 24 May 2022 10:54:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AE7028D0002 for ; Tue, 24 May 2022 10:54:05 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 63A728139A for ; Tue, 24 May 2022 14:54:04 +0000 (UTC) X-FDA: 79500931608.26.2051D07 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 3535F1C0032 for ; Tue, 24 May 2022 14:53:51 +0000 (UTC) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L6xyK0pg3zhYTq; Tue, 24 May 2022 22:52:57 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 24 May 2022 22:53:55 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 24 May 2022 22:53:55 +0800 Message-ID: Date: Tue, 24 May 2022 22:53:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap() Content-Language: en-US To: Arnd Bergmann CC: Catalin Marinas , Will Deacon , Andrew Morton , Linux ARM , Linux Kernel Mailing List , Linux-MM , "Christoph Hellwig" , Anshuman Khandual References: <20220519082552.117736-1-wangkefeng.wang@huawei.com> <20220519082552.117736-5-wangkefeng.wang@huawei.com> <4c848b48-6ddf-664a-6296-d85ab49a694d@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 3535F1C0032 X-Stat-Signature: 98nqgz8am39ezdnrn9p4dwih9twg1fbo X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-HE-Tag: 1653404031-208045 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/5/24 22:47, Arnd Bergmann wrote: > On Tue, May 24, 2022 at 4:32 PM Kefeng Wang wrote: >> On 2022/5/24 20:37, Arnd Bergmann wrote: >>> On Thu, May 19, 2022 at 10:25 AM Kefeng Wang 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 >>> 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 > > .