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 A6463C43334 for ; Mon, 6 Jun 2022 13:28:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B91876B0071; Mon, 6 Jun 2022 09:28:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B18FA8D0001; Mon, 6 Jun 2022 09:28:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B71C6B0074; Mon, 6 Jun 2022 09:28:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8867B6B0071 for ; Mon, 6 Jun 2022 09:28:29 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5815334D7C for ; Mon, 6 Jun 2022 13:28:29 +0000 (UTC) X-FDA: 79547890338.24.9DF3EE8 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf19.hostedemail.com (Postfix) with ESMTP id 6D73C1A0023 for ; Mon, 6 Jun 2022 13:28:10 +0000 (UTC) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LGvP44XlpzRhjD; Mon, 6 Jun 2022 21:25:12 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 6 Jun 2022 21:28:23 +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; Mon, 6 Jun 2022 21:28:22 +0800 Message-ID: <7a8f19b5-f22e-83be-0f9a-63cef6152812@huawei.com> Date: Mon, 6 Jun 2022 21:28:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4 5/6] arm64: mm: Convert to GENERIC_IOREMAP Content-Language: en-US To: Christoph Hellwig CC: , , , , , , , References: <20220606074815.139265-1-wangkefeng.wang@huawei.com> <20220606074815.139265-6-wangkefeng.wang@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-Rspamd-Queue-Id: 6D73C1A0023 X-Stat-Signature: uo3at9o85yz19kdyo3xid5yw6tb7efr1 X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-Rspamd-Server: rspam08 X-HE-Tag: 1654522090-533871 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 2022/6/6 15:54, Christoph Hellwig wrote: >> +#define ioremap_wc(addr, size) ioremap_prot((addr), (size), PROT_NORMAL_NC) >> +#define ioremap_np(addr, size) ioremap_prot((addr), (size), PROT_DEVICE_nGnRnE) > Please avoid the overly long lines here. Independt of that having > a non-trivial body on a separate line tends to generlly be a lot more > readable anyway. Hi Christoph, As commit bdc48fa11e46  ("checkpatch/coding-style: deprecate 80-column warning") increased the limit to 100 columns,so I don't get warning when using checkpatch, and it is not a hard limit, but if this is a mandatory requirement, I will resend them with break lines. >> +#define ioremap_cache(addr, size) ({ \ >> + pfn_is_map_memory(__phys_to_pfn(addr)) ? \ >> + (void __iomem *)__phys_to_virt(addr) : ioremap_prot(addr, size, PROT_NORMAL); \ >> +}) > And this really should be an inline function. We still need a define, see kernel/iomem.c, #ifndef ioremap_cache __weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long size) {         return ioremap(offset, size); } #endif > >> +int iounmap_allowed(void __iomem *addr) >> { >> /* >> * We could get an address outside vmalloc range in case >> * of ioremap_cache() reusing a RAM mapping. >> */ >> + return is_vmalloc_addr(addr) ? 0 : -EINVAL; > As the generic ioremap only returns vmalloc addresses, this check > really should go into common code. Good point, will move into generic ioremap, thanks. > .