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 6258FC433F5 for ; Wed, 27 Apr 2022 18:25:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 995436B0071; Wed, 27 Apr 2022 14:25:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 91D4A6B0073; Wed, 27 Apr 2022 14:25:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7977F6B0074; Wed, 27 Apr 2022 14:25:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 6310C6B0071 for ; Wed, 27 Apr 2022 14:25:50 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 34CD52152D for ; Wed, 27 Apr 2022 18:25:50 +0000 (UTC) X-FDA: 79403487660.21.6B149A1 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf17.hostedemail.com (Postfix) with ESMTP id C3AC54004C for ; Wed, 27 Apr 2022 18:25:41 +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 B2432B828B3; Wed, 27 Apr 2022 18:25:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D7CBC385A7; Wed, 27 Apr 2022 18:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1651083946; bh=J1tEIozWZnbnL5BsEMprNg/cVkWZ2TvAXMo0cddyvWM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gvBSPqJTVy+MfmT0rjfw2FSyXvfzYoHc4C+O+9aFHpslDpJU0gE8cHRkoJ2axig2D /gLQvrjxshIF3YkdN68KWX4zSo7BCAoU3qAYbYa1h+S7bDh7q/cBl/KwCaBdMG6HJm CCzq9RPL0keGAhgX4L/Ys0JHmMBiThWiipcGARgE= Date: Wed, 27 Apr 2022 11:25:45 -0700 From: Andrew Morton To: Arnd Bergmann Cc: Kefeng Wang , Catalin Marinas , Will Deacon , Linux ARM , Linux Kernel Mailing List , Linux-MM Subject: Re: [PATCH 2/4] mm: ioremap: Add arch_ioremap/iounmap_check() Message-Id: <20220427112545.3b8b9c46e5e5731b02394ace@linux-foundation.org> In-Reply-To: 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-Rspamd-Queue-Id: C3AC54004C X-Stat-Signature: b3z7t3iprdzdrrddwjsx15sdo3baoryt Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gvBSPqJT; dmarc=none; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1651083941-66130 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:20:30 +0200 Arnd Bergmann wrote: > On Wed, Apr 27, 2022 at 2:14 PM Kefeng Wang wrote: > > @@ -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); > > + > > void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot); > > void iounmap(volatile void __iomem *addr); > > > > diff --git a/mm/ioremap.c b/mm/ioremap.c > > index 522ef899c35f..d1117005dcc7 100644 > > --- a/mm/ioremap.c > > +++ b/mm/ioremap.c > > @@ -11,6 +11,16 @@ > > #include > > #include > > > > +bool __weak arch_ioremap_check(phys_addr_t addr, size_t size, unsigned long prot) > > +{ > > + return true; > > +} > > + > > +bool __weak arch_iounmap_check(void __iomem *addr) > > +{ > > + return true; > > +} > > + > > I don't really like the weak functions. How come? They work quite nicely here? > The normal way to do this Is a lot more fuss.