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 62366C433EF for ; Wed, 27 Apr 2022 17:04:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F2636B0071; Wed, 27 Apr 2022 13:04:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97B546B0073; Wed, 27 Apr 2022 13:04:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81BAA6B0074; Wed, 27 Apr 2022 13:04:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 6B36C6B0071 for ; Wed, 27 Apr 2022 13:04:20 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 424E61681 for ; Wed, 27 Apr 2022 17:04:19 +0000 (UTC) X-FDA: 79403282238.31.775042D Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf06.hostedemail.com (Postfix) with ESMTP id E8886180064 for ; Wed, 27 Apr 2022 17:04:14 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 13ACBB828A1; Wed, 27 Apr 2022 17:04:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 960DAC385A7; Wed, 27 Apr 2022 17:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651079052; bh=dlbegSDeOSUitJNljuKiN9X6VAGW8TSj+wga6up/0sI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FbVXI2r4uJ/piHLa7nOqx5fwgHLqi2ulk36UbsjNO9nyk3Ta2UsSRxa7Ds6uCijys 0WKksg/fVJ+Y7GVLqMsP/GsHQbH/pEOdRKS/Kin6QbkZRQTl1EIcU4YTWi7EJrQn9G aFGYiaHQINuQCugftafHUp7PGN7LncIQDIsAotjY= Date: Wed, 27 Apr 2022 10:04:11 -0700 From: Andrew Morton To: Kefeng Wang Cc: Catalin Marinas , Will Deacon , , , Subject: Re: [PATCH 2/4] mm: ioremap: Add arch_ioremap/iounmap_check() Message-Id: <20220427100411.8eaf54c51767c3e2b0b070a5@linux-foundation.org> In-Reply-To: <20220427121413.168468-3-wangkefeng.wang@huawei.com> References: <20220427121413.168468-1-wangkefeng.wang@huawei.com> <20220427121413.168468-3-wangkefeng.wang@huawei.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: sj8ntitxhi7ijzy7t5qi8ryn1ao78g6b X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E8886180064 X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=FbVXI2r4; dmarc=none; spf=pass (imf06.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1651079054-21664 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 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? Other than that, Acked-by: Andrew Morton