2009-06-21 11:25:32

by Jaswinder Singh Rajput

[permalink] [raw]
Subject: [PATCH -tip] x86: mm/init_32.c fix style problems


Impact: cleanup

Fix :

WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
ERROR: do not initialise externals to 0 or NULL
ERROR: code indent should use tabs where possible
ERROR: space required after that ',' (ctx:VxV)
ERROR: spaces required around that ':' (ctx:ExV) X 3

total: 6 errors, 1 warning

Signed-off-by: Jaswinder Singh Rajput <[email protected]>
---
arch/x86/mm/init_32.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 3cd7711..64f0ee3 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -30,12 +30,12 @@
#include <linux/memory_hotplug.h>
#include <linux/initrd.h>
#include <linux/cpumask.h>
+#include <linux/uaccess.h>

#include <asm/asm.h>
#include <asm/bios_ebda.h>
#include <asm/processor.h>
#include <asm/system.h>
-#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/dma.h>
#include <asm/fixmap.h>
@@ -56,7 +56,7 @@ unsigned long highstart_pfn, highend_pfn;

static noinline int do_test_wp_bit(void);

-bool __read_mostly __vmalloc_start_set = false;
+bool __read_mostly __vmalloc_start_set;

static __init void *alloc_low_page(void)
{
@@ -215,7 +215,7 @@ page_table_range_init(unsigned long start, unsigned long end, pgd_t *pgd_base)
for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);
pmd++, pmd_idx++) {
pte = page_table_kmap_check(one_page_table_init(pmd),
- pmd, vaddr, pte);
+ pmd, vaddr, pte);

vaddr += PMD_SIZE;
}
@@ -989,12 +989,12 @@ static noinline int do_test_wp_bit(void)
"1: movb %1, %0 \n"
" xorl %2, %2 \n"
"2: \n"
- _ASM_EXTABLE(1b,2b)
- :"=m" (*(char *)fix_to_virt(FIX_WP_TEST)),
+ _ASM_EXTABLE(1b, 2b)
+ : "=m" (*(char *)fix_to_virt(FIX_WP_TEST)),
"=q" (tmp_reg),
"=r" (flag)
- :"2" (1)
- :"memory");
+ : "2" (1)
+ : "memory");

return flag;
}
--
1.6.0.6



2009-06-21 11:35:49

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH -tip] x86: mm/init_32.c fix style problems


* Jaswinder Singh Rajput <[email protected]> wrote:

>
> Impact: cleanup
>
> Fix :
>
> WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
> ERROR: do not initialise externals to 0 or NULL
> ERROR: code indent should use tabs where possible
> ERROR: space required after that ',' (ctx:VxV)
> ERROR: spaces required around that ':' (ctx:ExV) X 3
>
> total: 6 errors, 1 warning
>
> Signed-off-by: Jaswinder Singh Rajput <[email protected]>
> ---
> arch/x86/mm/init_32.c | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)

Just like with hugetlbpage.c, this file too has other problems
beyond trivial style issues:

- one_page_table_init() logic should be restructured to have its
branch condition inverted into a goto out pattern, to get rid of
the ugly linebreaks.

- that ugly check in page_table_kmap_check() should be factored out
into a helper inline

- kernel_physical_mapping_init() is too large and should have its
innards factored out into one or more helper inlines.

- there's too many #idefs obscuring the easy readability of the
code. Could some be eliminated?

Some style issues as well:

- printk(KERN_* should be converted to pr_*(

- the #include files section looks unstructured and ugly. Please
take a look at arch/x86/mm/fault.c and try to eliminate all
unnecessary include lines and follow the format of fault.c.

These (and other issues) should be addressed as well, so that we
have a single act of churn there, followed by a quality end result.

Thanks,

Ingo