Help with compiler warning

Previous thread: Re: HPET regression in 2.6.26 versus 2.6.25 -- found another user with the same regression by David Witbrodt on Thursday, August 21, 2008 - 6:24 pm. (1 message)

Next thread: loaded router, excessive getnstimeofday in oprofile by Denys Fedoryshchenko on Thursday, August 21, 2008 - 6:57 pm. (69 messages)
From: Larry Finger
Date: Thursday, August 21, 2008 - 6:36 pm

In drivers/pcmcia/cardbus.c, the following statement

         memcpy_fromio(ptr, s->cb_cis_virt + addr, len);

generates the warning

   CC [M]  drivers/pcmcia/cardbus.o
include/asm/io_32.h: In function ‘memcpy_fromio’:
include/asm/io_32.h:151: warning: passing argument 2 of ‘__memcpy’ 
discards qualifiers from pointer target type

s->cb_cis_virt is "void __iomem" and addr is uint.

What cast does argument 2 need to silence the warning?

Thanks,

Larry
--

From: Benny Halevy
Date: Sunday, August 24, 2008 - 8:29 am

memcpy_fromio takes a (const volatile void __iomem *) for the 
src address.


--

From: Benny Halevy
Date: Sunday, August 24, 2008 - 8:31 am

From: Larry Finger
Date: Sunday, August 24, 2008 - 8:50 am

Changing it to

memcpy_fromio(ptr, (const volatile void __iomem *)(s->cb_cis_virt + 
addr), len);

memcpy_fromio(ptr, (const volatile void __iomem *)s->cb_cis_virt + 
addr, len);

memcpy_fromio(ptr, (volatile void __iomem *)(s->cb_cis_virt + addr), len);

or

memcpy_fromio(ptr, (volatile void __iomem *)s->cb_cis_virt + addr, len);

makes no difference.

Thanks,

Larry
--

From: Andreas Schwab
Date: Sunday, August 24, 2008 - 9:32 am

The cast needs to be in memcpy_fromio, but there is already one, so why
do you get a warning in the first place?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--

Previous thread: Re: HPET regression in 2.6.26 versus 2.6.25 -- found another user with the same regression by David Witbrodt on Thursday, August 21, 2008 - 6:24 pm. (1 message)

Next thread: loaded router, excessive getnstimeofday in oprofile by Denys Fedoryshchenko on Thursday, August 21, 2008 - 6:57 pm. (69 messages)