All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel:signal.c Fix coding style errors and warnings.
@ 2014-11-14 15:56 Ionut Alexa
  2014-11-16  2:47 ` Al Viro
  0 siblings, 1 reply; 21+ messages in thread
From: Ionut Alexa @ 2014-11-14 15:56 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Ionut Alexa

    Fix various coding style errors and warnings as:
        - space before tabs
        - exiting a function from different points (else after return
          ..)

Signed-off-by: Ionut Alexa <ionut.m.alexa@gmail.com>
---
 kernel/signal.c |  104 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 55 insertions(+), 49 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 8f0876f..226b41a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -109,25 +109,28 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
 	switch (_NSIG_WORDS) {
 	default:
 		for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;)
-			ready |= signal->sig[i] &~ blocked->sig[i];
+			ready |= signal->sig[i] & ~blocked->sig[i];
 		break;
 
-	case 4: ready  = signal->sig[3] &~ blocked->sig[3];
-		ready |= signal->sig[2] &~ blocked->sig[2];
-		ready |= signal->sig[1] &~ blocked->sig[1];
-		ready |= signal->sig[0] &~ blocked->sig[0];
+	case 4:
+		ready  = signal->sig[3] & ~blocked->sig[3];
+		ready |= signal->sig[2] & ~blocked->sig[2];
+		ready |= signal->sig[1] & ~blocked->sig[1];
+		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 2: ready  = signal->sig[1] &~ blocked->sig[1];
-		ready |= signal->sig[0] &~ blocked->sig[0];
+	case 2:
+		ready  = signal->sig[1] & ~blocked->sig[1];
+		ready |= signal->sig[0] & ~blocked->sig[0];
 		break;
 
-	case 1: ready  = signal->sig[0] &~ blocked->sig[0];
+	case 1:
+		ready  = signal->sig[0] & ~blocked->sig[0];
 	}
 	return ready !=	0;
 }
 
-#define PENDING(p,b) has_pending_signals(&(p)->signal, (b))
+#define PENDING(p, b) has_pending_signals(&(p)->signal, (b))
 
 static int recalc_sigpending_tsk(struct task_struct *t)
 {
@@ -180,7 +183,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 	 * Handle the first word specially: it contains the
 	 * synchronous signals that need to be dequeued first.
 	 */
-	x = *s &~ *m;
+	x = *s & ~*m;
 	if (x) {
 		if (x & SYNCHRONOUS_MASK)
 			x &= SYNCHRONOUS_MASK;
@@ -191,7 +194,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 	switch (_NSIG_WORDS) {
 	default:
 		for (i = 1; i < _NSIG_WORDS; ++i) {
-			x = *++s &~ *++m;
+			x = *++s & ~*++m;
 			if (!x)
 				continue;
 			sig = ffz(~x) + i*_NSIG_BPW + 1;
@@ -200,7 +203,7 @@ int next_signal(struct sigpending *pending, sigset_t *mask)
 		break;
 
 	case 2:
-		x = s[1] &~ m[1];
+		x = s[1] & ~m[1];
 		if (!x)
 			break;
 		sig = ffz(~x) + _NSIG_BPW + 1;
@@ -224,8 +227,8 @@ static inline void print_dropped_signal(int sig)
 	if (!__ratelimit(&ratelimit_state))
 		return;
 
-	printk(KERN_INFO "%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
-				current->comm, current->pid, sig);
+	pr_info("%s/%d: reached RLIMIT_SIGPENDING, dropped signal %d\n",
+					current->comm, current->pid, sig);
 }
 
 /**
@@ -936,7 +939,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 		 * There is just one thread and it does not need to be woken.
 		 * It will dequeue unblocked signals before it runs again.
 		 */
-		return;
+		goto exit_func;
 	else {
 		/*
 		 * Otherwise try to find a suitable thread.
@@ -950,7 +953,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 				 * Any eligible threads will see
 				 * the signal in the queue soon.
 				 */
-				return;
+				goto exit_func;
 		}
 		signal->curr_target = t;
 	}
@@ -982,7 +985,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 				sigaddset(&t->pending.signal, SIGKILL);
 				signal_wake_up(t, 1);
 			} while_each_thread(p, t);
-			return;
+			goto exit_func;
 		}
 	}
 
@@ -991,6 +994,7 @@ static void complete_signal(int sig, struct task_struct *p, int group)
 	 * Tell the chosen thread to wake up and dequeue it.
 	 */
 	signal_wake_up(t, sig == SIGKILL);
+exit_func:
 	return;
 }
 
@@ -1140,10 +1144,10 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
 static void print_fatal_signal(int signr)
 {
 	struct pt_regs *regs = signal_pt_regs();
-	printk(KERN_INFO "potentially unexpected fatal signal %d.\n", signr);
+	pr_info("potentially unexpected fatal signal %d.\n", signr);
 
 #if defined(__i386__) && !defined(__arch_um__)
-	printk(KERN_INFO "code at %08lx: ", regs->ip);
+	pr_info("code at %08lx: ", regs->ip);
 	{
 		int i;
 		for (i = 0; i < 16; i++) {
@@ -1151,10 +1155,10 @@ static void print_fatal_signal(int signr)
 
 			if (get_user(insn, (unsigned char *)(regs->ip + i)))
 				break;
-			printk(KERN_CONT "%02x ", insn);
+			pr_cont("%02x ", insn);
 		}
 	}
-	printk(KERN_CONT "\n");
+	pr_cont("\n");
 #endif
 	preempt_disable();
 	show_regs(regs);
@@ -1163,7 +1167,7 @@ static void print_fatal_signal(int signr)
 
 static int __init setup_print_fatal_signals(char *str)
 {
-	get_option (&str, &print_fatal_signals);
+	get_option(&str, &print_fatal_signals);
 
 	return 1;
 }
@@ -1431,7 +1435,7 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
 				pid ? find_vpid(-pid) : task_pgrp(current));
 	} else {
 		int retval = 0, count = 0;
-		struct task_struct * p;
+		struct task_struct *p;
 
 		for_each_process(p) {
 			if (task_pid_vnr(p) > 1 &&
@@ -1622,8 +1626,8 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
 
 	BUG_ON(sig == -1);
 
- 	/* do_notify_parent_cldstop should have been called instead.  */
- 	BUG_ON(task_is_stopped_or_traced(tsk));
+	/* do_notify_parent_cldstop should have been called instead.  */
+	BUG_ON(task_is_stopped_or_traced(tsk));
 
 	BUG_ON(!tsk->ptrace &&
 	       (tsk->group_leader != tsk || !thread_group_empty(tsk)));
@@ -1745,20 +1749,20 @@ static void do_notify_parent_cldstop(struct task_struct *tsk,
 	info.si_utime = cputime_to_clock_t(utime);
 	info.si_stime = cputime_to_clock_t(stime);
 
- 	info.si_code = why;
- 	switch (why) {
- 	case CLD_CONTINUED:
- 		info.si_status = SIGCONT;
- 		break;
- 	case CLD_STOPPED:
- 		info.si_status = tsk->signal->group_exit_code & 0x7f;
- 		break;
- 	case CLD_TRAPPED:
- 		info.si_status = tsk->exit_code & 0x7f;
- 		break;
- 	default:
- 		BUG();
- 	}
+	info.si_code = why;
+	switch (why) {
+	case CLD_CONTINUED:
+		info.si_status = SIGCONT;
+		break;
+	case CLD_STOPPED:
+		info.si_status = tsk->signal->group_exit_code & 0x7f;
+		break;
+	case CLD_TRAPPED:
+		info.si_status = tsk->exit_code & 0x7f;
+		break;
+	default:
+		BUG();
+	}
 
 	sighand = parent->sighand;
 	spin_lock_irqsave(&sighand->siglock, flags);
@@ -1943,7 +1947,7 @@ static void ptrace_do_notify(int signr, int exit_code, int why)
 {
 	siginfo_t info;
 
-	memset(&info, 0, sizeof info);
+	memset(&info, 0, sizeof(info));
 	info.si_signo = signr;
 	info.si_code = exit_code;
 	info.si_pid = task_pid_vnr(current);
@@ -2357,7 +2361,7 @@ relock:
 }
 
 /**
- * signal_delivered - 
+ * signal_delivered -
  * @ksig:		kernel signal struct
  * @stepping:		nonzero if debugger single-step or block-step in use
  *
@@ -2704,7 +2708,7 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from)
 {
 	int err;
 
-	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
+	if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))
 		return -EFAULT;
 	if (from->si_code < 0)
 		return __copy_to_user(to, from, sizeof(siginfo_t))
@@ -3131,7 +3135,8 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
 }
 
 static int
-do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long sp)
+do_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+						unsigned long sp)
 {
 	stack_t oss;
 	int error;
@@ -3195,7 +3200,8 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
 out:
 	return error;
 }
-SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss)
+SYSCALL_DEFINE2(sigaltstack, const stack_t __user *, uss,
+					stack_t __user *, uoss)
 {
 	return do_sigaltstack(uss, uoss, current_user_stack_pointer());
 }
@@ -3274,7 +3280,7 @@ int __compat_save_altstack(compat_stack_t __user *uss, unsigned long sp)
  */
 SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
 {
-	return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t)); 
+	return sys_rt_sigpending((sigset_t __user *)set, sizeof(old_sigset_t));
 }
 
 #endif
@@ -3399,7 +3405,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
 	if (!ret && oact) {
 		sigset_to_compat(&mask, &old_ka.sa.sa_mask);
-		ret = put_user(ptr_to_compat(old_ka.sa.sa_handler), 
+		ret = put_user(ptr_to_compat(old_ka.sa.sa_handler),
 			       &oact->sa_handler);
 		ret |= copy_to_user(&oact->sa_mask, &mask, sizeof(mask));
 		ret |= put_user(old_ka.sa.sa_flags, &oact->sa_flags);
@@ -3416,7 +3422,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
 #ifdef CONFIG_OLD_SIGACTION
 SYSCALL_DEFINE3(sigaction, int, sig,
 		const struct old_sigaction __user *, act,
-	        struct old_sigaction __user *, oact)
+		struct old_sigaction __user *, oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -3452,7 +3458,7 @@ SYSCALL_DEFINE3(sigaction, int, sig,
 #ifdef CONFIG_COMPAT_OLD_SIGACTION
 COMPAT_SYSCALL_DEFINE3(sigaction, int, sig,
 		const struct compat_old_sigaction __user *, act,
-	        struct compat_old_sigaction __user *, oact)
+		struct compat_old_sigaction __user *, oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -3575,7 +3581,7 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
 		return -EFAULT;
 	return sigsuspend(&newset);
 }
- 
+
 #ifdef CONFIG_COMPAT
 COMPAT_SYSCALL_DEFINE2(rt_sigsuspend, compat_sigset_t __user *, unewset, compat_size_t, sigsetsize)
 {
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2014-11-16 20:13 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14 15:56 [PATCH] kernel:signal.c Fix coding style errors and warnings Ionut Alexa
2014-11-16  2:47 ` Al Viro
     [not found]   ` <CAKF-a2AYAPy2ENaFVanFCWZ_sXHPy_K_uH6zo5apT-kLLaqONA@mail.gmail.com>
2014-11-16 17:08     ` Al Viro
     [not found]       ` <CAKF-a2AhmE4iZHsRNgyp6Le6uaDNSUjbxQENm5sTYD3f24ORnA@mail.gmail.com>
2014-11-16 18:01         ` Al Viro
2014-11-16 20:09           ` [UNNECESSARY PATCH 00/16] signal: coding style wankery Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 01/16] signal: whitespace neatening Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 02/16] signal: vertical line neatening Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 03/16] signal: Move EXPORT_SYMBOL after function definition Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 04/16] signal: Use pr_<level> Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 05/16] signal: Move case statements to separate lines and for loop neatening Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 06/16] signal: Use consistent function definition style Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 07/16] signal: Add braces Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 08/16] signal: Remove unnecessary return Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 09/16] signal: Use include <linux not <asm Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 10/16] signal: Remove unnecessary parentheses from function pointer call Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 11/16] signal: Add parenthese around sizeof argument Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 12/16] signal: 80 column wrapping Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 13/16] signal: Move label to first column Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 14/16] signal: Convert for (;;) to do {} while Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 15/16] signal: Isolate returns by adding blank lines Joe Perches
2014-11-16 20:09             ` [UNNECESSARY PATCH 16/16] signal: Coalesce kdb_printf formats Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.