Skip to contentSkip to conversation

mm: Fix Coding style

PATCH In review Choi Gi-yong 2 participants 3 messages Mar 8, 2014 – Mar 9, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: Fix Coding style

---
 mm/percpu.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
mm/percpu.c +5 -6
index 036cfe0..6528ffa 100644
@@ -72,7 +72,7 @@
 #include <asm/cacheflush.h>
 #include <asm/sections.h>
 #include <asm/tlbflush.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 #define PCPU_SLOT_BASE_SHIFT		5	/* 1-31 shares the same slot */
 #define PCPU_DFL_MAP_ALLOC		16	/* start a map with 16 ents */
@@ -715,7 +715,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
 
 	if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
 		WARN(true, "illegal size (%zu) or align (%zu) for "
-		     "percpu allocation\n", size, align);
+				"percpu allocation\n", size, align);
 		return NULL;
 	}
 
@@ -968,8 +968,8 @@ bool is_kernel_percpu_address(unsigned long addr)
 		void *start = per_cpu_ptr(base, cpu);
 
 		if ((void *)addr >= start && (void *)addr < start + static_size)
-			return true;
-        }
+		return true;
+       }
 #endif
 	/* on UP, can't distinguish from other static vars, always false */
 	return false;
@@ -1929,8 +1929,7 @@ void __init setup_per_cpu_areas(void)
  */
 void __init percpu_init_late(void)
 {
-	struct pcpu_chunk *target_chunks[] =
-		{ pcpu_first_chunk, pcpu_reserved_chunk, NULL };
+	struct pcpu_chunk *target_chunks[] = { pcpu_first_chunk, pcpu_reserved_chunk, NULL };
 	struct pcpu_chunk *chunk;
 	unsigned long flags;
 	int i;
Signature · 1 line
1.8.3.2
#1 lore raw

On Sat, 2014-03-08 at 12:46 +0900, Choi Gi-yong wrote:
[]

mm/percpu.c

Quoted 1 line
mm/percpu.c +0 -0

Please run your suggested patches through checkpatch.

mm/percpu.c static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved) · line 718

Quoted 6 lines
mm/percpu.c +1 -1
@@ -715,7 +715,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
 
 	if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
 		WARN(true, "illegal size (%zu) or align (%zu) for "
-		     "percpu allocation\n", size, align);
+				"percpu allocation\n", size, align);

It'd be better to coalesce the format fragments

[]

mm/percpu.c bool is_kernel_percpu_address(unsigned long addr) · line 972

Quoted 8 lines
mm/percpu.c +2 -2
@@ -968,8 +968,8 @@ bool is_kernel_percpu_address(unsigned long addr)
 		void *start = per_cpu_ptr(base, cpu);
 
 		if ((void *)addr >= start && (void *)addr < start + static_size)
-			return true;
-        }
+		return true;
+       }

Not an improvement.
Why do you think it's better?

mm/percpu.c void __init setup_per_cpu_areas(void) · line 1932

Quoted 7 lines
mm/percpu.c +1 -2
@@ -1929,8 +1929,7 @@ void __init setup_per_cpu_areas(void)
  */
 void __init percpu_init_late(void)
 {
-	struct pcpu_chunk *target_chunks[] =
-		{ pcpu_first_chunk, pcpu_reserved_chunk, NULL };
+	struct pcpu_chunk *target_chunks[] = { pcpu_first_chunk, pcpu_reserved_chunk, NULL };

This exceeds 80 columns.

This would be better as:

	struct pcpu_chunk *target_chunks[] = {
		pcpu_first_chunk, pcpu_reserved_chunk, NULL
	};

And perhaps this should be static const

Quoted 3 lines
mm/percpu.c +0 -0
 	struct pcpu_chunk *chunk;
 	unsigned long flags;
 	int i;

A message that is not in the archive (sent off-list or not yet received): CAH4bKb02r2Co08u8nSVOw2eFVCF-5r_bA33B8RGDwW1BLtjoKA@mail.gmail.com

#3 lore raw
Quoted 22 lines

Please run your suggested patches through checkpatch.

(quoted diff) +1 -1
@@ -715,7 +715,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
 
      if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
              WARN(true, "illegal size (%zu) or align (%zu) for "
-                  "percpu allocation\n", size, align);
+                             "percpu allocation\n", size, align);
 

It'd be better to coalesce the format fragments

(quoted diff) +2 -2
@@ -968,8 +968,8 @@ bool is_kernel_percpu_address(unsigned long addr)
              void *start = per_cpu_ptr(base, cpu);
 
              if ((void *)addr >= start && (void *)addr < start + static_size)
-                     return true;
-        }
+             return true;
+       }
 
Quoted 2 lines

Not an improvement.
Why do you think it's better?

I thought it would be better indent when return operation is fit in there. but it wouldn't sorry for my mistake.

Quoted 10 lines

Review void __init setup_per_cpu_areas(void) · line 1933

Quoted 6 lines
(quoted diff) +0 -2
@@ -1929,8 +1929,7 @@ void __init setup_per_cpu_areas(void)
  */
 void __init percpu_init_late(void)
 {
-     struct pcpu_chunk *target_chunks[] =
-             { pcpu_first_chunk, pcpu_reserved_chunk, NULL };

+ struct pcpu_chunk *target_chunks[] = { pcpu_first_chunk, pcpu_reserved_chunk, NULL };

This exceeds 80 columns.

Quoted 7 lines

This would be better as:

     struct pcpu_chunk *target_chunks[] = {
              pcpu_first_chunk, pcpu_reserved_chunk, NULL
     };

And perhaps this should be static const

I couldn't fix 717 line exceed problem.
What can i do?

Sorry for my e-mail was rejected by vger.kernel.org server.

Signature · 4 lines
최     기용
Choi Gi-yong

2014-03-09 16:55 GMT+09:00 최(Choi)기용(Gi-yong) <[email protected]>:
Quoted 59 lines

Please run your suggested patches through checkpatch.

Quoted 22 lines
(quoted diff) +1 -1
@@ -715,7 +715,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t
 align, bool reserved)
 
      if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align >
 PAGE_SIZE)) {
              WARN(true, "illegal size (%zu) or align (%zu) for "
-                  "percpu allocation\n", size, align);
+                             "percpu allocation\n", size, align);
 

It'd be better to coalesce the format fragments

(quoted diff) +2 -2
@@ -968,8 +968,8 @@ bool is_kernel_percpu_address(unsigned long addr)
              void *start = per_cpu_ptr(base, cpu);
 
              if ((void *)addr >= start && (void *)addr < start +
 static_size)
-                     return true;
-        }
+             return true;
+       }
 
Quoted 2 lines

Not an improvement.
Why do you think it's better?

I thought it would be better indent when return operation is fit in there. but it wouldn't sorry for my mistake.

Quoted 11 lines

Review void __init setup_per_cpu_areas(void) · line 1933

Quoted 6 lines
(quoted diff) +0 -2
@@ -1929,8 +1929,7 @@ void __init setup_per_cpu_areas(void)
  */
 void __init percpu_init_late(void)
 {
-     struct pcpu_chunk *target_chunks[] =
-             { pcpu_first_chunk, pcpu_reserved_chunk, NULL };

+ struct pcpu_chunk *target_chunks[] = { pcpu_first_chunk,
pcpu_reserved_chunk, NULL };

This exceeds 80 columns.

Quoted 7 lines

This would be better as:

     struct pcpu_chunk *target_chunks[] = {
              pcpu_first_chunk, pcpu_reserved_chunk, NULL
     };

And perhaps this should be static const

I couldn't fix 717 line exceed problem.
What can i do?

--

최 기용
Choi Gi-yong

Signature · 2 lines
최     기용
Choi Gi-yong

From fa8e74ea69195941841e20d606d480a8ad13f15b Mon Sep 17 00:00:00 2001
From: Choi Gi-yong <[email protected]>
Date: Sun, 9 Mar 2014 16:51:28 +0900
Subject: [PATCH] mm: Fixed coding style and added static const keywords

---
 mm/percpu.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
mm/percpu.c +6 -5
index dca284f..ff6cce2 100644
@@ -714,8 +714,7 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
 	void __percpu *ptr;
 
 	if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
-		WARN(true, "illegal size (%zu) or align (%zu) for "
-				"percpu allocation\n", size, align);
+		WARN(true, "illegal size (%zu) or align (%zu) for percpu allocation\n", size, align);
 		return NULL;
 	}
 
@@ -968,7 +967,7 @@ bool is_kernel_percpu_address(unsigned long addr)
 		void *start = per_cpu_ptr(base, cpu);
 
 		if ((void *)addr >= start && (void *)addr < start + static_size)
-		return true;
+			return true;
        }
 #endif
 	/* on UP, can't distinguish from other static vars, always false */
@@ -1483,7 +1482,7 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(
 	/* group cpus according to their proximity */
 	for_each_possible_cpu(cpu) {
 		group = 0;
-	next_group:
+next_group:
 		for_each_possible_cpu(tcpu) {
 			if (cpu == tcpu)
 				break;
@@ -1929,7 +1928,9 @@ void __init setup_per_cpu_areas(void)
  */
 void __init percpu_init_late(void)
 {
-	struct pcpu_chunk *target_chunks[] = { pcpu_first_chunk, pcpu_reserved_chunk, NULL };
+	static const struct pcpu_chunk *target_chunks[] = {
+		pcpu_first_chunk, pcpu_reserved_chunk, NULL
+	};
 	struct pcpu_chunk *chunk;
 	unsigned long flags;
 	int i;
Signature · 1 line
1.8.3.2