From patchwork Tue Mar 4 20:08:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 25718 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 78E2C20540 for ; Tue, 4 Mar 2014 20:09:36 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf116469oag.8 for ; Tue, 04 Mar 2014 12:09:36 -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=1Xmg7aySiTXHevmSAubIy1sKeFmHKbwQlKdYLJwsWV4=; b=UgNHl3PAZS3QUJdaluGuwiGc22yYkaRqtMnZ3h1QrB9/YaM/kuU65e9miJW+kOmnbK JAInqDRZR/uiR/KDOlE2iWunrUP6xGQgIr/dw8em59onyPJUwqPhkjpv7COD9exewwz6 I6WX5wmtx4gtHDFVL2Lrcox6iwuB3Y9y2W7Qx8BLxq++pN9uiTcS5aCj1IKtgZjeBrB6 kxAFdZn+09EmSIev5eVsE6Ug9uYTn9Akipcj4MsLUqQyzenKciDVByCE6AIU3GuqEseL xzMvOIVjaMxJ3qz4ixBObA42bQ1jQED4LLvdYmXtVbxRLuUkzMd7vOFWHFvGOEcemAUz z3gQ== X-Gm-Message-State: ALoCoQkDn9/zRCqZUY8af6sn86fCPN2R0ETsqSErevrBeTQ5XbSrUKrp0SVhJChpFU4JSlwLmI1B X-Received: by 10.182.109.200 with SMTP id hu8mr791444obb.20.1393963776020; Tue, 04 Mar 2014 12:09:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.39 with SMTP id g36ls8085qgd.25.gmail; Tue, 04 Mar 2014 12:09:35 -0800 (PST) X-Received: by 10.52.37.161 with SMTP id z1mr881559vdj.29.1393963775911; Tue, 04 Mar 2014 12:09:35 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id ug9si6137687vcb.107.2014.03.04.12.09.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 12:09:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id im17so33360vcb.5 for ; Tue, 04 Mar 2014 12:09:35 -0800 (PST) X-Received: by 10.220.147.16 with SMTP id j16mr1123145vcv.28.1393963775843; Tue, 04 Mar 2014 12:09:35 -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.130.193 with SMTP id u1csp151619vcs; Tue, 4 Mar 2014 12:09:28 -0800 (PST) X-Received: by 10.224.137.5 with SMTP id u5mr2236881qat.12.1393963766102; Tue, 04 Mar 2014 12:09:26 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTP id gd5si8553866qab.36.2014.03.04.12.09.25 for ; Tue, 04 Mar 2014 12:09:26 -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-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s24K9Dfc017367 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 4 Mar 2014 15:09:13 -0500 Received: from deneb.redhat.com (ovpn-113-45.phx2.redhat.com [10.3.113.45]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s24K9Aie021187; Tue, 4 Mar 2014 15:09:12 -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 1/5] x86/mm: sparse warning fix for early_memremap Date: Tue, 4 Mar 2014 15:08:54 -0500 Message-Id: <1393963738-9210-2-git-send-email-msalter@redhat.com> In-Reply-To: <1393963738-9210-1-git-send-email-msalter@redhat.com> References: <1393963738-9210-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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.220.174 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 Acked-by: H. Peter Anvin --- 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); +}