From patchwork Wed Sep 26 12:47:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 147575 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp679887lji; Wed, 26 Sep 2018 05:48:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV61owgHIcUhajZElcT5nmqfRNllwSZatUlviMV07hYO43cl3ujiBd7VO3OupuX55grHsPycF X-Received: by 2002:a65:6102:: with SMTP id z2-v6mr5660447pgu.46.1537966101843; Wed, 26 Sep 2018 05:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537966101; cv=none; d=google.com; s=arc-20160816; b=TQFNdJ2icP1UjIOJakyeOK03uOBvhr4d3UBfOHn0JHIyEIyMnnSwXIgwlGo7VzT/SC hVeq6Ls2SHLiHCkffJ71qTtzlgOpOAQHe73agkeNVEjwBS8FDS5vh4ukF1nvv0W+JdNj 4zLavfIVLhZ1uSFpFiuZR6bgwiQxrIWGS4IFj+C5SJmx/sw1HWSTpvsbKm8217fYRnLj uNugPLPvHHxy81Qu+RpOVtoZ5nnUFEs2Sb3ZeO+v9SifzTw0DWBZKI6k7N8Gdb0rNpG6 1UOen1y1ytEM4xpjH8/Q0cY7BG0oBv3cuLfFpBraK7SOXXI7niYkVAw0dr9gu2L7nkVX 1h1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=zMGonSeApb0b3BV387cd3F+u/yM4BL8bnZj7Yv2lkY0=; b=GDDm7d1gM0ZLqwcUMEP20pYMq5pbWL1jPdklnqsqAxBIwrvnrRigwYLrvdushz+Qil vMmrbvqkHb06YMQzWwxUhfpEhIHwyWptuIqUARMn5Pr6lZpq2otiaADA/49t0eQ42B1P T84VHrCGIZr8n7JzxtVxdESMdmPGRQ0Y/1B2tu/l7QwMPaixhK+JZHGmpa3i2V4aOT7f P+PbDK5rC3tLSUpDwopgwgd+EXDlxAEZRdIweSJdcVNd5LzAsIdkHpd3qSsFBn+dqN1M +Dea45KYIntILbmgV+NmFNXhZGKg3TTx/NK+1UA/oIp7JcXLE7B/esZ8F+3yzcfQbX7p ylgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12-v6si4970804pfi.175.2018.09.26.05.48.21; Wed, 26 Sep 2018 05:48:21 -0700 (PDT) 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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728120AbeIZTBJ (ORCPT + 32 others); Wed, 26 Sep 2018 15:01:09 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:50963 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726802AbeIZTBJ (ORCPT ); Wed, 26 Sep 2018 15:01:09 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MN67J-1gNe7r3yIH-00J3Yv; Wed, 26 Sep 2018 14:48:11 +0200 From: Arnd Bergmann To: "David S. Miller" , Moritz Fischer Cc: Arnd Bergmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: nixge: fix warnings on 32-bit platforms Date: Wed, 26 Sep 2018 14:47:24 +0200 Message-Id: <20180926124808.1867468-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:+m0u6MbUQU2M7jZW9luw6tcoPEbGHLx5EJeZuMcyRH4UbyfgC+x IaHEUcKZDWrTfRbgBV3FmELZqbuhLhBwMA2fghP6e4YUMZmetyy816RowxbchFiNSCfpi0R +cL0zHUSiO7yF9ZfzAXQz+g2hZIpY/RqJBnfqxm50nYVf8Yy8TwBCyrFANa60ifZXWmy7Nc hl1SSdXHTIb9pefIrDpwg== X-UI-Out-Filterresults: notjunk:1; V01:K0:YIPCpvXZHMU=:z2NlL/0Zfe0TodzLWw2SUc E2tV+EqBzi6HaejRgpHTu6F40Jipo6VPKFW5r3ndg8c+8ONKZkvCKp7YF+G40b6g/naYH0UdZ XB9k2kj6v+ku49h9eWKRppTDZTImmYE0LUnERHKGs9Lyk8VPEYT61n23fmmqLgoHYzCiw+Gw5 bGzF+qphSbMOjRe1zCfovmZ8R1+24rMv50cHWvxTxf8r92P+eFza6Hpkbp+jVeIg63FiFkfX8 YNNPpuD/j467lCWJBXqcNwZ0AgsVW0loPKea6ftER+ebrlY6MCNcpXJTT+aqagfDMLUREMo91 APqSvAlbeA1ikuI+h4g/Iw3apZcQtMfTN329coPWE1ZccF4RIMNjU5ZlHVzIqHVT6ad0kIPhI JeZy+qvoBNDHzd0z4s053eV35cl5sFYPPhThywxTigmqNGIaGEarE01Atrxy2RLMCPdGAmfc8 dLDNqIf77mA95mCMV3pteKg8MDbyIHRaKCCV/9Y+48326uJ/qMA8X//rzLUTuFTMWUt+NMsdl 4o5K7fZpm4Ja3AUE1KDBBTD7HdhNU45J9nu681CQKIj217ZY++LogK1CFoz06+5W6Ut6K8yOC S5mhMWdzLZ3Ipj0ljWB+9xYiGroPtz1S0ZaDddTzJMgpoRzh1NHyCxWg8KosNZAsYKdaQiSVe U8akbTkrHYZOAdgyvBxlcm4BhJj5zxRxAJ4p7wSTniz5ZoGu+ilq/WrEa9F9cFzkeSnE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Making it work on 64-bit caused 32-bit builds to regress: drivers/net/ethernet/ni/nixge.c: In function 'nixge_hw_dma_bd_release': drivers/net/ethernet/ni/nixge.c:254:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] skb = (struct sk_buff *) ^ In file included from include/linux/skbuff.h:17, from include/linux/if_ether.h:23, from include/linux/etherdevice.h:25, from drivers/net/ethernet/ni/nixge.c:7: drivers/net/ethernet/ni/nixge.c: In function 'nixge_hw_dma_bd_init': drivers/net/ethernet/ni/nixge.c:130:37: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] (bd)->field##_lo = lower_32_bits(((u64)addr)); \ ^ include/linux/kernel.h:234:33: note: in definition of macro 'lower_32_bits' #define lower_32_bits(n) ((u32)(n)) ^ Casting to a uintptr_t avoids all these warnings. Fixes: 7e8d5755be0e ("net: nixge: Add support for 64-bit platforms") Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/ni/nixge.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.18.0 diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index 74cf52e3fb09..2e132f6a7c36 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -127,8 +127,8 @@ struct nixge_hw_dma_bd { #ifdef CONFIG_PHYS_ADDR_T_64BIT #define nixge_hw_dma_bd_set_addr(bd, field, addr) \ do { \ - (bd)->field##_lo = lower_32_bits(((u64)addr)); \ - (bd)->field##_hi = upper_32_bits(((u64)addr)); \ + (bd)->field##_lo = lower_32_bits(((uintptr_t)addr)); \ + (bd)->field##_hi = upper_32_bits(((uintptr_t)addr)); \ } while (0) #else #define nixge_hw_dma_bd_set_addr(bd, field, addr) \ @@ -251,7 +251,7 @@ static void nixge_hw_dma_bd_release(struct net_device *ndev) NIXGE_MAX_JUMBO_FRAME_SIZE, DMA_FROM_DEVICE); - skb = (struct sk_buff *) + skb = (struct sk_buff *)(uintptr_t) nixge_hw_dma_bd_get_addr(&priv->rx_bd_v[i], sw_id_offset); dev_kfree_skb(skb); @@ -601,8 +601,8 @@ static int nixge_recv(struct net_device *ndev, int budget) tail_p = priv->rx_bd_p + sizeof(*priv->rx_bd_v) * priv->rx_bd_ci; - skb = (struct sk_buff *)nixge_hw_dma_bd_get_addr(cur_p, - sw_id_offset); + skb = (struct sk_buff *)(uintptr_t) + nixge_hw_dma_bd_get_addr(cur_p, sw_id_offset); length = cur_p->status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK; if (length > NIXGE_MAX_JUMBO_FRAME_SIZE)