linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: michal.simek@xilinx.com, anirudha.sarangi@xilinx.com,
	john.linn@xilinx.com, mchehab+samsung@kernel.org,
	gregkh@linuxfoundation.org, nicolas.ferre@microchip.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Subject: [PATCH v3 -next 3/4] net: emaclite: Fix arm64 compilation warnings
Date: Fri, 31 Jan 2020 17:17:49 +0530	[thread overview]
Message-ID: <1580471270-16262-4-git-send-email-radhey.shyam.pandey@xilinx.com> (raw)
In-Reply-To: <1580471270-16262-1-git-send-email-radhey.shyam.pandey@xilinx.com>

From: Michal Simek <michal.simek@xilinx.com>

Recast pointers with ulong instead of u32 for arm64.
This patch fixes these compilation warnings:

drivers/net/ethernet/xilinx/xilinx_emaclite.c:
In function ‘xemaclite_send_data’:
drivers/net/ethernet/xilinx/xilinx_emaclite.c:335:35:
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   addr = (void __iomem __force *)((u32 __force)addr ^
                                   ^
drivers/net/ethernet/xilinx/xilinx_emaclite.c:335:10:
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   addr = (void __iomem __force *)((u32 __force)addr ^
          ^
drivers/net/ethernet/xilinx/xilinx_emaclite.c:
In function ‘xemaclite_recv_data’:
drivers/net/ethernet/xilinx/xilinx_emaclite.c:397:36:
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    addr = (void __iomem __force *)((u32 __force)addr ^
                                    ^
drivers/net/ethernet/xilinx/xilinx_emaclite.c:397:11:
warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    addr = (void __iomem __force *)((u32 __force)addr ^
           ^
drivers/net/ethernet/xilinx/xilinx_emaclite.c:
In function ‘xemaclite_rx_handler’:
drivers/net/ethernet/xilinx/xilinx_emaclite.c:97:42:
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define BUFFER_ALIGN(adr) ((ALIGNMENT - ((u32)adr)) % ALIGNMENT)
                                          ^
drivers/net/ethernet/xilinx/xilinx_emaclite.c:612:10:
note: in expansion of macro ‘BUFFER_ALIGN’
  align = BUFFER_ALIGN(skb->data);
          ^~~~~~~~~~~~
In file included from ./include/linux/dma-mapping.h:7,
                 from ./include/linux/skbuff.h:31,
                 from ./include/linux/if_ether.h:19,
                 from ./include/uapi/linux/ethtool.h:19,
                 from ./include/linux/ethtool.h:18,
                 from ./include/linux/netdevice.h:37,
                 from drivers/net/ethernet/xilinx/xilinx_emaclite.c:12:
drivers/net/ethernet/xilinx/xilinx_emaclite.c:
In function ‘xemaclite_of_probe’:
drivers/net/ethernet/xilinx/xilinx_emaclite.c:1191:4:
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    (unsigned int __force)lp->base_addr, ndev->irq);
    ^
./include/linux/device.h:1780:33: note: in definition of macro ‘dev_info’
  _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                 ^~~~~~~~~~~

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 7f98728..96e9d21 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -94,7 +94,7 @@
 #define ALIGNMENT		4
 
 /* BUFFER_ALIGN(adr) calculates the number of bytes to the next alignment. */
-#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((u32)adr)) % ALIGNMENT)
+#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((ulong)adr)) % ALIGNMENT)
 
 #ifdef __BIG_ENDIAN
 #define xemaclite_readl		ioread32be
@@ -332,7 +332,7 @@ static int xemaclite_send_data(struct net_local *drvdata, u8 *data,
 		 * if it is configured in HW
 		 */
 
-		addr = (void __iomem __force *)((u32 __force)addr ^
+		addr = (void __iomem __force *)((ulong __force)addr ^
 						 XEL_BUFFER_OFFSET);
 		reg_data = xemaclite_readl(addr + XEL_TSR_OFFSET);
 
@@ -394,7 +394,7 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data, int maxlen)
 		 * will correct on subsequent calls
 		 */
 		if (drvdata->rx_ping_pong != 0)
-			addr = (void __iomem __force *)((u32 __force)addr ^
+			addr = (void __iomem __force *)((ulong __force)addr ^
 							 XEL_BUFFER_OFFSET);
 		else
 			return 0;	/* No data was available */
@@ -1186,9 +1186,9 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	}
 
 	dev_info(dev,
-		 "Xilinx EmacLite at 0x%08X mapped to 0x%08X, irq=%d\n",
+		 "Xilinx EmacLite at 0x%08X mapped to 0x%08lX, irq=%d\n",
 		 (unsigned int __force)ndev->mem_start,
-		 (unsigned int __force)lp->base_addr, ndev->irq);
+		 (unsigned long __force)lp->base_addr, ndev->irq);
 	return 0;
 
 error:
-- 
2.7.4


  parent reply	other threads:[~2020-01-31 11:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 11:47 [PATCH v3 -next 0/4] net: emaclite: support arm64 platform Radhey Shyam Pandey
2020-01-31 11:47 ` [PATCH v3 -next 1/4] net: emaclite: Fix coding style Radhey Shyam Pandey
2020-01-31 11:47 ` [PATCH v3 -next 2/4] net: emaclite: In kconfig remove arch dependency Radhey Shyam Pandey
2020-01-31 11:47 ` Radhey Shyam Pandey [this message]
2020-01-31 13:37   ` [PATCH v3 -next 3/4] net: emaclite: Fix arm64 compilation warnings Andrew Lunn
2020-02-10 14:26     ` Radhey Shyam Pandey
2020-01-31 11:47 ` [PATCH v3 -next 4/4] net: emaclite: Fix restricted cast warning of sparse Radhey Shyam Pandey
2020-01-31 13:48   ` Andrew Lunn
2020-02-10 14:55     ` Radhey Shyam Pandey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1580471270-16262-4-git-send-email-radhey.shyam.pandey@xilinx.com \
    --to=radhey.shyam.pandey@xilinx.com \
    --cc=anirudha.sarangi@xilinx.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.linn@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).