[PATCH] mtd: nand: pxa3xx: fix build on ARM64

Brian Norris computersforpeace at gmail.com
Fri Feb 6 10:43:47 PST 2015


On Fri, Feb 06, 2015 at 03:32:26PM -0300, Ezequiel Garcia wrote:
> On 02/03/2015 08:06 PM, Rob Herring wrote:
> [..]
> > @@ -1580,7 +1580,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
> >  	info->pdev = pdev;
> >  	info->variant = pxa3xx_nand_get_variant(pdev);
> >  	for (cs = 0; cs < pdata->num_cs; cs++) {
> > -		mtd = (struct mtd_info *)((unsigned int)&info[1] +
> > +		mtd = (struct mtd_info *)((void *)&info[1] +
> >  		      (sizeof(*mtd) + sizeof(*host)) * cs);
> >  		chip = (struct nand_chip *)(&mtd[1]);
> >  		host = (struct pxa3xx_nand_host *)chip;
> > 
> 
> Those casts are an eyesore to me.

I suppose the (struct mtd_info *) cast is unecessary now, since the
(void *) will be implicitly casted just fine. But I'm not sure if it's
worth dropping it.

> Is this change related to the patch?

I believe the (void *) cast is a necessary change because
sizeof(pointer) != sizeof(unsigned int) on a 64-bit arch, so the
(unsigned int) cast would (rightly) generate a warning about the unsafe
cast. You're losing the top 32 bits.

Brian



More information about the linux-mtd mailing list