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 32880C433EF for ; Thu, 28 Apr 2022 06:16:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C41C96B0071; Thu, 28 Apr 2022 02:16:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF2C56B0072; Thu, 28 Apr 2022 02:16:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABB156B0073; Thu, 28 Apr 2022 02:16:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 9E54F6B0071 for ; Thu, 28 Apr 2022 02:16:47 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 83AD81B24 for ; Thu, 28 Apr 2022 06:16:47 +0000 (UTC) X-FDA: 79405279254.24.3C3D885 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id 0AE0040064 for ; Thu, 28 Apr 2022 06:16:41 +0000 (UTC) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KplkN3hXVzhYn3; Thu, 28 Apr 2022 14:16:28 +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; Thu, 28 Apr 2022 14:16:40 +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; Thu, 28 Apr 2022 14:16:39 +0800 Message-ID: <8d5c41a6-0478-bd5c-a37b-06a37101fc31@huawei.com> Date: Thu, 28 Apr 2022 14:16:39 +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 2/4] mm: ioremap: Add arch_ioremap/iounmap_check() Content-Language: en-US To: Andrew Morton CC: Catalin Marinas , Will Deacon , , , References: <20220427121413.168468-1-wangkefeng.wang@huawei.com> <20220427121413.168468-3-wangkefeng.wang@huawei.com> <20220427100411.8eaf54c51767c3e2b0b070a5@linux-foundation.org> From: Kefeng Wang In-Reply-To: <20220427100411.8eaf54c51767c3e2b0b070a5@linux-foundation.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 0AE0040064 Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Stat-Signature: wimcpp4is8a9reddj45c1znpk8794u14 X-HE-Tag: 1651126601-40793 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/4/28 1:04, Andrew Morton wrote: > On Wed, 27 Apr 2022 20:14:11 +0800 Kefeng Wang wrote: > >> Add special check hook for architecture to verify addr, size >> or prot when ioremap() or iounmap(), which will make the generic >> ioremap more useful. >> >> ... >> >> --- a/include/asm-generic/io.h >> +++ b/include/asm-generic/io.h >> @@ -964,6 +964,9 @@ static inline void iounmap(volatile void __iomem *addr) >> #elif defined(CONFIG_GENERIC_IOREMAP) >> #include >> >> +bool arch_ioremap_check(phys_addr_t addr, size_t size, unsigned long prot); >> +bool arch_iounmap_check(void __iomem *addr); > Pet peeve. The word "check" is a poor one. I gives no sense of what > the function is checking and it gives no sense of how the function's > return value relates to the thing which it checks. > > Maybe it returns 0 on success and -EINVAL on failure. Don't know! > > Don't you think that better names would be io_remap_ok(), > io_remap_valid(), io_remap_allowed(), etc? Will use arch_ioremap/unmap_allowed(), and I'd like to keep return bool for now if there is no special requirements. > > > Other than that, > > Acked-by: Andrew Morton Thanks. > .