Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1893461iob; Fri, 29 Apr 2022 15:40:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlECQ/QCJGU3mPY29J4Ppfce5O2XXxpQUxTikXVUZfFz07IKv5tMZcnK4cVeV1pQlxQkc5 X-Received: by 2002:a17:902:70c8:b0:156:509b:68e3 with SMTP id l8-20020a17090270c800b00156509b68e3mr1444825plt.113.1651272027740; Fri, 29 Apr 2022 15:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651272027; cv=none; d=google.com; s=arc-20160816; b=m++sbnDEEcKgLJ58MXuMmtiV5KhyNM5p64ZkhFr4qoy0XM91fF1rCbe0Kumt1J9OYg RHk/+HahxrBP6aK7TyFFt5FqD/GaPNV6K5pXYWk68nR3C0/GOh1dprbtKoe6ePJYONWd nKdVBh4aLF6B37iOJp7cNPPFo5wqu4dWMfWOmqAgnP6ULso2tcSG9YAXBm+IHQvJ2zb8 yZI5QG//dn6Ofm+4QhT4+7m/EvPH7Cx0doNokB17j3MAqqKuYI9+9D2gP8W1cRBE/YFj H3p2pJQZDrdLtiWFJ847niyKnzi6VBHFxqOzHoCGhCR8+AVkCk5lINHiEffQtw7ezIjk e77w== 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:date:subject:cc:to:from; bh=8EeDOqEkSjiwYcdjyLOvUVBCLAyLIaYe2xY/EOIkIjk=; b=YkQZPu8140R842o2NtMZ4qbMzWEfIZ4CyjPKgv5AiGlpZKCNi9jJ+59H6X5MMZRU0R MJNT6YtwhiusANMsZ7p6yPbfSrnRLDAEcsQzUGmDLiwskftGm9xCkSpUs17w+kKTqJwo JkQgwe2e815uC0rECl5NgDK7z2N72O8EF4gBY8cqdR3AA38sjTJlniRYCpxutvPC3S0U hpfe80FccXCG+1uOPnZZBGrqlOGBt/0ElsEB/VrfSNY78+rwL2DEsYACkCNKt9EJWCuL LkkllrWKR448thWCAFzahrMb91rqwHetnZmHtycsM4Z5jAU7FyKGUtgRxlZRMrpPDJLL D8Sg== 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 f65-20020a636a44000000b00399149a5d14si7902942pgc.205.2022.04.29.15.40.11; Fri, 29 Apr 2022 15:40:27 -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 S1357608AbiD2KY5 (ORCPT + 99 others); Fri, 29 Apr 2022 06:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239061AbiD2KYu (ORCPT ); Fri, 29 Apr 2022 06:24:50 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 095DB64718 for ; Fri, 29 Apr 2022 03:21:33 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KqT5Z6TsHz1JBj4; Fri, 29 Apr 2022 18:20:34 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 29 Apr 2022 18:21:31 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) 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; Fri, 29 Apr 2022 18:21:30 +0800 From: Kefeng Wang To: , , , , CC: , , , Kefeng Wang Subject: [PATCH v2 1/5] mm: ioremap: Use more sensibly name in ioremap_prot() Date: Fri, 29 Apr 2022 18:32:21 +0800 Message-ID: <20220429103225.75121-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220429103225.75121-1-wangkefeng.wang@huawei.com> References: <20220429103225.75121-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Use more meaningful and sensibly naming phys_addr instead addr in ioremap_prot(). Suggested-by: Andrew Morton Signed-off-by: Kefeng Wang --- include/asm-generic/io.h | 2 +- mm/ioremap.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 7ce93aaf69f8..e6ffa2519f08 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -964,7 +964,7 @@ static inline void iounmap(volatile void __iomem *addr) #elif defined(CONFIG_GENERIC_IOREMAP) #include -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot); +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, unsigned long prot); void iounmap(volatile void __iomem *addr); static inline void __iomem *ioremap(phys_addr_t addr, size_t size) diff --git a/mm/ioremap.c b/mm/ioremap.c index 5fe598ecd9b7..1f9597fbcc07 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -11,20 +11,20 @@ #include #include -void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot) +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size, unsigned long prot) { unsigned long offset, vaddr; phys_addr_t last_addr; struct vm_struct *area; /* Disallow wrap-around or zero size */ - last_addr = addr + size - 1; - if (!size || last_addr < addr) + last_addr = phys_addr + size - 1; + if (!size || last_addr < phys_addr) return NULL; /* Page-align mappings */ - offset = addr & (~PAGE_MASK); - addr -= offset; + offset = phys_addr & (~PAGE_MASK); + phys_addr -= offset; size = PAGE_ALIGN(size + offset); area = get_vm_area_caller(size, VM_IOREMAP, @@ -33,7 +33,7 @@ void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long prot) return NULL; vaddr = (unsigned long)area->addr; - if (ioremap_page_range(vaddr, vaddr + size, addr, __pgprot(prot))) { + if (ioremap_page_range(vaddr, vaddr + size, phys_addr, __pgprot(prot))) { free_vm_area(area); return NULL; } -- 2.35.3