mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
Kuninori Morimoto
Acked-byHi
Quoted 6 lines · Nicholas Krause
This adds a cast to the variables,slave_id_rx and
slave_id_rxtouintptr_tbefore casting to void* in order to avoid build warning on 64bit platforms for the function,sh_mmcif_request_dma_one.Signed-off-by Nicholas Krause <[email protected]>---
# 1 open line is needed between log and Signed-off-by ?
Quoted 21 lines
drivers/mmc/host/sh_mmcif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mmc/host/sh_mmcif.c +2
-2@@ -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; chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, slave_data, &host->pd->dev,Signature · 1 line
2.1.4
Hi Ulf
Can you please teach us about status of this patch ?
Quoted 26 lines
This adds a cast to the variables,slave_id_rx and
slave_id_rxtouintptr_tbefore casting to void* in order to avoid build warning on 64bit platforms for the function,sh_mmcif_request_dma_one.Signed-off-by Nicholas Krause <[email protected]>--- drivers/mmc/host/sh_mmcif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mmc/host/sh_mmcif.c +2
-2@@ -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; chan = dma_request_slave_channel_compat(mask, shdma_chan_filter, slave_data, &host->pd->dev,Signature · 1 line
2.1.4
Quoted 4 lines · Kuninori Morimoto
Can you please teach us about status of this patch ?
Quoted 3 lines
This adds a cast to the variables,slave_id_rx and
slave_id_rxtouintptr_tbefore casting to void* in order to avoid build warning on 64bit platforms for the function,sh_mmcif_request_dma_one.
[]
Quoted 1 line
drivers/mmc/host/sh_mmcif.c
Quoted 1 line
drivers/mmc/host/sh_mmcif.c +0
-0
[]
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c sh_mmcif_request_dma_one(struct sh_mmcif_host *host, · line 402
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c +2
-2@@ -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>
Hi Joe, Nick
Quoted 20 lines
Quoted 16 lines
Quoted 3 lines
Quoted 3 lines
This adds a cast to the variables,slave_id_rx and
slave_id_rxtouintptr_tbefore casting to void* in order to avoid build warning on 64bit platforms for the function,sh_mmcif_request_dma_one.[]
Quoted 1 line
drivers/mmc/host/sh_mmcif.c
Quoted 1 line
drivers/mmc/host/sh_mmcif.c +0
-0[]
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c sh_mmcif_request_dma_one(struct sh_mmcif_host *host, · line 402
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c +2
-2@@ -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
Quoted 4 lines
(<type> *)(unsigned long)<foo> than (<type> *)(uintptr_t)<foo>
Quoted 5 lines
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 useuintpr_tinstead 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
Quoted 22 lines · Kuninori Morimoto
Hi Joe, Nick
Quoted 20 lines
Quoted 20 lines
Quoted 3 lines
Quoted 3 lines
This adds a cast to the variables,slave_id_rx and
slave_id_rxtouintptr_tbefore casting to void* in order to avoid build warning on 64bit platforms for the function,sh_mmcif_request_dma_one.[]
Quoted 1 line
drivers/mmc/host/sh_mmcif.c
Quoted 1 line
drivers/mmc/host/sh_mmcif.c +0
-0[]
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c sh_mmcif_request_dma_one(struct sh_mmcif_host *host, · line 402
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c +2
-2@@ -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>
Quoted 8 lines
Quoted 5 lines
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 useuintpr_tinstead 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
uintptr_t was introduced to avoid ptrdiff_t misuse in commit 142956af5250 ("fix abuses of ptrdiff_t") by Al Viro.
unsigned long is preponderant, long is used about 1/4 as often as unsigned long, uintptr_t is relatively uncommon.
If someone wants to go and convert the 800 or so casts to long or unsigned long to uintptr_t so that's the style most frequently used, that'd be different. I'm not going to submit any patches for that.
Quoted 40 lines · nick
Quoted 38 lines · Joe Perches
Quoted 22 lines · Kuninori Morimoto
Hi Joe, Nick
Quoted 20 lines
Quoted 20 lines
Quoted 3 lines
Quoted 3 lines
This adds a cast to the variables,slave_id_rx and
slave_id_rxtouintptr_tbefore casting to void* in order to avoid build warning on 64bit platforms for the function,sh_mmcif_request_dma_one.[]
Quoted 1 line
drivers/mmc/host/sh_mmcif.c
Quoted 1 line
drivers/mmc/host/sh_mmcif.c +0
-0[]
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c sh_mmcif_request_dma_one(struct sh_mmcif_host *host, · line 402
Quoted 8 lines
drivers/mmc/host/sh_mmcif.c +2
-2@@ -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>Quoted 8 lines
Quoted 5 lines
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 useuintpr_tinstead 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
uintptr_twas introduced to avoidptrdiff_tmisuse in commit142956af5250("fix abuses ofptrdiff_t") by Al Viro.unsigned long is preponderant, long is used about 1/4 as often as unsigned long,
uintptr_tis relatively uncommon.
Quoted 8 lines
Quoted 6 lines
If someone wants to go and convert the 800 or so casts to long or unsigned long to
uintptr_tso that's the style most frequently used, that'd be different. I'm not going to submit any patches for that.I am not disagreeing it was just easier to listen to the maintainer rather then get in a technical argument over which type is better for the cast.
Ulf Hansson is the maintainer.
Laurent has authored a couple patches to that file and he gave you his opinion about using uintptr_t.
I'm giving an opinion too, just with a little statistics.
I think it's better to use the style that the kernel generally uses.
I'll stop replying now.
Quoted 36 lines · On Tuesday 23 June 2015 17:54:33 Joe Perches wrote:
Quoted 23 lines · nick
Quoted 22 lines · Joe Perches
Quoted 6 lines · Kuninori Morimoto
Quoted 6 lines
Quoted 6 lines
It's far more common (~10:1) in the kernel to cast using
(<type> *)(unsigned long)<foo>
than
(<type> *)(uintptr_t)<foo>Quoted 8 lines
Quoted 5 lines
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 useuintpr_tinstead 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
uintptr_twas introduced to avoidptrdiff_tmisuse in commit142956af5250("fix abuses ofptrdiff_t") by Al Viro.unsigned long is preponderant, long is used about 1/4 as often as unsigned long,
uintptr_tis relatively uncommon.Quoted 8 lines
Quoted 6 lines
If someone wants to go and convert the 800 or so casts to long or unsigned long to
uintptr_tso that's the style most frequently used, that'd be different. I'm not going to submit any patches for that.I am not disagreeing it was just easier to listen to the maintainer rather then get in a technical argument over which type is better for the cast.
Laurent has authored a couple patches to that file and he gave you his opinion about using
uintptr_t.
Quoted 6 lines
I'm giving an opinion too, just with a little statistics.
I think it's better to use the style that the kernel generally uses.
I'll stop replying now.
Instead of debating the type of cast that is used here, it would be nicer to do a patch that avoids the cast in the driver entirely, by changing the pdata to contain a void* type from the start, and to pass the shdma_chan_filter function pointer along with it from platform code.
That would make the sh_mmcif driver independent of the underlying dma driver.
Arnd
Quoted 57 lines · nick
Quoted 49 lines · Arnd Bergmann
Quoted 36 lines · On Tuesday 23 June 2015 17:54:33 Joe Perches wrote:
Quoted 23 lines · nick
Quoted 22 lines · Joe Perches
Quoted 6 lines · Kuninori Morimoto
Quoted 6 lines
Quoted 6 lines
It's far more common (~10:1) in the kernel to cast using
(<type> *)(unsigned long)<foo>
than
(<type> *)(uintptr_t)<foo>Quoted 8 lines
Quoted 5 lines
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 useuintpr_tinstead 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
uintptr_twas introduced to avoidptrdiff_tmisuse in commit142956af5250("fix abuses ofptrdiff_t") by Al Viro.unsigned long is preponderant, long is used about 1/4 as often as unsigned long,
uintptr_tis relatively uncommon.Quoted 8 lines
Quoted 6 lines
If someone wants to go and convert the 800 or so casts to long or unsigned long to
uintptr_tso that's the style most frequently used, that'd be different. I'm not going to submit any patches for that.I am not disagreeing it was just easier to listen to the maintainer rather then get in a technical argument over which type is better for the cast.
Laurent has authored a couple patches to that file and he gave you his opinion about using
uintptr_t.Quoted 6 lines
I'm giving an opinion too, just with a little statistics.
I think it's better to use the style that the kernel generally uses.
I'll stop replying now.
Instead of debating the type of cast that is used here, it would be nicer to do a patch that avoids the cast in the driver entirely, by changing the pdata to contain a void* type from the start, and to pass the
shdma_chan_filterfunction pointer along with it from platform code.Quoted 5 lines
That would make the
sh_mmcifdriver independent of the underlying dma driver.Arnd
Quoted 7 lines
Arnd,
I would have to agree with you but would like the other people in this discussion to agree before I rewrite this function and pdata structure to do this. Otherwise this patch will be the current solution for this.
Cheers,
NickP.S. Sorry for the late reply been very busy.
Let's follow Arnd's suggestion!
Kind regards
Uffe
[...]
Quoted 6 lines
Quoted 6 lines
Let's follow Arnd's suggestion!
Kind regards
Uffe
Quoted 7 lines
Uffe,
I also have this patch lying around and wasn't able to get a reply on it.
From0c2cd9c7faecf70a5468659845e3561c4ceb4069Mon Sep 17 00:00:00 2001
From: Nicholas Krause <[email protected]>
Date: Thu, 2 Jul 2015 21:08:18 -0400
Subject: [PATCH] mmc:Fix refcount leak in the functionmmc_queue_resumefor the semaphonethread_sem
I am working through my backlog, been out of office for a while. I will come to it soon, sorry for the delay.
Kind regards
Uffe