Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1171000 > unrolled thread
| Started by | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
|---|---|
| First post | 2015-06-24 02:00 +0200 |
| Last post | 2015-06-24 03:00 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> - 2015-06-24 02:00 +0200
Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one Joe Perches <joe@perches.com> - 2015-06-24 02:10 +0200
Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> - 2015-06-24 02:30 +0200
Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one Joe Perches <joe@perches.com> - 2015-06-24 02:50 +0200
Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one Joe Perches <joe@perches.com> - 2015-06-24 03:00 +0200
| From | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
|---|---|
| Date | 2015-06-24 02:00 +0200 |
| Subject | Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one |
| Message-ID | <pEGgG-1bG-7@gated-at.bofh.it> |
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 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-06-24 02:10 +0200 |
| Subject | Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one |
| Message-ID | <pEGqm-1C5-11@gated-at.bofh.it> |
| In reply to | #1171000 |
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> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
|---|---|
| Date | 2015-06-24 02:30 +0200 |
| Message-ID | <pEGJH-1Yh-9@gated-at.bofh.it> |
| In reply to | #1171004 |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-06-24 02:50 +0200 |
| Subject | Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one |
| Message-ID | <pEH33-2kF-3@gated-at.bofh.it> |
| In reply to | #1171012 |
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-06-24 03:00 +0200 |
| Subject | Re: [PATCHv2] mmc:Add pointer cast to uintptr_t for slave_id_rx and tx in the function, sh_mmcif_request_dma_one |
| Message-ID | <pEHcJ-2vM-1@gated-at.bofh.it> |
| In reply to | #1171016 |
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web