From patchwork Thu Oct 14 20:15:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 67857 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 413A71009D5 for ; Fri, 15 Oct 2010 07:15:50 +1100 (EST) Received: by ozlabs.org (Postfix) id E93A1B70ED; Fri, 15 Oct 2010 07:15:41 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from AM1EHSOBE004.bigfish.com (am1ehsobe004.messaging.microsoft.com [213.199.154.207]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "Cybertrust SureServer Standard Validation CA" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 478C7B70AF for ; Fri, 15 Oct 2010 07:15:40 +1100 (EST) Received: from mail21-am1-R.bigfish.com (10.3.201.251) by AM1EHSOBE004.bigfish.com (10.3.204.24) with Microsoft SMTP Server id 14.1.225.8; Thu, 14 Oct 2010 20:15:35 +0000 Received: from mail21-am1 (localhost.localdomain [127.0.0.1]) by mail21-am1-R.bigfish.com (Postfix) with ESMTP id C7DE69A85A9 for ; Thu, 14 Oct 2010 20:15:35 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h62h) X-Spam-TCS-SCL: 1:0 Received: from mail21-am1 (localhost.localdomain [127.0.0.1]) by mail21-am1 (MessageSwitch) id 1287087334631431_5659; Thu, 14 Oct 2010 20:15:34 +0000 (UTC) Received: from am1ehsmhs010.bigfish.com (unknown [10.3.201.243]) by mail21-am1.bigfish.com (Postfix) with ESMTP id 91F956B8053 for ; Thu, 14 Oct 2010 20:15:34 +0000 (UTC) Received: from de01egw02.freescale.net (192.88.165.103) by am1ehsmhs010.bigfish.com (10.3.207.110) with Microsoft SMTP Server (TLS) id 14.0.482.44; Thu, 14 Oct 2010 20:15:33 +0000 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by de01egw02.freescale.net (8.14.3/8.14.3) with ESMTP id o9EKFVaB003721 for ; Thu, 14 Oct 2010 13:15:32 -0700 (MST) Received: from efes.am.freescale.net (efes.am.freescale.net [10.82.123.3]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id o9EKFVP5025297; Thu, 14 Oct 2010 15:15:31 -0500 (CDT) From: Timur Tabi To: , Subject: [PATCH] powerpc: fix warning when compiling immap_qe.h Date: Thu, 14 Oct 2010 15:15:30 -0500 Message-ID: <1287087330-11172-1-git-send-email-timur@freescale.com> X-Mailer: git-send-email 1.7.2.3 MIME-Version: 1.0 X-Reverse-DNS: de01egw02.freescale.net X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Fix the warnings genereted by arch/powerpc/include/asm/immap_qe.h when CONFIG_PHYS_ADDR_T_64BIT is defined: immap_qe.h: In function 'immrbar_virt_to_phys': immap_qe.h:472:8: warning: cast from pointer to integer of different size immap_qe.h:472:24: warning: cast from pointer to integer of different size immap_qe.h:473:5: warning: cast from pointer to integer of different size immap_qe.h:473:21: warning: cast from pointer to integer of different size immap_qe.h:474:36: warning: cast from pointer to integer of different size Note that the QE does not support 36-bit physical addresses, so even when CONFIG_PHYS_ADDR_T_64BIT is defined, the QE MURAM must be located below the 4GB boundary. Signed-off-by: Timur Tabi --- arch/powerpc/include/asm/immap_qe.h | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h index 4e10f50..0edb684 100644 --- a/arch/powerpc/include/asm/immap_qe.h +++ b/arch/powerpc/include/asm/immap_qe.h @@ -467,13 +467,22 @@ struct qe_immap { extern struct qe_immap __iomem *qe_immr; extern phys_addr_t get_qe_base(void); -static inline unsigned long immrbar_virt_to_phys(void *address) +/* + * Returns the offset within the QE address space of the given pointer. + * + * Note that the QE does not support 36-bit physical addresses, so if + * get_qe_base() returns a number above 4GB, the caller will probably fail. + */ +static inline phys_addr_t immrbar_virt_to_phys(void *address) { - if ( ((u32)address >= (u32)qe_immr) && - ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) ) - return (unsigned long)(address - (u32)qe_immr + - (u32)get_qe_base()); - return (unsigned long)virt_to_phys(address); + void *q = (void *)qe_immr; + + /* Is it a MURAM address? */ + if ((address >= q) && (address < (q + QE_IMMAP_SIZE))) + return get_qe_base() + (address - q); + + /* It's an address returned by kmalloc */ + return virt_to_phys(address); } #endif /* __KERNEL__ */