Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one

From: Kuninori Morimoto
Date: Tue Jun 23 2015 - 20:24:54 EST



Hi Joe, Nick

> >>> This adds a cast to the variables,slave_id_rx and slave_id_rx
> >>> to uintptr_t before casting to void* in order to avoid build
> >>> warning on 64bit platforms for the function, sh_mmcif_request_dma_one.
> > []
> >>> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> > []
> >>> @@ -398,8 +398,8 @@ sh_mmcif_request_dma_one(struct sh_mmcif_host *host,
> >>>
> >>> if (pdata)
> >>> slave_data = direction == DMA_MEM_TO_DEV ?
> >>> - (void *)pdata->slave_id_tx :
> >>> - (void *)pdata->slave_id_rx;
> >>> + (void *)(uintptr_t)pdata->slave_id_tx :
> >>> + (void *)(uintptr_t)pdata->slave_id_rx;
> >
> > It's far more common (~10:1) in the kernel to cast using
> > (<type> *)(unsigned long)<foo>
> > than
> > (<type> *)(uintptr_t)<foo>
> >
> Joe,
> I agree it's more common in the kernel but one of the maintainers when I sent
> this patch a month ago requested I use uintpr_t instead of unsigned long for
> the casting. Otherwise I would have done the cast to fix the build warning
> with unsigned long instead.

This mail
http://thread.gmane.org/gmane.linux.kernel.mmc/32304


Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/