All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
       [not found] <1431366550-22045-1-git-send-email-xerofoify@gmail.com>
@ 2015-05-12  0:18   ` Kuninori Morimoto
  2015-06-23 23:54   ` Kuninori Morimoto
  1 sibling, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2015-05-12  0:18 UTC (permalink / raw)
  To: Nicholas Krause
  Cc: ulf.hansson, ben.dooks, ykaneko0929, laurent.pinchart+renesas,
	kouichi.tomita.yn, linux-mmc, linux-kernel


Hi

Nicholas Krause wrote:
> 
> 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.
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

# 1 open line is needed between log and Signed-off-by ?

>  drivers/mmc/host/sh_mmcif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 7eff087..e276558 100644
> --- 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;
>  
>  	chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
>  				slave_data, &host->pd->dev,
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
@ 2015-05-12  0:18   ` Kuninori Morimoto
  0 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2015-05-12  0:18 UTC (permalink / raw)
  To: Nicholas Krause
  Cc: ulf.hansson, ben.dooks, ykaneko0929, laurent.pinchart+renesas,
	kouichi.tomita.yn, linux-mmc, linux-kernel


Hi

Nicholas Krause wrote:
> 
> 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.
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

# 1 open line is needed between log and Signed-off-by ?

>  drivers/mmc/host/sh_mmcif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 7eff087..e276558 100644
> --- 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;
>  
>  	chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
>  				slave_data, &host->pd->dev,
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
       [not found] <1431366550-22045-1-git-send-email-xerofoify@gmail.com>
@ 2015-06-23 23:54   ` Kuninori Morimoto
  2015-06-23 23:54   ` Kuninori Morimoto
  1 sibling, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2015-06-23 23:54 UTC (permalink / raw)
  To: ulf.hansson, Nicholas Krause
  Cc: ben.dooks, ykaneko0929, laurent.pinchart+renesas,
	kouichi.tomita.yn, linux-mmc, linux-kernel


Hi Ulf

Can you please teach us about status of this patch ?

> 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.
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/mmc/host/sh_mmcif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 7eff087..e276558 100644
> --- 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;
>  
>  	chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
>  				slave_data, &host->pd->dev,
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
@ 2015-06-23 23:54   ` Kuninori Morimoto
  0 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2015-06-23 23:54 UTC (permalink / raw)
  To: ulf.hansson, Nicholas Krause
  Cc: ben.dooks, ykaneko0929, laurent.pinchart+renesas,
	kouichi.tomita.yn, linux-mmc, linux-kernel


Hi Ulf

Can you please teach us about status of this patch ?

> 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.
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/mmc/host/sh_mmcif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 7eff087..e276558 100644
> --- 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;
>  
>  	chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
>  				slave_data, &host->pd->dev,
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
  2015-06-23 23:54   ` Kuninori Morimoto
  (?)
@ 2015-06-24  0:07   ` Joe Perches
       [not found]     ` <5589F6D8.5090107@gmail.com>
  -1 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2015-06-24  0:07 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: ulf.hansson, Nicholas Krause, ben.dooks, ykaneko0929,
	laurent.pinchart+renesas, kouichi.tomita.yn, linux-mmc,
	linux-kernel

On Wed, 2015-06-24 at 08:54 +0900, Kuninori Morimoto wrote:
> Can you please teach us about status of this patch ?
> > 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>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
       [not found]     ` <5589F6D8.5090107@gmail.com>
@ 2015-06-24  0:24         ` Kuninori Morimoto
  0 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2015-06-24  0:24 UTC (permalink / raw)
  To: nick
  Cc: Joe Perches, ulf.hansson, ben.dooks, ykaneko0929,
	laurent.pinchart+renesas, kouichi.tomita.yn, linux-mmc,
	linux-kernel


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
@ 2015-06-24  0:24         ` Kuninori Morimoto
  0 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2015-06-24  0:24 UTC (permalink / raw)
  To: nick
  Cc: Joe Perches, ulf.hansson, ben.dooks, ykaneko0929,
	laurent.pinchart+renesas, kouichi.tomita.yn, linux-mmc,
	linux-kernel


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
  2015-06-24  0:24         ` Kuninori Morimoto
  (?)
@ 2015-06-24  0:40         ` Joe Perches
       [not found]           ` <5589FD65.7040807@gmail.com>
  -1 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2015-06-24  0:40 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: nick, ulf.hansson, ben.dooks, ykaneko0929,
	laurent.pinchart+renesas, kouichi.tomita.yn, linux-mmc,
	linux-kernel

On Wed, 2015-06-24 at 00:24 +0000, Kuninori Morimoto wrote:
> 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

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.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
       [not found]           ` <5589FD65.7040807@gmail.com>
