From patchwork Thu Mar 31 12:29:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 604100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qbP6X00sLz9sXQ for ; Thu, 31 Mar 2016 23:32:36 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1albkP-0006my-Ar; Thu, 31 Mar 2016 12:30:49 +0000 Received: from down.free-electrons.com ([37.187.137.238] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1albjl-00057K-Bv; Thu, 31 Mar 2016 12:30:13 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id CECDF181F; Thu, 31 Mar 2016 14:29:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LMontsouris-657-1-184-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 38A49181D; Thu, 31 Mar 2016 14:29:47 +0200 (CEST) From: Boris Brezillon To: David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org, Andrew Morton , Dave Gordon Subject: [PATCH 1/4] mm: add is_highmem_addr() helper Date: Thu, 31 Mar 2016 14:29:41 +0200 Message-Id: <1459427384-21374-2-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459427384-21374-1-git-send-email-boris.brezillon@free-electrons.com> References: <1459427384-21374-1-git-send-email-boris.brezillon@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160331_053009_647566_0450BE03 X-CRM114-Status: GOOD ( 12.35 ) X-Spam-Score: -2.9 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [37.187.137.238 listed in list.dnswl.org] -1.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , linux-crypto@vger.kernel.org, Herbert Xu , Vinod Koul , Richard Weinberger , Joerg Roedel , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Vignesh R , linux-mm@kvack.org, iommu@lists.linux-foundation.org, Mark Brown , Hans Verkuil , Laurent Pinchart , dmaengine@vger.kernel.org, Dan Williams , linux-media@vger.kernel.org, "David S. Miller" , linux-arm-kernel@lists.infradead.org, Mauro Carvalho Chehab MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add an helper to check if a virtual address is in the highmem region. Signed-off-by: Boris Brezillon --- include/linux/highmem.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index bb3f329..13dff37 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -41,6 +41,14 @@ void kmap_flush_unused(void); struct page *kmap_to_page(void *addr); +static inline bool is_highmem_addr(const void *x) +{ + unsigned long vaddr = (unsigned long)x; + + return vaddr >= PKMAP_BASE && + vaddr < ((PKMAP_BASE + LAST_PKMAP) * PAGE_SIZE); +} + #else /* CONFIG_HIGHMEM */ static inline unsigned int nr_free_highpages(void) { return 0; } @@ -50,6 +58,11 @@ static inline struct page *kmap_to_page(void *addr) return virt_to_page(addr); } +static inline bool is_highmem_addr(const void *x) +{ + return false; +} + #define totalhigh_pages 0UL #ifndef ARCH_HAS_KMAP