linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Charkov <alchark@gmail.com>
To: Roger Luethi <rl@hellgate.ch>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	David Laight <David.Laight@ACULAB.COM>,
	Jan Moskyto Matejka <mq@suse.cz>
Cc: Alexey Charkov <alchark@gmail.com>
Subject: [PATCH] net: via-rhine: Fix compiler warning re: pointer casting on 64bit
Date: Wed, 30 Apr 2014 16:06:29 +0400	[thread overview]
Message-ID: <1398859589-22346-1-git-send-email-alchark@gmail.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D0F702D00@AcuExch.aculab.com>

Fixed different size cast warning:

        drivers/net/ethernet/via/via-rhine.c: In function ‘rhine_init_one_platform’:
        drivers/net/ethernet/via/via-rhine.c:1132:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
          revision = (u32)match->data;
                     ^

That code was added in commit 2d283862dc62daead9db0dc89cd0d0351e91f765
("net: via-rhine: add OF bus binding").

This patch removes the cast altogether, and instead stores an actual
pointer to u8 in match->data. All instances of 'revision' are also
unified to u8 instead of an assortment of different integer types,
in line with the definition of 'revision' in struct pci_dev.

Tested in platform configuration on a VIA WM8950 APC Rock board.

Reported-by: Jan Moskyto Matejka <mq@suse.cz>
Signed-off-by: Alexey Charkov <alchark@gmail.com>
---
 drivers/net/ethernet/via/via-rhine.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 4fa9201..80cdc91 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -287,8 +287,9 @@ MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
  * The .data field is currently only used to store chip revision
  * (for quirks etc.)
  */
+static u8 vt8500_revision = 0x84;
 static struct of_device_id rhine_of_tbl[] = {
-	{ .compatible = "via,vt8500-rhine", .data = (void *)0x84 },
+	{ .compatible = "via,vt8500-rhine", .data = &vt8500_revision },
 	{ }	/* terminate list */
 };
 MODULE_DEVICE_TABLE(of, rhine_of_tbl);
@@ -459,7 +460,7 @@ struct rhine_private {
 	unsigned char *tx_bufs;
 	dma_addr_t tx_bufs_dma;
 
-	int revision;
+	u8 revision;
 	int irq;
 	long pioaddr;
 	struct net_device *dev;
@@ -882,7 +883,7 @@ static const struct net_device_ops rhine_netdev_ops = {
 #endif
 };
 
-static int rhine_init_one_common(struct device *hwdev, int revision,
+static int rhine_init_one_common(struct device *hwdev, u8 revision,
 				 long pioaddr, void __iomem *ioaddr, int irq)
 {
 	struct net_device *dev;
@@ -1111,7 +1112,7 @@ err_out:
 static int rhine_init_one_platform(struct platform_device *pdev)
 {
 	const struct of_device_id *match;
-	u32 revision;
+	const u8 *revision;
 	int irq;
 	struct resource *res;
 	void __iomem *ioaddr;
@@ -1129,11 +1130,11 @@ static int rhine_init_one_platform(struct platform_device *pdev)
 	if (!irq)
 		return -EINVAL;
 
-	revision = (u32)match->data;
+	revision = match->data;
 	if (!revision)
 		return -EINVAL;
 
-	return rhine_init_one_common(&pdev->dev, revision,
+	return rhine_init_one_common(&pdev->dev, *revision,
 				     (long)ioaddr, ioaddr, irq);
 }
 
-- 
1.9.1


  reply	other threads:[~2014-04-30 12:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 17:36 [PATCH] net: via-rhine: fix compiler warning Jan Moskyto Matejka
2014-04-29 18:09 ` Alexey Charkov
2014-04-29 19:47   ` Jan Moskyto Matejka
2014-04-30  8:49 ` David Laight
2014-04-30  9:22   ` Alexey Charkov
2014-04-30  9:35     ` David Laight
2014-04-30 12:06       ` Alexey Charkov [this message]
2014-04-30 18:21         ` [PATCH] net: via-rhine: Drop revision property, use quirks instead Alexey Charkov
2014-05-02 19:56           ` David Miller
2014-05-03 12:40             ` [PATCH] net: via-rhine: Convert #ifdef USE_MMIO to a runtime flag Alexey Charkov
2014-05-05 19:37               ` David Miller
2014-05-01  9:30         ` [PATCH] net: via-rhine: Fix compiler warning re: pointer casting on 64bit David Laight
2014-05-01 11:33           ` Alexey Charkov
2014-04-30  9:50     ` [PATCH] net: via-rhine: fix compiler warning Jan Moskyto Matejka
2014-04-30  9:57       ` David Laight
2014-04-30 10:08         ` Jan Moskyto Matejka

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=1398859589-22346-1-git-send-email-alchark@gmail.com \
    --to=alchark@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mq@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=rl@hellgate.ch \
    /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).