* [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit
@ 2015-10-02 23:44 Stephen Warren
2015-10-05 16:45 ` Joe Hershberger
2015-10-29 19:32 ` Joe Hershberger
0 siblings, 2 replies; 5+ messages in thread
From: Stephen Warren @ 2015-10-02 23:44 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
Casting from dev->priv to pci_dev_t changes the value's size on a 64-bit
system. This causes the compiler to complain about casting a pointer to an
integer of a different (smaller) size. To avoid this, cast to an integer
of matching size first, then perform an int->int cast to perform the size
change. This signals explicitly that we do want to change the size, and
avoids the compiler warning. This is legitimate since we know the pointer
actually stores a small integer, not a pointer value.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
drivers/net/rtl8169.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index ebd46b27e5fd..19422c4a2ace 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -581,7 +581,8 @@ int rtl8169_eth_recv(struct udevice *dev, int flags, uchar **packetp)
#else
static int rtl_recv(struct eth_device *dev)
{
- return rtl_recv_common((pci_dev_t)dev->priv, dev->iobase, NULL);
+ return rtl_recv_common((pci_dev_t)(unsigned long)dev->priv,
+ dev->iobase, NULL);
}
#endif /* nCONFIG_DM_ETH */
@@ -666,8 +667,8 @@ int rtl8169_eth_send(struct udevice *dev, void *packet, int length)
#else
static int rtl_send(struct eth_device *dev, void *packet, int length)
{
- return rtl_send_common((pci_dev_t)dev->priv, dev->iobase, packet,
- length);
+ return rtl_send_common((pci_dev_t)(unsigned long)dev->priv,
+ dev->iobase, packet, length);
}
#endif
@@ -846,7 +847,8 @@ RESET - Finish setting up the ethernet interface
***************************************************************************/
static int rtl_reset(struct eth_device *dev, bd_t *bis)
{
- rtl8169_common_start((pci_dev_t)dev->priv, dev->enetaddr);
+ rtl8169_common_start((pci_dev_t)(unsigned long)dev->priv,
+ dev->enetaddr);
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit
2015-10-02 23:44 [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit Stephen Warren
@ 2015-10-05 16:45 ` Joe Hershberger
2015-10-21 16:32 ` Stephen Warren
2015-10-29 19:32 ` Joe Hershberger
1 sibling, 1 reply; 5+ messages in thread
From: Joe Hershberger @ 2015-10-05 16:45 UTC (permalink / raw)
To: u-boot
On Fri, Oct 2, 2015 at 6:44 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> Casting from dev->priv to pci_dev_t changes the value's size on a 64-bit
> system. This causes the compiler to complain about casting a pointer to an
> integer of a different (smaller) size. To avoid this, cast to an integer
> of matching size first, then perform an int->int cast to perform the size
> change. This signals explicitly that we do want to change the size, and
> avoids the compiler warning. This is legitimate since we know the pointer
> actually stores a small integer, not a pointer value.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit
2015-10-05 16:45 ` Joe Hershberger
@ 2015-10-21 16:32 ` Stephen Warren
2015-10-21 21:08 ` Joe Hershberger
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2015-10-21 16:32 UTC (permalink / raw)
To: u-boot
On 10/05/2015 10:45 AM, Joe Hershberger wrote:
> On Fri, Oct 2, 2015 at 6:44 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> Casting from dev->priv to pci_dev_t changes the value's size on a 64-bit
>> system. This causes the compiler to complain about casting a pointer to an
>> integer of a different (smaller) size. To avoid this, cast to an integer
>> of matching size first, then perform an int->int cast to perform the size
>> change. This signals explicitly that we do want to change the size, and
>> avoids the compiler warning. This is legitimate since we know the pointer
>> actually stores a small integer, not a pointer value.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe, this patch appears to be assigned to you in patchwork. Will you
apply it now the merge window is open, or are you assuming it will go
through the Tegra tree with all the PCIe patches?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit
2015-10-21 16:32 ` Stephen Warren
@ 2015-10-21 21:08 ` Joe Hershberger
0 siblings, 0 replies; 5+ messages in thread
From: Joe Hershberger @ 2015-10-21 21:08 UTC (permalink / raw)
To: u-boot
Hi Stephen,
On Wed, Oct 21, 2015 at 11:32 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 10/05/2015 10:45 AM, Joe Hershberger wrote:
>>
>> On Fri, Oct 2, 2015 at 6:44 PM, Stephen Warren <swarren@wwwdotorg.org>
>> wrote:
>>>
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> Casting from dev->priv to pci_dev_t changes the value's size on a 64-bit
>>> system. This causes the compiler to complain about casting a pointer to
>>> an
>>> integer of a different (smaller) size. To avoid this, cast to an integer
>>> of matching size first, then perform an int->int cast to perform the size
>>> change. This signals explicitly that we do want to change the size, and
>>> avoids the compiler warning. This is legitimate since we know the pointer
>>> actually stores a small integer, not a pointer value.
>>>
>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>
>>
>> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>
>
> Joe, this patch appears to be assigned to you in patchwork. Will you apply
> it now the merge window is open, or are you assuming it will go through the
> Tegra tree with all the PCIe patches?
I'll pull it in soon.
-Joe
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit
2015-10-02 23:44 [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit Stephen Warren
2015-10-05 16:45 ` Joe Hershberger
@ 2015-10-29 19:32 ` Joe Hershberger
1 sibling, 0 replies; 5+ messages in thread
From: Joe Hershberger @ 2015-10-29 19:32 UTC (permalink / raw)
To: u-boot
On Fri, Oct 2, 2015 at 6:44 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> Casting from dev->priv to pci_dev_t changes the value's size on a 64-bit
> system. This causes the compiler to complain about casting a pointer to an
> integer of a different (smaller) size. To avoid this, cast to an integer
> of matching size first, then perform an int->int cast to perform the size
> change. This signals explicitly that we do want to change the size, and
> avoids the compiler warning. This is legitimate since we know the pointer
> actually stores a small integer, not a pointer value.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
Applied to u-boot-net/master, thanks!
-Joe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-29 19:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-02 23:44 [U-Boot] [PATCH] net: rtl8169: Build warning fixes for 64-bit Stephen Warren
2015-10-05 16:45 ` Joe Hershberger
2015-10-21 16:32 ` Stephen Warren
2015-10-21 21:08 ` Joe Hershberger
2015-10-29 19:32 ` Joe Hershberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox