lkml.org 
[lkml]   [2015]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [GIT PULL] x86 fixes
From
Ugh, I pulled, but:

On Wed, May 6, 2015 at 5:58 AM, Ingo Molnar <mingo2.kernel.org@gmail.com> wrote:
>
> Ingo Molnar (1):
> x86/mm: Clean up types in xlate_dev_mem_ptr()
>
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index fdf617c00e2f..4bf037b20f47 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -332,18 +332,20 @@ EXPORT_SYMBOL(iounmap);
> */
> void *xlate_dev_mem_ptr(phys_addr_t phys)
> {
> + unsigned long start = phys & PAGE_MASK;
> + unsigned long offset = phys & ~PAGE_MASK;
> + unsigned long vaddr;

That "unsigned long vaddr" is just stupid and not a cleanup.

It causes two pointless casts:

> + vaddr = (unsigned long)ioremap_cache(start, PAGE_SIZE);
> + /* Only add the offset on success and return NULL if the ioremap() failed: */
> + if (vaddr)
> + vaddr += offset;
>
> + return (void *)vaddr;

neither of which is helpful in the least. And the "vaddr += offset"
would work equally well in "void *", gcc is perfectly happy to treat
"void *" arithmetic as byte offsets, it's both documented and already
extensively used in the kernel.

So the cleanup to use "start/offset" is a good cleanup, but you should
have kept "addr" as a pointer.

Linus


\
 
 \ /
  Last update: 2015-05-06 20:41    [W:0.078 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site