* [PATCH] kernel/cpu.c: fix many errors related to style.
@ 2017-05-06 15:09 Matej Dujava
2017-05-06 15:27 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Matej Dujava @ 2017-05-06 15:09 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: linux-kernel
This patch fixes the checkpatch.pl warning:
ERROR: spaces required around that '=' (ctx:VxW)
WARNING: Block comments use a trailing */ on a separate line
CHECK: Please don't use multiple blank lines
CHECK: Blank lines aren't necessary before a close brace '}'
CHECK: braces {} should be used on all arms of this statement
CHECK: Blank lines aren't necessary after an open brace '{'
Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
---
kernel/cpu.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 9ae6fbe5b5cf..ef3da68f2055 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -234,7 +234,6 @@ static struct {
#define cpuhp_lock_acquire() lock_map_acquire(&cpu_hotplug.dep_map)
#define cpuhp_lock_release() lock_map_release(&cpu_hotplug.dep_map)
-
void get_online_cpus(void)
{
might_sleep();
@@ -262,7 +261,6 @@ void put_online_cpus(void)
wake_up(&cpu_hotplug.wq);
cpuhp_lock_release();
-
}
EXPORT_SYMBOL_GPL(put_online_cpus);
@@ -1004,9 +1002,9 @@ int freeze_secondary_cpus(int primary)
trace_suspend_resume(TPS("CPU_OFF"), cpu, true);
error = _cpu_down(cpu, 1, CPUHP_OFFLINE);
trace_suspend_resume(TPS("CPU_OFF"), cpu, false);
- if (!error)
+ if (!error) {
cpumask_set_cpu(cpu, frozen_cpus);
- else {
+ } else {
pr_err("Error taking CPU%d down: %d\n", cpu, error);
break;
}
@@ -1110,7 +1108,6 @@ cpu_hotplug_pm_callback(struct notifier_block *nb,
return NOTIFY_OK;
}
-
static int __init cpu_hotplug_pm_sync_init(void)
{
/*
@@ -1137,7 +1134,7 @@ static struct cpuhp_step cpuhp_bp_states[] = {
.teardown.single = NULL,
},
#ifdef CONFIG_SMP
- [CPUHP_CREATE_THREADS]= {
+ [CPUHP_CREATE_THREADS] = {
.name = "threads:prepare",
.startup.single = smpboot_create_threads,
.teardown.single = NULL,
@@ -1241,8 +1238,10 @@ static struct cpuhp_step cpuhp_ap_states[] = {
.startup.single = NULL,
.teardown.single = rcutree_dying_cpu,
},
- /* Entry state on starting. Interrupts enabled from here on. Transient
- * state for synchronsization */
+ /*
+ * Entry state on starting. Interrupts enabled from here on. Transient
+ * state for synchronsization
+ */
[CPUHP_AP_ONLINE] = {
.name = "ap:online",
},
--
2.12.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/cpu.c: fix many errors related to style.
2017-05-06 15:09 [PATCH] kernel/cpu.c: fix many errors related to style Matej Dujava
@ 2017-05-06 15:27 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2017-05-06 15:27 UTC (permalink / raw)
To: Matej Dujava, Thomas Gleixner; +Cc: linux-kernel
On Sat, 2017-05-06 at 17:09 +0200, Matej Dujava wrote:
> This patch fixes the checkpatch.pl warning:
> ERROR: spaces required around that '=' (ctx:VxW)
> WARNING: Block comments use a trailing */ on a separate line
> CHECK: Please don't use multiple blank lines
> CHECK: Blank lines aren't necessary before a close brace '}'
> CHECK: braces {} should be used on all arms of this statement
> CHECK: Blank lines aren't necessary after an open brace '{'
[]
> diff --git a/kernel/cpu.c b/kernel/cpu.c
Please don't modify core kernel files just to shut-up checkpatch
messages. If you are doing rework, it makes some sense, otherwise
it doesn't add much value.
> - /* Entry state on starting. Interrupts enabled from here on. Transient
> - * state for synchronsization */
> + /*
> + * Entry state on starting. Interrupts enabled from here on. Transient
> + * state for synchronsization
Fixing typos would be nicer than merely reformatting comments.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/cpu.c: Fix many errors related to style.
2011-01-29 20:19 [PATCH] kernel/cpu.c: Fix " Michael Rodriguez
@ 2011-01-29 21:32 ` Jesper Juhl
0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2011-01-29 21:32 UTC (permalink / raw)
To: Michael Rodriguez; +Cc: mingo, linux-kernel
On Sat, 29 Jan 2011, Michael Rodriguez wrote:
> This patch changes the printk() calls to have the KERN_INFO/KERN_ERROR stuff,
> and fixes other coding style errors. Not _all_ of them are gone, though.
>
> Signed-off-by: Michael Rodriguez <dkingston02@gmail.com>
> ---
> kernel/cpu.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
...
> @@ -201,11 +200,11 @@ static int __ref take_cpu_down(void *_param)
>
> /* Ensure this CPU doesn't handle any more interrupts. */
> err = __cpu_disable();
> +
> if (err < 0)
> return err;
Why? We set 'err', then we test 'err' - why do we need a blank line
between those two? It's not like you are sepperating two logically
different operations from eachother here...
...
> @@ -227,7 +226,9 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
> return -EINVAL;
>
> cpu_hotplug_begin();
> +
> err = __cpu_notify(CPU_DOWN_PREPARE | mod, hcpu, -1, &nr_calls);
> +
> if (err) {
> nr_calls--;
> __cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
Why would we want these extra newlines? What's the point? The opereations
fit nicely together, I don't see the point in adding these extra
newlines..
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] kernel/cpu.c: Fix many errors related to style.
@ 2011-01-29 20:19 Michael Rodriguez
2011-01-29 21:32 ` Jesper Juhl
0 siblings, 1 reply; 4+ messages in thread
From: Michael Rodriguez @ 2011-01-29 20:19 UTC (permalink / raw)
To: mingo; +Cc: linux-kernel, Michael Rodriguez
This patch changes the printk() calls to have the KERN_INFO/KERN_ERROR stuff,
and fixes other coding style errors. Not _all_ of them are gone, though.
Signed-off-by: Michael Rodriguez <dkingston02@gmail.com>
---
kernel/cpu.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 156cc55..d1851a7 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -160,7 +160,6 @@ static void cpu_notify_nofail(unsigned long val, void *v)
{
BUG_ON(cpu_notify(val, v));
}
-
EXPORT_SYMBOL(register_cpu_notifier);
void __ref unregister_cpu_notifier(struct notifier_block *nb)
@@ -201,11 +200,11 @@ static int __ref take_cpu_down(void *_param)
/* Ensure this CPU doesn't handle any more interrupts. */
err = __cpu_disable();
+
if (err < 0)
return err;
cpu_notify(CPU_DYING | param->mod, param->hcpu);
-
return 0;
}
@@ -227,7 +226,9 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
return -EINVAL;
cpu_hotplug_begin();
+
err = __cpu_notify(CPU_DOWN_PREPARE | mod, hcpu, -1, &nr_calls);
+
if (err) {
nr_calls--;
__cpu_notify(CPU_DOWN_FAILED | mod, hcpu, nr_calls, NULL);
@@ -304,7 +305,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls);
if (ret) {
nr_calls--;
- printk("%s: attempt to bring up CPU %u failed\n",
+ printk(KERN_WARNING "%s: attempt to bring up CPU %u failed\n",
__func__, cpu);
goto out_notify;
}
@@ -450,14 +451,14 @@ void __ref enable_nonboot_cpus(void)
if (cpumask_empty(frozen_cpus))
goto out;
- printk("Enabling non-boot CPUs ...\n");
+ printk(KERN_INFO "Enabling non-boot CPUs ...\n");
arch_enable_nonboot_cpus_begin();
for_each_cpu(cpu, frozen_cpus) {
error = _cpu_up(cpu, 1);
if (!error) {
- printk("CPU%d is up\n", cpu);
+ printk(KERN_INFO "CPU%d is up\n", cpu);
continue;
}
printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
@@ -509,7 +510,7 @@ void __cpuinit notify_cpu_starting(unsigned int cpu)
*/
/* cpu_bit_bitmap[0] is empty - so we can back into it */
-#define MASK_DECLARE_1(x) [x+1][0] = 1UL << (x)
+#define MASK_DECLARE_1(x) [x+1][0] = (1UL << (x))
#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1)
#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2)
#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4)
--
1.7.3.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-06 15:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-06 15:09 [PATCH] kernel/cpu.c: fix many errors related to style Matej Dujava
2017-05-06 15:27 ` Joe Perches
-- strict thread matches above, loose matches on Subject: below --
2011-01-29 20:19 [PATCH] kernel/cpu.c: Fix " Michael Rodriguez
2011-01-29 21:32 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).