From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752115Ab1GBPxl (ORCPT ); Sat, 2 Jul 2011 11:53:41 -0400 Received: from mail.southpole.se ([193.12.106.18]:44908 "EHLO mail.southpole.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994Ab1GBPxj (ORCPT ); Sat, 2 Jul 2011 11:53:39 -0400 From: Jonas Bonn To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: Jonas Bonn , vapier@gentoo.org, liqin.chen@sunplusct.com, gxt@mprc.pku.edu.cn Subject: [PATCH 1/2] asm-generic: add MMU variants of io.h functions Date: Sat, 2 Jul 2011 17:53:25 +0200 Message-Id: <1309622006-28343-1-git-send-email-jonas@southpole.se> X-Mailer: git-send-email 1.7.4.1 X-Assp-Client-SSL: yes Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of the implementations, in particular the ioremap variants, in asm-generic/io.h are for systems with an MMU. In order to be able to use the generic header file for systems with an MMU, this patch wraps these implementations in checks for CONFIG_MMU. Tested on OpenRISC. Signed-off-by: Jonas Bonn Cc: vapier@gentoo.org Cc: liqin.chen@sunplusct.com Cc: gxt@mprc.pku.edu.cn --- I'm not totally certain that this doesn't have implications for the other architectures, in particular Score which seems to have an MMU yet uses these ioremap functions anyway... Comments on this would be appreciated. Thanks, Jonas include/asm-generic/io.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index e0ffa3d..50f4f43 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -307,7 +307,11 @@ static inline void *phys_to_virt(unsigned long address) /* * Change "struct page" to physical address. + * + * This implementation is for the no-MMU case only... if you have an MMU + * you'll need to provide your own definitions. */ +#ifndef CONFIG_MMU static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) { return (void __iomem*) (unsigned long)offset; @@ -326,6 +330,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) static inline void iounmap(void *addr) { } +#endif /* CONFIG_MMU */ #ifndef CONFIG_GENERIC_IOMAP static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) @@ -342,7 +347,12 @@ extern void ioport_unmap(void __iomem *p); #endif /* CONFIG_GENERIC_IOMAP */ #define xlate_dev_kmem_ptr(p) p + +#ifdef CONFIG_MMU +#define xlate_dev_mem_ptr(p) __va(p) +#else #define xlate_dev_mem_ptr(p) ((void *) (p)) +#endif #ifndef virt_to_bus static inline unsigned long virt_to_bus(volatile void *address) -- 1.7.4.1