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: 8712241 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8C170C0553 for ; Thu, 31 Mar 2016 12:31:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BCBA92025B for ; Thu, 31 Mar 2016 12:31:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D216C20279 for ; Thu, 31 Mar 2016 12:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756627AbcCaM3y (ORCPT ); Thu, 31 Mar 2016 08:29:54 -0400 Received: from down.free-electrons.com ([37.187.137.238]:41946 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752504AbcCaM3u (ORCPT ); Thu, 31 Mar 2016 08:29:50 -0400 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.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 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 Cc: Mark Brown , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Vinod Koul , Dan Williams , dmaengine@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , linux-media@vger.kernel.org, Boris Brezillon , Richard Weinberger , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, Vignesh R , linux-mm@kvack.org, Joerg Roedel , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org 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> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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