Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2175706iof; Tue, 7 Jun 2022 22:13:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+7cRxk6csJeHUbINWLKsD6S8rExdEewUIDKU5cK3m+YTrig81Tr5HYruTBoH9FbDP0FUv X-Received: by 2002:a17:902:7b93:b0:162:bc8:935a with SMTP id w19-20020a1709027b9300b001620bc8935amr32080985pll.44.1654665228983; Tue, 07 Jun 2022 22:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665228; cv=none; d=google.com; s=arc-20160816; b=j6Y2kJ58/nVmldokJxlS2ZYJIeyGeDR/yna4wz7GswTWOnD6c8XLvkKrc7zK4LhKcB ZA95fIiGY0j//YRNieFfu7e7Su3xXDsb2NcMJ3iOIovJzcrKOvoAy+XyWV4Mudix5Q4D Gh3gQr63zkA4Lf35QMZDmCg7xFxMXIBfCbSnpTkY63zbJ5y7jPAwcbZMkzguoGg6q7G7 vpJqRac277HL4ubBdiCXcewGiV+zY10imGD1MqcklcjBLnTHLgYTE1r5tFpSlbOlMNzV XjjFX08b0OROPCgJGoFQZzIoEjkyxg6ufFaRXUn5xCNbca/0n6E8StdPw92Jl9S0qPMC Y02A== 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=VXo1Q7fKDJ0IHhhanewLIQ5K2KGo2zHD5uUskTCGUS8=; b=a1XhL5h6p7t9CYBIYDSd045fDaG1fSHoTwRUyfqtt7gTmtPxfzrF1SuS7SpXtFYx21 EfjaVUi3MXwbFLBV5NOX6AUI+PuZBOG04AppXOp1zJsAaMtuu6fe7ohU/HEHBrlQXNKO gaQV0CyKi9A5WQsLjrYmC5lmNdtUlqBAQoIBRgpodLKbuw3S4ZrsxASnqTJMZZEAwfRa E0O/doh6TBqdN6ch8UkznXOOmBoBPO7PB9fGP4++vmfgcXtNEcJwNPhnYAp7U8DBYc+t KbKr3vI0NfeLZyokcAQPRb9RJgRMkv2rUE1vPp+Z0GAV2o+AkwKclIbp9sZL8qk+9jz/ NpCg== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o26-20020a63921a000000b003fa6f09c9a5si27872624pgd.238.2022.06.07.22.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E2EBC2C55A4; Tue, 7 Jun 2022 21:44:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243962AbiFGMlC (ORCPT + 99 others); Tue, 7 Jun 2022 08:41:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243909AbiFGMkx (ORCPT ); Tue, 7 Jun 2022 08:40:53 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E68211EA for ; Tue, 7 Jun 2022 05:40:51 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LHVKv0qZLzjbrH; Tue, 7 Jun 2022 20:39:31 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 7 Jun 2022 20:40:50 +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; Tue, 7 Jun 2022 20:40:49 +0800 From: Kefeng Wang To: , , , , CC: , , , , Kefeng Wang Subject: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot() Date: Tue, 7 Jun 2022 20:50:23 +0800 Message-ID: <20220607125027.44946-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220607125027.44946-1-wangkefeng.wang@huawei.com> References: <20220607125027.44946-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: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Reviewed-by: Anshuman Khandual Signed-off-by: Kefeng Wang --- include/asm-generic/io.h | 3 ++- mm/ioremap.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 7ce93aaf69f8..b76379628a02 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -964,7 +964,8 @@ 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..2d754b48d230 100644 --- a/mm/ioremap.c +++ b/mm/ioremap.c @@ -11,20 +11,21 @@ #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 +34,8 @@ 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