Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4014376ioo; Wed, 25 May 2022 12:53:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6/BYopmm4mtX/5x8di9Imz5evNjz76JvuiMyCfv5MyIeNYOLzFThXoyCHhpiHj5qCfPyw X-Received: by 2002:aa7:d501:0:b0:42a:aa82:e4ef with SMTP id y1-20020aa7d501000000b0042aaa82e4efmr36790468edq.241.1653508380838; Wed, 25 May 2022 12:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653508380; cv=none; d=google.com; s=arc-20160816; b=DzxFh0zK1Si06HzOUPw5LR5RCCdwTUwOX4gcH5eM5Kq2yBwa0oY1upqF+vfHaVozKZ cpnXdS+xvi7oz7I7J6XYWYtZ10QzGp3oXyQFYMfF6VezFuXDXOF2xHnbdryp8BhJxEp3 ts/LZI2ZBnGVt/4pHfM2tGrHT9CFZpKzbQd6rLfHFEqTR28UW72tXy1RzHUnbnEBtJCH 0q3z57zaKCDxYRG4doXEgQLRAXPKkmnPkqG16GQ80DXsClRSJDyKRnWXt8NEOa/xS1Ad ezjVG7aSi/SDN2ZRGgCwR3aLHRZFYXGYDpT9VpdFU4rYg6VXkW3FtLfm1Vs63uoR0R01 v7pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=Tx33uaKwLOQM44INJoDoHI95VsKrqftt6ptvjSVpjoU=; b=C7BnwpfwwL5vjlqfCwddBttWcsHgzJofjWasXdWjD1nsxMR/PTnx0IGlQcbsIVO+Yk hgJahTM19I4mgSd/Q/EUweXegc13PrMmDblZN4ayVG5+je9PfSm+WbbAJcq6LX0oh0ue Z7E/08Y9wlW4Tq9KWo4eoKZ0hHzrNa19zTPwsx1LwsAU1Ww082OE91mq81yHNRSdsf2F cKJ/YD4Zi88Nzn1a+juPL8ONvnPK6NunbmUrmQwa1G/yrTS3YXcojfscSoo9OFHcwDab HQgJ2OW+/HTbw/2AQjTh4pKBKw/QCwkeVGk/YCU/k63K1k9mJDCl4AlsFiV45wO1U9EU jI1g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq22-20020a1709073f1600b006fee1b3070csi10701934ejc.553.2022.05.25.12.52.34; Wed, 25 May 2022 12:53:00 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238427AbiEXOyC (ORCPT + 99 others); Tue, 24 May 2022 10:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237325AbiEXOyB (ORCPT ); Tue, 24 May 2022 10:54:01 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB7A56EC46 for ; Tue, 24 May 2022 07:53:59 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L6xyK0pg3zhYTq; Tue, 24 May 2022 22:52:57 +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; Tue, 24 May 2022 22:53:55 +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; Tue, 24 May 2022 22:53:55 +0800 Message-ID: Date: Tue, 24 May 2022 22:53:54 +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 v3 4/6] mm: ioremap: Add arch_ioremap/iounmap() Content-Language: en-US To: Arnd Bergmann CC: Catalin Marinas , Will Deacon , Andrew Morton , Linux ARM , Linux Kernel Mailing List , Linux-MM , "Christoph Hellwig" , Anshuman Khandual References: <20220519082552.117736-1-wangkefeng.wang@huawei.com> <20220519082552.117736-5-wangkefeng.wang@huawei.com> <4c848b48-6ddf-664a-6296-d85ab49a694d@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 2022/5/24 22:47, Arnd Bergmann wrote: > On Tue, May 24, 2022 at 4:32 PM Kefeng Wang wrote: >> On 2022/5/24 20:37, Arnd Bergmann wrote: >>> On Thu, May 19, 2022 at 10:25 AM 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 >>>> >>>> Signed-off-by: Kefeng Wang >>> I don't really like interfaces that mix error pointers and NULL pointer >>> returns. >>> >>> Would it be possible to have a special error code other than NULL >>> for the fallback case? >> I don't find a good error code, maybe ENOTSUPP, any better suggestion? > I had another look at the resulting arm64 function, and it appears that > you never actually return a non-error pointer here. If I didn't miss anything, > I think the best way would be to change the return type to just indicate > success or an error code, and drop the case of returning the actual result, > and changing the function name accordingly. > > Would that work, or do you actually require returning an __iomem > token from somewhere else? Christoph  suggested in the first version, https://lore.kernel.org/linux-arm-kernel/Ymq2uX%2FY15HlIpo7@infradead.org/ > Arnd > > .