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 6952DC433F5 for ; Thu, 19 May 2022 18:52:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDCC36B0071; Thu, 19 May 2022 14:52:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B64996B0072; Thu, 19 May 2022 14:52:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DF8B6B0073; Thu, 19 May 2022 14:52:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8CCC36B0071 for ; Thu, 19 May 2022 14:52:13 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 65F6121021 for ; Thu, 19 May 2022 18:52:13 +0000 (UTC) X-FDA: 79483387746.26.ADC11AA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id A5AC51C00C4 for ; Thu, 19 May 2022 18:51:58 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 194AB61B33; Thu, 19 May 2022 18:52:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F556C34100; Thu, 19 May 2022 18:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652986331; bh=hZUTwgstPmefXYn68fhv3dUuy+vLjWAINx3Yp8d24P4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ajpYm5ghpHHLfN9MHvfGa+lF4OCjo+Og0WWuBq4QCmTWJbC5oli7n8mhGzUSLTCyu EczWQRo+IKAoHhZ0s2gVn1GJDKffv4zTubfCFW7wtHpWxpMZQxvaOR1VDiXwHw2UTU RTxrjtt48l38rs6pPA4pa+cBz+ooIMWWvB45k1zI= Date: Thu, 19 May 2022 11:52:10 -0700 From: Andrew Morton To: Kefeng Wang Cc: , , , , , , , Subject: Re: [PATCH v3 4/6] mm: ioremap: Add arch_ioremap/iounmap() Message-Id: <20220519115210.a6e41d5a997921354400557e@linux-foundation.org> In-Reply-To: <20220519082552.117736-5-wangkefeng.wang@huawei.com> References: <20220519082552.117736-1-wangkefeng.wang@huawei.com> <20220519082552.117736-5-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: jr77n3oneh5meby7g4a31ronznjg8kxo Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=ajpYm5gh; spf=pass (imf18.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A5AC51C00C4 X-HE-Tag: 1652986318-448433 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 Thu, 19 May 2022 16:25:50 +0800 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 > > ... > > --- a/include/asm-generic/io.h > +++ b/include/asm-generic/io.h > @@ -964,6 +964,30 @@ static inline void iounmap(volatile void __iomem *addr) > #elif defined(CONFIG_GENERIC_IOREMAP) > #include > > +/* > + * Arch code can implement the following two special hooks when using GENERIC_IOREMAP > + * arch_ioremap() return a pointer, > + * - IS_ERR means return an error > + * - NULL means continue to remap > + * - a non-NULL, non-IS_ERR pointer is returned directly > + * arch_iounmap() return a int, > + * - 0 means continue to vunmap > + * - error code means skip vunmap and return directly > + */ > +#ifndef arch_ioremap > +static inline void __iomem *arch_ioremap(phys_addr_t phys_addr, size_t size, unsigned long prot) > +{ > + return NULL; > +} Maybe should do #define arch_ioremap arch_ioremap here > +#endif > + > +#ifndef arch_iounmap > +static inline int arch_iounmap(void __iomem *addr) > +{ > + return 0; > +} and here. It shouldn't matter a lot because this file has inclusion guards. However it seems tidier and perhaps other code will want to know whether this was defined. Dunno. Otherwise, Acked-by: Andrew Morton Please take this patch and [2/6] and [3/6] via the appropriate arm tree.