@ 2015-06-24  0:54             ` Joe Perches
  2015-06-24  7:16               ` Arnd Bergmann
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2015-06-24  0:54 UTC (permalink / raw)
  To: nick
  Cc: Kuninori Morimoto, ulf.hansson, ben.dooks, ykaneko0929,
	laurent.pinchart+renesas, linux-mmc, linux-kernel

On Tue, 2015-06-23 at 20:44 -0400, nick wrote:
> 
> On 2015-06-23 08:40 PM, Joe Perches wrote:
> > On Wed, 2015-06-24 at 00:24 +0000, Kuninori Morimoto wrote:
> >> 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
> > 
> > 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.
> > 
> > 
> 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.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
  2015-06-24  0:54             ` Joe Perches
@ 2015-06-24  7:16               ` Arnd Bergmann
       [not found]                 ` <55953D85.3000507@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Arnd Bergmann @ 2015-06-24  7:16 UTC (permalink / raw)
  To: Joe Perches
  Cc: nick, Kuninori Morimoto, ulf.hansson, ben.dooks, ykaneko0929,
	laurent.pinchart+renesas, linux-mmc, linux-kernel

On Tuesday 23 June 2015 17:54:33 Joe Perches wrote:
> On Tue, 2015-06-23 at 20:44 -0400, nick wrote:
> > On 2015-06-23 08:40 PM, Joe Perches wrote:
> > > On Wed, 2015-06-24 at 00:24 +0000, Kuninori Morimoto wrote:
> > >>>>
> > >>>> 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
> > > 
> > > 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.
> > > 
> > > 
> > 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.
> 
> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
       [not found]                 ` <55953D85.3000507@gmail.com>
@ 2015-07-20 14:21                   ` Ulf Hansson
       [not found]                     ` <55AD07E6.1060209@gmail.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Ulf Hansson @ 2015-07-20 14:21 UTC (permalink / raw)
  To: nick
  Cc: Arnd Bergmann, Joe Perches, Kuninori Morimoto, Ben Dooks,
	Yoshihiro Kaneko, Laurent Pinchart, linux-mmc, linux-kernel

On 2 July 2015 at 15:32, nick <xerofoify@gmail.com> wrote:
>
>
> On 2015-06-24 03:16 AM, Arnd Bergmann wrote:
>> On Tuesday 23 June 2015 17:54:33 Joe Perches wrote:
>>> On Tue, 2015-06-23 at 20:44 -0400, nick wrote:
>>>> On 2015-06-23 08:40 PM, Joe Perches wrote:
>>>>> On Wed, 2015-06-24 at 00:24 +0000, Kuninori Morimoto wrote:
>>>>>>>>
>>>>>>>> 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
>>>>>
>>>>> 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.
>>>>>
>>>>>
>>>> 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.
>>>
>>> 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
>>
> 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,
> Nick
> P.S. Sorry for the late reply been very busy.

Let's follow Arnd's suggestion!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one
       [not found]                     ` <55AD07E6.1060209@gmail.com>
@ 2015-07-21  7:41                       ` Ulf Hansson
  0 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2015-07-21  7:41 UTC (permalink / raw)
  To: nick
  Cc: Arnd Bergmann, Joe Perches, Kuninori Morimoto, Ben Dooks,
	Yoshihiro Kaneko, Laurent Pinchart, linux-mmc, linux-kernel

[...]

>>
>> Let's follow Arnd's suggestion!
>>
>> Kind regards
>> Uffe
>>
> Uffe,
> I also have this patch lying around and wasn't able to get a reply on it.
> From 0c2cd9c7faecf70a5468659845e3561c4ceb4069 Mon Sep 17 00:00:00 2001
> From: Nicholas Krause <xerofoify@gmail.com>
> Date: Thu, 2 Jul 2015 21:08:18 -0400
> Subject: [PATCH] mmc:Fix refcount leak in the function mmc_queue_resume for the semaphone thread_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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-21  7:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1431366550-22045-1-git-send-email-xerofoify@gmail.com>
2015-05-12  0:18 ` [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one Kuninori Morimoto
2015-05-12  0:18   ` Kuninori Morimoto
2015-06-23 23:54 ` Kuninori Morimoto
2015-06-23 23:54   ` Kuninori Morimoto
2015-06-24  0:07   ` Joe Perches
     [not found]     ` <5589F6D8.5090107@gmail.com>
2015-06-24  0:24       ` Kuninori Morimoto
2015-06-24  0:24         ` Kuninori Morimoto
2015-06-24  0:40         ` Joe Perches
     [not found]           ` <5589FD65.7040807@gmail.com>
2015-06-24  0:54             ` Joe Perches
2015-06-24  7:16               ` Arnd Bergmann
     [not found]                 ` <55953D85.3000507@gmail.com>
2015-07-20 14:21                   ` Ulf Hansson
     [not found]                     ` <55AD07E6.1060209@gmail.com>
2015-07-21  7:41                       ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.