Re: [PATCH v4 01/11] mfd: add pruss mfd driver.

From: Marc Kleine-Budde
Date: Wed Apr 27 2011 - 09:35:43 EST


On 04/27/2011 03:18 PM, Subhasish Ghosh wrote:
> My problem is, I am doing something like this:
>
> s32 pruss_writel_multi(struct device *dev, u32 offset,
> u32 *pdatatowrite, u16 wordstowrite)
> {
> struct pruss_priv *pruss = dev_get_drvdata(dev->parent);
> u32 __iomem *paddresstowrite;
> u16 i;
>
> paddresstowrite = pruss->ioaddr + offset;
>
> for (i = 0; i < wordstowrite; i++)
> iowrite32(*pdatatowrite++, paddresstowrite++);
>
> return 0;
> }
>
> So, if I make paddresstowrite as void, it will not work. The above
> implementation does not generate any sparse errors though.

Incrementing a u32 pointer will result in increasing the address by 4
bytes. Incrementing a void pointer will result in increasing the address
by just one byte. (Pointer arithmetic on void * is a gnu extension but
IMHO a pretty nice one, though)

regards, Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |

Attachment: signature.asc
Description: OpenPGP digital signature