Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2249548iob; Fri, 20 May 2022 05:31:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6wx3sXiN93rd4kQINS6Jv3/9NiRE7Q9MzyXWrCv+kJci7GE/G2osGqCfr1AZjA8jLjwQK X-Received: by 2002:a63:8748:0:b0:3f9:d5d3:1d71 with SMTP id i69-20020a638748000000b003f9d5d31d71mr32392pge.524.1653049892069; Fri, 20 May 2022 05:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653049892; cv=none; d=google.com; s=arc-20160816; b=LxtbhancObXsAumUhJ2JBA0wJydV631d1zZYPMmye8AEePJ/yJMJwz9cq17Z5/2h/g lNJutbAHZZJo2U5uA2UbvYFQiKAdNrMZ8TSmOoBAUVfYPVEQZA71HtGx5bIHG4cHJxF7 8c37J8UqQRVLstkgzjhoypQawGA6pSG60gQRCCbGA6t6ZP3ywWLiQ0dMYAl9SpH0osVT HhLlhJArWTsx5fpfLVNgSn7LN6Z7ZCOIXF7xwYG/jf+vV1vvK2UjDYDuw3mAv67QyXhf iEEPWQwsN32m1Cn+lICeT0qht0jCAom5iobalRqEpcF/3FwuKt4wQ0gQ5lT+DS0gXOdr nArw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=KIbdIXDfFPNTHp7kCmj1FdYvGQ65brT3hm0GJ1uCMwA=; b=PRBVz6tSPSfCJDFQx+27FiNPpK4o53PBx9ty2xF6DesM0MCTvE7Q7kQcU8pbCjVKdv /EmOXu2/VNpIbjmjxgcuo1N+74gL36G0oKSWYGCHpOQaOb0vVvgN1mL3jd8aXJkPGNCL qiB86YW9gcFexuykUTbOfJzM4YeZY23TaHOSiTWIIxfgNukjh1E3tu5Ga7iQ8iPSHtaN O7UblHQYsoL2UTGHvUDIjyK4empc4QmjEVlAyKYwSeMAq70MlOVSJNTI9VgjwnSgKpal KY5LHQwH2FyYngRzHW18jL5rSV+1Lcin+sR1euohZ9T3CXrcORix81MV8iNdzCRnTtRP qhLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=ajpYm5gh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a632341000000b003f601d28ca6si10420628pgm.819.2022.05.20.05.31.18; Fri, 20 May 2022 05:31:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=ajpYm5gh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244219AbiESSxC (ORCPT + 99 others); Thu, 19 May 2022 14:53:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244210AbiESSwb (ORCPT ); Thu, 19 May 2022 14:52:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C833766C8A for ; Thu, 19 May 2022 11:52:14 -0700 (PDT) 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 46948B8242C for ; Thu, 19 May 2022 18:52:13 +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-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.