All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] e1000: fix compile warning
@ 2010-11-22  8:48 Wolfgang Denk
  2010-11-22  9:40 ` Albert ARIBAUD
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-11-22  8:48 UTC (permalink / raw)
  To: u-boot

Get rid of compiler warning:
e1000.c: In function 'e1000_transmit':
e1000.c:5028: warning: passing argument 1 of 'virt_to_phys' discards qualifiers from pointer target type

Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 drivers/net/e1000.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 60b04c2..5f390bd 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5018,6 +5018,7 @@ TRANSMIT - Transmit a frame
 static int
 e1000_transmit(struct eth_device *nic, volatile void *packet, int length)
 {
+	void * nv_packet = (void *)packet;
 	struct e1000_hw *hw = nic->priv;
 	struct e1000_tx_desc *txp;
 	int i = 0;
@@ -5025,7 +5026,7 @@ e1000_transmit(struct eth_device *nic, volatile void *packet, int length)
 	txp = tx_base + tx_tail;
 	tx_tail = (tx_tail + 1) % 8;
 
-	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, packet));
+	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, nv_packet));
 	txp->lower.data = cpu_to_le32(hw->txd_cmd | length);
 	txp->upper.data = 0;
 	E1000_WRITE_REG(hw, TDT, tx_tail);
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] e1000: fix compile warning
  2010-11-22  8:48 [U-Boot] [PATCH] e1000: fix compile warning Wolfgang Denk
@ 2010-11-22  9:40 ` Albert ARIBAUD
  2010-11-22 10:07   ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Albert ARIBAUD @ 2010-11-22  9:40 UTC (permalink / raw)
  To: u-boot

Le 22/11/2010 09:48, Wolfgang Denk a ?crit :

> -	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, packet));
> +	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, nv_packet));

Wouldn't type-casting packet right here work? e.g.:

txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, ((void*)packet)));

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] e1000: fix compile warning
  2010-11-22  9:40 ` Albert ARIBAUD
@ 2010-11-22 10:07   ` Wolfgang Denk
  2010-11-22 11:03     ` Albert ARIBAUD
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-11-22 10:07 UTC (permalink / raw)
  To: u-boot

Dear Albert ARIBAUD,

In message <4CEA3A7B.1070602@free.fr> you wrote:
> Le 22/11/2010 09:48, Wolfgang Denk a ?crit :
> 
> > -	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, packet));
> > +	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, nv_packet));
> 
> Wouldn't type-casting packet right here work? e.g.:
> 
> txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, ((void*)packet)));

No, it doesn't. The virt_to_bus() macro already has such a
cast internally, but it doesn't work here.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Alan Turing thought about criteria to settle the question of  whether
machines  can think, a question of which we now know that it is about
as relevant as the question of whether submarines can swim.
                                                   -- Edsger Dijkstra

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] e1000: fix compile warning
  2010-11-22 10:07   ` Wolfgang Denk
@ 2010-11-22 11:03     ` Albert ARIBAUD
  2010-11-22 12:02       ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Albert ARIBAUD @ 2010-11-22 11:03 UTC (permalink / raw)
  To: u-boot

Le 22/11/2010 11:07, Wolfgang Denk a ?crit :
> Dear Albert ARIBAUD,
>
> In message<4CEA3A7B.1070602@free.fr>  you wrote:
>> Le 22/11/2010 09:48, Wolfgang Denk a ?crit :
>>
>>> -	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, packet));
>>> +	txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, nv_packet));
>>
>> Wouldn't type-casting packet right here work? e.g.:
>>
>> txp->buffer_addr = cpu_to_le64(virt_to_bus(hw->pdev, ((void*)packet)));
>
> No, it doesn't. The virt_to_bus() macro already has such a
> cast internally, but it doesn't work here.
>
> Best regards,
>
> Wolfgang Denk

Hmm, then maybe it is not the type that causes the warning, but a 
qualifier such as 'const' ?

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] e1000: fix compile warning
  2010-11-22 11:03     ` Albert ARIBAUD
@ 2010-11-22 12:02       ` Wolfgang Denk
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2010-11-22 12:02 UTC (permalink / raw)
  To: u-boot

Dear Albert ARIBAUD,

In message <4CEA4E1C.2050607@free.fr> you wrote:
>
> > No, it doesn't. The virt_to_bus() macro already has such a
> > cast internally, but it doesn't work here.
...
> Hmm, then maybe it is not the type that causes the warning, but a 
> qualifier such as 'const' ?

It's the 'volatile' attribute. Hence my name "nv_packet". Using a
non-volatile pointer to compute the virtual address seems to be save.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Research is what I'm doing when I don't know what I'm doing.
                                                 -- Wernher von Braun

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-22 12:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-22  8:48 [U-Boot] [PATCH] e1000: fix compile warning Wolfgang Denk
2010-11-22  9:40 ` Albert ARIBAUD
2010-11-22 10:07   ` Wolfgang Denk
2010-11-22 11:03     ` Albert ARIBAUD
2010-11-22 12:02       ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.