[U-Boot] [PATCH 2/2] e1000: fix PCI memory addressing

Timur Tabi timur at freescale.com
Mon Aug 24 17:30:17 CEST 2009


On Sat, Aug 22, 2009 at 8:17 AM, Wolfgang Denk<wd at denx.de> wrote:

>> #define virt_to_bus(devno, v) pci_virt_to_mem(devno, (void *) (v))
>
> Also, I have to admit that I really dislike such casts as they just
> suppress compiler warnings which are usually valuable - I'd rather
> see you fixing the original problem (i. e. the type
> incompatibilities).

The cast is there because it doesn't matter if the passed-in pointer
is volatile or not, but the compiler complains anyway.  Although
apparently, it complains even with the cast.  I don't know what to do
about that, other than to modify struct eth_device so that the 'send'
function doesn't take a virtual pointer (which it probably shouldn't
anyway).

> I would not go so far to say it is ignoring it. Let's say this cast
> is insufficient (or simply the wrong approach) to silence the compiler.

Well, since I can't reproduce the problem, how can I know if I've
fixed it?  I just can't see what's wrong with the code.  My only
suggestion is to do this:

	u64 temp;

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


That should eliminate the inefficient macro expansion, but it won't
fix the warning.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the U-Boot mailing list