Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932092AbcDDIQF (ORCPT ); Mon, 4 Apr 2016 04:16:05 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:60875 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbcDDIQB (ORCPT ); Mon, 4 Apr 2016 04:16:01 -0400 Subject: Re: [PATCH 1/4] mm: add is_highmem_addr() helper To: Boris Brezillon , David Woodhouse , Brian Norris , , Andrew Morton , Dave Gordon References: <1459427384-21374-1-git-send-email-boris.brezillon@free-electrons.com> <1459427384-21374-2-git-send-email-boris.brezillon@free-electrons.com> CC: Mark Brown , , , Vinod Koul , Dan Williams , , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , , Richard Weinberger , Herbert Xu , "David S. Miller" , , , Joerg Roedel , , From: Vignesh R Message-ID: <57022253.70400@ti.com> Date: Mon, 4 Apr 2016 13:44:11 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1459427384-21374-2-git-send-email-boris.brezillon@free-electrons.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 845 Lines: 32 Hi, On 03/31/2016 05:59 PM, Boris Brezillon wrote: > 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); Shouldn't this be: vaddr < (PKMAP_BASE + (LAST_PKMAP * PAGE_SIZE)) ? -- Regards Vignesh