Message ID | 1398859589-22346-1-git-send-email-alchark@gmail.com |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
From: Alexey Charkov [mailto:alchark@gmail.com] ... > 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. ... > +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 */ Actually the above looks strange. Why does the vt8500 have a revision number of 0x84 ? Surely it should be 0x85, or even 0x8500 (or decimal 85000). David
2014-05-01 13:30 GMT+04:00 David Laight <David.Laight@aculab.com>: > From: Alexey Charkov [mailto:alchark@gmail.com] > ... >> 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. > ... >> +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 */ > > Actually the above looks strange. > Why does the vt8500 have a revision number of 0x84 ? > Surely it should be 0x85, or even 0x8500 (or decimal 85000). David, vt8500 is the SoC version (the first one I know where it appeared, might have been used earlier though), not the version of the Rhine core itself (no clue what that is). Here's the source for 0x84 (see line 1031): https://github.com/wondermedia/wm8850/blob/master/ANDROID_3.0.8/arch/arm/common/pci_wmt.c Vendor kernel uses an emulated (shadow-only) PCI bus to bind some obscure PCI driver (not upstream) to the integrated Rhine core, and that emulated PCI bus has Rhine listed with revision 0x84 on it. Anyway, I've now submitted a new patch instead of this one where I got rid of the 0x84 altogether - see https://lkml.org/lkml/2014/4/30/500 Best, Alexey -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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); }
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(-)