From patchwork Mon Jun 13 12:54:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9172891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0260B6075D for ; Mon, 13 Jun 2016 12:55:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9D1F21C9A for ; Mon, 13 Jun 2016 12:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE51826861; Mon, 13 Jun 2016 12:55:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 854FB21C9A for ; Mon, 13 Jun 2016 12:55:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423342AbcFMMye (ORCPT ); Mon, 13 Jun 2016 08:54:34 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:65161 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422747AbcFMMyd (ORCPT ); Mon, 13 Jun 2016 08:54:33 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0LpOJJ-1bgI0v08Un-00fD5e; Mon, 13 Jun 2016 14:54:12 +0200 From: Arnd Bergmann To: Leon Romanovsky Cc: netdev@vger.kernel.org, Arnd Bergmann , Moni Shoua , Doug Ledford , Sean Hefty , Hal Rosenstock , Kamal Heib , Haggai Eran , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] infiniband: rxe: fix 32-bit build warnings Date: Mon, 13 Jun 2016 14:54:55 +0200 Message-Id: <1465822509-4167617-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1465822509-4167617-1-git-send-email-arnd@arndb.de> References: <1465822509-4167617-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:QnL3N889V5gbTxA+L5Ee1wxU6wfT4HovPb20oaJXAFiLpGEwmaA ZSRNpIIj/SO55ElD6jRqvUCN53sKZC0jrMUaH48r8QO0LHVvRfV70G13khwWvOmpEPvjL/q o7R7tRiK5UC+abdgI/FtXLS+XBTm/imYdNquJhT/x+Fup6I7JdnSybV3OJ+XA0Rp+P3D3C+ vYIWSYFvJz80Oazb/FkSA== X-UI-Out-Filterresults: notjunk:1; V01:K0:khzmv7se7WQ=:7VGoqF8H4Xeo+wZxumU3nv aaoknCxLhvGzi/nrNF1dtgL63rmnODLaIlcTL8STx6N5gh6DZfNOiC0JcVN52NnLgrdRgaCGp 4ePqt5ziLtE1qx758Q8ekOkfJMtWbN2zMGjpDtRXIwLHbBuT/z+USZP1t7HMPA+DXz+VSmvfs UgEKZhgTzW0esfyWHa6WzG+GEkotuHEaMX2+XbOGq6kD14xbc5RTLerb2J4ULO1pSjkb2Rn9a kDjL5cSEulqEYWKnd5a+T9O9HIv3TESowILianqXBC3fHiry3Wl44mXMxnXyxoeoh7zLD0QmJ KFk4M5MhFVlvnWqkxg0xnl7kH/SPoQMK5HEB+4ApUAQUhd21h5K0BiVzlNKB+llbMpjoCaGg8 PGjVL5Cect+Rsz5RnRYUzB9wN7SUVeotHJtyxoNfh/Yc8mdhVRtGkPNVRiRu9JmdN5gkRtQ0U b4eu3aI6QQbjkbwUFvTpFksDWILAJW9Z6Vdi91yw5YeaAuM7s/C3jOsw+/exXqF/fJgyF4cxg UQ7a9D4j2TuEqD6EV3oxGBX/jgHzIzOG0Q0LxgSvRcEe14OzhRcrPUTwCBpjzncm4My0hk3wo 6iBjE+4/M2TS9XbSH1qTMuzRVolCyNEWKWPfjtNQ9uGc/Y5f1RSG+3Up2wSPmnGwzuinvpBUy Rme4sbdkiKZPDRI7+WXSQJIwpAtn+VGewZdMewKU86JScNZMsEkxWJOmVz5iv5/pLU0Y= Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The new rxe infinband driver passes around pointers that have been converted to 64-bit integers. This is valid, but causes compile-time warnings on all 32-bit architectures: infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_map_single': infiniband/hw/rxe/rxe_dma.c:49:9: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] return (u64)cpu_addr; ^ infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_map_page': infiniband/hw/rxe/rxe_dma.c:73:9: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] infiniband/hw/rxe/rxe_dma.c: In function 'rxe_map_sg': infiniband/hw/rxe/rxe_dma.c:99:10: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] infiniband/hw/rxe/rxe_dma.c: In function 'rxe_dma_alloc_coherent': infiniband/hw/rxe/rxe_dma.c:143:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] This changes the cast to use 'uintptr_t', which can always be cast to and from pointer, and can be assigned to and from 64-bit integers. Signed-off-by: Arnd Bergmann --- drivers/infiniband/hw/rxe/rxe_dma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/rxe/rxe_dma.c b/drivers/infiniband/hw/rxe/rxe_dma.c index f080bc5bda43..7634c1a81b2b 100644 --- a/drivers/infiniband/hw/rxe/rxe_dma.c +++ b/drivers/infiniband/hw/rxe/rxe_dma.c @@ -46,7 +46,7 @@ static u64 rxe_dma_map_single(struct ib_device *dev, enum dma_data_direction direction) { WARN_ON(!valid_dma_direction(direction)); - return (u64)cpu_addr; + return (uintptr_t)cpu_addr; } static void rxe_dma_unmap_single(struct ib_device *dev, @@ -70,7 +70,7 @@ static u64 rxe_dma_map_page(struct ib_device *dev, goto done; } - addr = (u64)page_address(page); + addr = (uintptr_t)page_address(page); if (addr) addr += offset; @@ -96,7 +96,7 @@ static int rxe_map_sg(struct ib_device *dev, struct scatterlist *sgl, WARN_ON(!valid_dma_direction(direction)); for_each_sg(sgl, sg, nents, i) { - addr = (u64)page_address(sg_page(sg)); + addr = (uintptr_t)page_address(sg_page(sg)); if (!addr) { ret = 0; break; @@ -140,7 +140,7 @@ static void *rxe_dma_alloc_coherent(struct ib_device *dev, size_t size, addr = page_address(p); if (dma_handle) - *dma_handle = (u64)addr; + *dma_handle = (uintptr_t)addr; return addr; }