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 34BB9C43334 for ; Wed, 8 Jun 2022 04:16:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 56E4C6B0071; Wed, 8 Jun 2022 00:16:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54F376B0072; Wed, 8 Jun 2022 00:16:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40B266B0073; Wed, 8 Jun 2022 00:16:57 -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 3268F6B0071 for ; Wed, 8 Jun 2022 00:16:57 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F0DB035047 for ; Wed, 8 Jun 2022 04:16:56 +0000 (UTC) X-FDA: 79553758032.14.4B10F65 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 5002B100052 for ; Wed, 8 Jun 2022 04:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654661815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=14PU+0VYcV8svYcSqS/GiFfOTLmCGexoD/N9x+kbBRI=; b=g+IubP5oJgMv4NXsC4949XgTY+hDvHnHFgE7yQOqtqX8fFY62mEr701K3XLR2PCfxY9DHK iwFZPeZsSHIIL9nd+fbNhMJ5md5wIq3U+Ki/ZPexKNUq7pqiW1d+gqYTvIO+36d4wcMZuT E3ng90oafwgWSmDpEgb43A8PD7ghUR4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-C_SxIESRN56w1hKoozyTTQ-1; Wed, 08 Jun 2022 00:16:54 -0400 X-MC-Unique: C_SxIESRN56w1hKoozyTTQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E53A800882; Wed, 8 Jun 2022 04:16:54 +0000 (UTC) Received: from localhost (ovpn-12-81.pek2.redhat.com [10.72.12.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D457404E4C2; Wed, 8 Jun 2022 04:16:52 +0000 (UTC) Date: Wed, 8 Jun 2022 12:16:47 +0800 From: Baoquan He To: Kefeng Wang Cc: catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, hch@infradead.org, arnd@arndb.de, anshuman.khandual@arm.com Subject: Re: [PATCH v5 2/6] mm: ioremap: Use more sensibly name in ioremap_prot() Message-ID: References: <20220607125027.44946-1-wangkefeng.wang@huawei.com> <20220607125027.44946-3-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220607125027.44946-3-wangkefeng.wang@huawei.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5002B100052 X-Stat-Signature: qs7jusio63heuz4czppk9ifw96aob9nu X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=g+IubP5o; spf=none (imf14.hostedemail.com: domain of bhe@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1654661816-634349 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 06/07/22 at 08:50pm, Kefeng Wang wrote: > 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); ~~~ use offset_in_page() instead? Other than this nitpick, this looks good to me. Reviewed-by: Baoquan He > + 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 > >