Skip to contentSkip to conversation

signal: clean up codestyle

PATCH In review Miaohe Lin 3 participants 4 messages Sep 1, 2020

lore
Share & tools
lore

Miaohe Lin

author
#0 lore raw

PATCH 1/1 signal: clean up codestyle

No functional change intended.

---
 kernel/signal.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/signal.c +4 -4
index a38b3edc6851..10a31fafc35b 100644
@@ -1115,8 +1115,8 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
 	q = __sigqueue_alloc(sig, t, GFP_ATOMIC, override_rlimit);
 	if (q) {
 		list_add_tail(&q->list, &pending->list);
-		switch ((unsigned long) info) {
-		case (unsigned long) SEND_SIG_NOINFO:
+		switch ((unsigned long)info) {
+		case (unsigned long)SEND_SIG_NOINFO:
 			clear_siginfo(&q->info);
 			q->info.si_signo = sig;
 			q->info.si_errno = 0;
@@ -1129,7 +1129,7 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
 						 current_uid());
 			rcu_read_unlock();
 			break;
-		case (unsigned long) SEND_SIG_PRIV:
+		case (unsigned long)SEND_SIG_PRIV:
 			clear_siginfo(&q->info);
 			q->info.si_signo = sig;
 			q->info.si_errno = 0;
@@ -1314,7 +1314,7 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t)
 	int sig = info->si_signo;
 
 	spin_lock_irqsave(&t->sighand->siglock, flags);
-	action = &t->sighand->action[sig-1];
+	action = &t->sighand->action[sig - 1];
 	ignored = action->sa.sa_handler == SIG_IGN;
 	blocked = sigismember(&t->blocked, sig);
 	if (blocked || ignored) {
Signature · 1 line
2.19.1
#1 lore raw
Quoted 1 line · Miaohe Lin

No functional change intended.

Hey Miaohe,

Thank you for the patch.
I'm sure this is well-intended but afaict the whole file has more or less a consistent style already where e.g. sig-1 without spaces seems to be preferred. The same for the casts where most places use a single space.

Now, I know CodingStyle.rst is on your side at least when it comes to the first point:

Use one space around (on each side of) most binary and ternary operators, such as any of these::

	=  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=  ?  :

but then you'd need to change each place in kernel/signal.c where that is currently not the case. Otherwise we end up with a weird mix.

Thanks!
Christian

Quoted 42 lines
---
 kernel/signal.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/signal.c +4 -4
index a38b3edc6851..10a31fafc35b 100644
@@ -1115,8 +1115,8 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
 	q = __sigqueue_alloc(sig, t, GFP_ATOMIC, override_rlimit);
 	if (q) {
 		list_add_tail(&q->list, &pending->list);
-		switch ((unsigned long) info) {
-		case (unsigned long) SEND_SIG_NOINFO:
+		switch ((unsigned long)info) {
+		case (unsigned long)SEND_SIG_NOINFO:
 			clear_siginfo(&q->info);
 			q->info.si_signo = sig;
 			q->info.si_errno = 0;
@@ -1129,7 +1129,7 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
 						 current_uid());
 			rcu_read_unlock();
 			break;
-		case (unsigned long) SEND_SIG_PRIV:
+		case (unsigned long)SEND_SIG_PRIV:
 			clear_siginfo(&q->info);
 			q->info.si_signo = sig;
 			q->info.si_errno = 0;
@@ -1314,7 +1314,7 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t)
 	int sig = info->si_signo;
 
 	spin_lock_irqsave(&t->sighand->siglock, flags);
-	action = &t->sighand->action[sig-1];
+	action = &t->sighand->action[sig - 1];
 	ignored = action->sa.sa_handler == SIG_IGN;
 	blocked = sigismember(&t->blocked, sig);
 	if (blocked || ignored) {
Signature · 1 line
2.19.1
#2 lore raw
Quoted 15 lines · Christian Brauner
Quoted 1 line · Miaohe Lin

No functional change intended.

Hey Miaohe,

Thank you for the patch.
I'm sure this is well-intended but afaict the whole file has more or less a consistent style already where e.g. sig-1 without spaces seems to be preferred. The same for the casts where most places use a single space.

Now, I know CodingStyle.rst is on your side at least when it comes to the first point:

Quoted 7 lines

Use one space around (on each side of) most binary and ternary operators, such as any of these::

	=  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=  ?  :

but then you'd need to change each place in kernel/signal.c where that is currently not the case.

Or simply leave this code alone ;)

To be honest I do not like the very idea of enforce-coding-style patches, coding style is very personal and even this trivial (but imho pointless) change can complicate the backporting of some bugfix. I hit this problem quite often.

Oleg.

#3 lore raw
Quoted 19 lines · Oleg Nesterov
Quoted 18 lines · Christian Brauner
Quoted 1 line · Miaohe Lin

No functional change intended.

Hey Miaohe,

Thank you for the patch.
I'm sure this is well-intended but afaict the whole file has more or less a consistent style already where e.g. sig-1 without spaces seems to be preferred. The same for the casts where most places use a single space.

Now, I know CodingStyle.rst is on your side at least when it comes to the first point:

Use one space around (on each side of) most binary and ternary operators, such as any of these::

Quoted 6 lines
Quoted 4 lines
	=  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=  ?  :

but then you'd need to change each place in kernel/signal.c where that is currently not the case.

Or simply leave this code alone ;)

I was trying to imply that by pointing out that this would be file-global change. I was likely too subtle. ;)

Christian