linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Christophe Leroy" <christophe.leroy@c-s.fr>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Paul Mackerras" <paulus@samba.org>,
	"Michal Hocko" <mhocko@suse.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Vlastimil Babka" <vbabka@suse.cz>,
	"Joe Perches" <joe@perches.com>,
	"Oliver O'Halloran" <oohall@gmail.com>
Subject: [PATCH v2 1/5] powerpc: mm: Simplify page_is_ram by using memblock_is_memory
Date: Wed, 28 Mar 2018 02:25:40 +0200	[thread overview]
Message-ID: <20180328002544.18526-2-j.neuschaefer@gmx.net> (raw)
In-Reply-To: <20180328002544.18526-1-j.neuschaefer@gmx.net>

Instead of open-coding the search in page_is_ram, call memblock_is_memory.

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---

v2: no changes
---
 arch/powerpc/mm/mem.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index fe8c61149fb8..da4e1555d61d 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -85,13 +85,7 @@ int page_is_ram(unsigned long pfn)
 #ifndef CONFIG_PPC64	/* XXX for now */
 	return pfn < max_pfn;
 #else
-	unsigned long paddr = (pfn << PAGE_SHIFT);
-	struct memblock_region *reg;
-
-	for_each_memblock(memory, reg)
-		if (paddr >= reg->base && paddr < (reg->base + reg->size))
-			return 1;
-	return 0;
+	return memblock_is_memory(__pfn_to_phys(pfn));
 #endif
 }
 
-- 
2.16.2

  reply	other threads:[~2018-03-28  0:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28  0:25 [PATCH v2 0/5] PPC32/ioremap: Use memblock API to check for RAM Jonathan Neuschäfer
2018-03-28  0:25 ` Jonathan Neuschäfer [this message]
2018-03-31 14:04   ` [v2, 1/5] powerpc: mm: Simplify page_is_ram by using memblock_is_memory Michael Ellerman
2018-03-28  0:25 ` [PATCH v2 2/5] powerpc: mm: Use memblock API for PPC32 page_is_ram Jonathan Neuschäfer
2018-03-28  0:25 ` [PATCH v2 3/5] powerpc/mm/32: Use page_is_ram to check for RAM Jonathan Neuschäfer
2018-03-28  0:25 ` [PATCH v2 4/5] powerpc: wii: Don't rely on the reserved memory hack Jonathan Neuschäfer
2018-03-28  0:25 ` [PATCH v2 5/5] powerpc/mm/32: Remove " Jonathan Neuschäfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180328002544.18526-2-j.neuschaefer@gmx.net \
    --to=j.neuschaefer@gmx.net \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mhocko@suse.com \
    --cc=mpe@ellerman.id.au \
    --cc=oohall@gmail.com \
    --cc=paulus@samba.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).