2020-02-07 09:54:15

by Zong Li

[permalink] [raw]
Subject: [PATCH 2/2] riscv: adjust the indent

Adjust the indent to match Linux coding style.

Signed-off-by: Zong Li <[email protected]>
---
arch/riscv/mm/kasan_init.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c
index f8eaf7e73a23..ec0ca90dd900 100644
--- a/arch/riscv/mm/kasan_init.c
+++ b/arch/riscv/mm/kasan_init.c
@@ -19,18 +19,20 @@ asmlinkage void __init kasan_early_init(void)
for (i = 0; i < PTRS_PER_PTE; ++i)
set_pte(kasan_early_shadow_pte + i,
mk_pte(virt_to_page(kasan_early_shadow_page),
- PAGE_KERNEL));
+ PAGE_KERNEL));

for (i = 0; i < PTRS_PER_PMD; ++i)
set_pmd(kasan_early_shadow_pmd + i,
- pfn_pmd(PFN_DOWN(__pa((uintptr_t)kasan_early_shadow_pte)),
- __pgprot(_PAGE_TABLE)));
+ pfn_pmd(PFN_DOWN
+ (__pa((uintptr_t) kasan_early_shadow_pte)),
+ __pgprot(_PAGE_TABLE)));

for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END;
i += PGDIR_SIZE, ++pgd)
set_pgd(pgd,
- pfn_pgd(PFN_DOWN(__pa(((uintptr_t)kasan_early_shadow_pmd))),
- __pgprot(_PAGE_TABLE)));
+ pfn_pgd(PFN_DOWN
+ (__pa(((uintptr_t) kasan_early_shadow_pmd))),
+ __pgprot(_PAGE_TABLE)));

/* init for swapper_pg_dir */
pgd = pgd_offset_k(KASAN_SHADOW_START);
@@ -38,8 +40,9 @@ asmlinkage void __init kasan_early_init(void)
for (i = KASAN_SHADOW_START; i < KASAN_SHADOW_END;
i += PGDIR_SIZE, ++pgd)
set_pgd(pgd,
- pfn_pgd(PFN_DOWN(__pa(((uintptr_t)kasan_early_shadow_pmd))),
- __pgprot(_PAGE_TABLE)));
+ pfn_pgd(PFN_DOWN
+ (__pa(((uintptr_t) kasan_early_shadow_pmd))),
+ __pgprot(_PAGE_TABLE)));

flush_tlb_all();
}
@@ -86,7 +89,8 @@ void __init kasan_init(void)
unsigned long i;

kasan_populate_early_shadow((void *)KASAN_SHADOW_START,
- (void *)kasan_mem_to_shadow((void *)VMALLOC_END));
+ (void *)kasan_mem_to_shadow((void *)
+ VMALLOC_END));

for_each_memblock(memory, reg) {
void *start = (void *)__va(reg->base);
@@ -95,14 +99,14 @@ void __init kasan_init(void)
if (start >= end)
break;

- populate(kasan_mem_to_shadow(start),
- kasan_mem_to_shadow(end));
+ populate(kasan_mem_to_shadow(start), kasan_mem_to_shadow(end));
};

for (i = 0; i < PTRS_PER_PTE; i++)
set_pte(&kasan_early_shadow_pte[i],
mk_pte(virt_to_page(kasan_early_shadow_page),
- __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED)));
+ __pgprot(_PAGE_PRESENT | _PAGE_READ |
+ _PAGE_ACCESSED)));

memset(kasan_early_shadow_page, 0, PAGE_SIZE);
init_task.kasan_depth = 0;
--
2.25.0


2020-02-07 11:00:52

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 2/2] riscv: adjust the indent

On Fri, 2020-02-07 at 17:52 +0800, Zong Li wrote:
> Adjust the indent to match Linux coding style.

trivia:

> diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c
[]
> @@ -86,7 +89,8 @@ void __init kasan_init(void)
> unsigned long i;
>
> kasan_populate_early_shadow((void *)KASAN_SHADOW_START,
> - (void *)kasan_mem_to_shadow((void *)VMALLOC_END));
> + (void *)kasan_mem_to_shadow((void *)
> + VMALLOC_END));

could also remove an unnecessary (void *) as kasan_mem_to_shadow
returns a void *

kasan_populate_early_shadow((void *)KASAN_SHADOW_START,
kasan_mem_to_shadow((void *)VMALLOC_END));

2020-02-08 08:46:06

by Zong Li

[permalink] [raw]
Subject: Re: [PATCH 2/2] riscv: adjust the indent

On Fri, Feb 7, 2020 at 6:59 PM Joe Perches <[email protected]> wrote:
>
> On Fri, 2020-02-07 at 17:52 +0800, Zong Li wrote:
> > Adjust the indent to match Linux coding style.
>
> trivia:
>
> > diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c
> []
> > @@ -86,7 +89,8 @@ void __init kasan_init(void)
> > unsigned long i;
> >
> > kasan_populate_early_shadow((void *)KASAN_SHADOW_START,
> > - (void *)kasan_mem_to_shadow((void *)VMALLOC_END));
> > + (void *)kasan_mem_to_shadow((void *)
> > + VMALLOC_END));
>
> could also remove an unnecessary (void *) as kasan_mem_to_shadow
> returns a void *
>
> kasan_populate_early_shadow((void *)KASAN_SHADOW_START,
> kasan_mem_to_shadow((void *)VMALLOC_END));
>

OK, I'll remove it in next version. Thanks.