From patchwork Fri Jan 10 03:50:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 23073 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 89D6720555 for ; Fri, 10 Jan 2014 03:51:37 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id e9sf6045007qcy.3 for ; Thu, 09 Jan 2014 19:51: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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=4ry9p3PT7q7J412qBgOzT/CEvwARIUFi+6E7GUKtXsI=; b=IEmxx3t9udv0khUnPqwfr1mh9p+LPacyER+KFAI8c3t6XM7NSFIjFTJxX2kkE/4g4m uk8hQObobTqqbDeRTvjAq09flJgXS7ZDhUWU2+VIZ4pSJeGFHmWXoPo0GmLqtHZoXSFI QQzWIbtpYtNjdlS6F9r4+xnlvjS/+JAFHud/ffdKXW4wRl4+sNYf42grKl63U2EFPVM1 +3+KLEd/TdN+Dds0XySMUX9dbUXQ55LfhQxdbbnBbzF14ChmziheofWEyRK6nCnHo0zh kLAIGIYXr4dY+Zu5FzNPAuCaJebmOdKjDORGY9V5YwTxQr1ZsanIbLhWvoclDVfvcaN6 5nqg== X-Gm-Message-State: ALoCoQmIeist1wtScDaKNKoXZaSUV7PnxfxwOmo5Mb5lv9o+He9//76TF6LqJEFdc7dedynM5Gpt X-Received: by 10.224.19.201 with SMTP id c9mr370213qab.0.1389325896361; Thu, 09 Jan 2014 19:51:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.106.102 with SMTP id gt6ls1335474qeb.78.gmail; Thu, 09 Jan 2014 19:51:36 -0800 (PST) X-Received: by 10.58.196.211 with SMTP id io19mr5795646vec.9.1389325896243; Thu, 09 Jan 2014 19:51:36 -0800 (PST) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id c14si3964321veu.142.2014.01.09.19.51.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Jan 2014 19:51:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.41; Received: by mail-vb0-f41.google.com with SMTP id p14so2855232vbm.0 for ; Thu, 09 Jan 2014 19:51:36 -0800 (PST) X-Received: by 10.52.116.200 with SMTP id jy8mr4960431vdb.15.1389325896120; Thu, 09 Jan 2014 19:51:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp57802ved; Thu, 9 Jan 2014 19:51:35 -0800 (PST) X-Received: by 10.68.93.165 with SMTP id cv5mr8136702pbb.98.1389325895057; Thu, 09 Jan 2014 19:51:35 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vz4si5730801pac.151.2014.01.09.19.51.34; Thu, 09 Jan 2014 19:51:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753166AbaAJDvX (ORCPT + 26 others); Thu, 9 Jan 2014 22:51:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12509 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbaAJDvU (ORCPT ); Thu, 9 Jan 2014 22:51:20 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0A3pKBf013400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 Jan 2014 22:51:20 -0500 Received: from deneb.redhat.com (ovpn-113-39.phx2.redhat.com [10.3.113.39]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0A3pHGw010085; Thu, 9 Jan 2014 22:51:19 -0500 From: Mark Salter To: linux-kernel@vger.kernel.org Cc: Dave Young , Mark Salter Subject: [PATCH v3 1/6] x86/mm: sparse warning fix for early_memremap Date: Thu, 9 Jan 2014 22:50:28 -0500 Message-Id: <1389325833-16535-2-git-send-email-msalter@redhat.com> In-Reply-To: <1389325833-16535-1-git-send-email-msalter@redhat.com> References: <1389325833-16535-1-git-send-email-msalter@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.212.41 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org 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); +}