From patchwork Sun Mar 9 17:00:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 25943 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1CA6F206A6 for ; Sun, 9 Mar 2014 17:01:04 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id g12sf24801847oah.11 for ; Sun, 09 Mar 2014 10:01:03 -0700 (PDT) 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=UtEjJI0Mb4KypmXmMocvhotFQhMwtARcNtNlgfQgh+RLLRD5YndmozB7D4RmCnUZWT SQLNEPuJBnjJC3QdhvOKpdXH2hyThUZj/1x/1VWehYiX41GgtmD1HgCqxJAvUS7R7kAn ct8G7hnE9lt7s662w0uxYjqy+ORzax6XT9FSmjDo33yv/SIjleTnVujIuAuvMkuNaB7w fcneoGNFQwJOU3+m5PcHkMPLEL30JzYVWidJgxJcYJ/U4/Ciq6ZO3TXOeJB26Wi3LgFa 7oB+aEmD04cL9fqXZ9eyWws5CoDj/JAcdgU2zTh85lZidRavj8PlyR3+EKAyQ+diOZX7 Bu1A== X-Gm-Message-State: ALoCoQkj9cHiI+mTeqGbzzZLpWOdm9j08KomV1auGsYXB1dtDP4VR9lioMJtTOa+pkl7O7Ve2g1D X-Received: by 10.182.28.36 with SMTP id y4mr11108222obg.46.1394384463643; Sun, 09 Mar 2014 10:01:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.175 with SMTP id 44ls1860436qgp.12.gmail; Sun, 09 Mar 2014 10:01:03 -0700 (PDT) X-Received: by 10.58.128.72 with SMTP id nm8mr19471286veb.18.1394384463452; Sun, 09 Mar 2014 10:01:03 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id eb8si4647555vdb.138.2014.03.09.10.01.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Mar 2014 10:01:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so6080916veb.40 for ; Sun, 09 Mar 2014 10:01:03 -0700 (PDT) X-Received: by 10.220.109.1 with SMTP id h1mr19224348vcp.20.1394384463309; Sun, 09 Mar 2014 10:01:03 -0700 (PDT) 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.78.9 with SMTP id i9csp68967vck; Sun, 9 Mar 2014 10:01:03 -0700 (PDT) X-Received: by 10.140.97.37 with SMTP id l34mr33924002qge.56.1394384462599; Sun, 09 Mar 2014 10:01:02 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTP id t96si5849347qge.1.2014.03.09.10.01.02 for ; Sun, 09 Mar 2014 10:01:02 -0700 (PDT) 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-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s29H0vNs021929 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 9 Mar 2014 13:00:57 -0400 Received: from deneb.redhat.com (ovpn-113-45.phx2.redhat.com [10.3.113.45]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s29H0rc9030039; Sun, 9 Mar 2014 13:00:56 -0400 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 v6 1/6] x86/mm: sparse warning fix for early_memremap Date: Sun, 9 Mar 2014 13:00:39 -0400 Message-Id: <1394384444-23182-2-git-send-email-msalter@redhat.com> In-Reply-To: <1394384444-23182-1-git-send-email-msalter@redhat.com> References: <1394384444-23182-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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.181 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); +}