From patchwork Wed Feb 12 20:56:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 24556 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B532020143 for ; Wed, 12 Feb 2014 20:56:54 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id fa1sf22046559pad.0 for ; Wed, 12 Feb 2014 12:56:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=XNUvd0fHG05BMtNJVdQCKBDNDjAA+1gHl/JzmZY6Orc=; b=kjs4qud9rMDeat2DouwEZ1meDboVjuTbyKhQmnZAQUtth103kvf7Dpt6z8VHc6u7A1 KWIUZIG8MiSF8YjHDlq7D/GURUIvGKOfcSAoTBtmVlZ9pqIFFJK1/jgAzaDg5Sr+m6ck aQuT8BD3M3Ka7WGiEB5/c0hgjH9+de2cc5aSLREUWn4HY+uzXYxshKFxw6tSCwRtF97T uERYaSZjtPTiSd9avfQIG4tTTuoYceFb86w1/cDl4viu9vq2QnAb8X0rxEWBj8zYgye1 WsRxXSvgqHMOjJtNXRyGXzJXcfbAYfvLKhh6hIYp/RIbbITMfjNyh8fP1LfK4luVAi1w 0LIg== X-Gm-Message-State: ALoCoQllGKlj0vYcRESmeUjvxAzmdBNRIFZwnhVpkveolu40xUEfDrssMVTU5WCo4Ue3uMAIq8jg X-Received: by 10.66.144.228 with SMTP id sp4mr2438780pab.5.1392238613960; Wed, 12 Feb 2014 12:56:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.228 with SMTP id h91ls2308662qgf.76.gmail; Wed, 12 Feb 2014 12:56:53 -0800 (PST) X-Received: by 10.59.1.102 with SMTP id bf6mr6950ved.69.1392238613783; Wed, 12 Feb 2014 12:56:53 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id sl9si7765384veb.135.2014.02.12.12.56.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Feb 2014 12:56:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id c14so7706780vea.20 for ; Wed, 12 Feb 2014 12:56:53 -0800 (PST) X-Received: by 10.58.204.4 with SMTP id ku4mr1541553vec.34.1392238613685; Wed, 12 Feb 2014 12:56:53 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp29946vcz; Wed, 12 Feb 2014 12:56:53 -0800 (PST) X-Received: by 10.229.119.73 with SMTP id y9mr54272055qcq.18.1392238612975; Wed, 12 Feb 2014 12:56:52 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTP id mq7si7154555qcb.27.2014.02.12.12.56.52 for ; Wed, 12 Feb 2014 12:56:52 -0800 (PST) Received-SPF: pass (google.com: domain of msalter@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1CKuhW1030192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Feb 2014 15:56:44 -0500 Received: from deneb.redhat.com (ovpn-113-111.phx2.redhat.com [10.3.113.111]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1CKuadA031530; Wed, 12 Feb 2014 15:56:42 -0500 From: Mark Salter To: x86@kernel.org Cc: Dave Young , linux-kernel@vger.kernel.org, Andrew Morton , Arnd Bergmann , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , patches@linaro.org, Mark Salter Subject: [PATCH v4 1/6] x86/mm: sparse warning fix for early_memremap Date: Wed, 12 Feb 2014 15:56:10 -0500 Message-Id: <1392238575-10000-2-git-send-email-msalter@redhat.com> In-Reply-To: <1392238575-10000-1-git-send-email-msalter@redhat.com> References: <1392238575-10000-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: msalter@redhat.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Dave Young There's a lot of sparse warnings for code like below: void *a = early_memremap(phys_addr, size); early_memremap intend to map kernel memory with ioremap facility, the return pointer should be a kernel ram pointer instead of iomem one. For making the function clearer and supressing sparse warnings this patch do below two things: 1. cast to (__force void *) for the return value of early_memremap 2. add early_memunmap function and pass (__force void __iomem *) to iounmap >From Boris: > Ingo told me yesterday, it makes sense too. I'd guess we can try it. > FWIW, all callers of early_memremap use the memory they get remapped as > normal memory so we should be safe. Signed-off-by: Dave Young Signed-off-by: Mark Salter --- arch/x86/include/asm/io.h | 3 ++- arch/x86/mm/ioremap.c | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 34f69cb..1db414f 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -325,9 +325,10 @@ extern void early_ioremap_init(void); extern void early_ioremap_reset(void); extern void __iomem *early_ioremap(resource_size_t phys_addr, unsigned long size); -extern void __iomem *early_memremap(resource_size_t phys_addr, +extern void *early_memremap(resource_size_t phys_addr, unsigned long size); extern void early_iounmap(void __iomem *addr, unsigned long size); +extern void early_memunmap(void *addr, unsigned long size); extern void fixup_early_ioremap(void); extern bool is_early_ioremap_ptep(pte_t *ptep); diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 799580c..bbb4504 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -562,10 +562,9 @@ early_ioremap(resource_size_t phys_addr, unsigned long size) } /* Remap memory */ -void __init __iomem * -early_memremap(resource_size_t phys_addr, unsigned long size) +void __init *early_memremap(resource_size_t phys_addr, unsigned long size) { - return __early_ioremap(phys_addr, size, PAGE_KERNEL); + return (__force void *)__early_ioremap(phys_addr, size, PAGE_KERNEL); } void __init early_iounmap(void __iomem *addr, unsigned long size) @@ -620,3 +619,8 @@ void __init early_iounmap(void __iomem *addr, unsigned long size) } prev_map[slot] = NULL; } + +void __init early_memunmap(void *addr, unsigned long size) +{ + early_iounmap((__force void __iomem *)addr, size); +}