mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing: Correct braces usage in if-else statement
@ 2014-04-19 13:58 Lin Yongting
  2014-04-19 15:28 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Lin Yongting @ 2014-04-19 13:58 UTC (permalink / raw)
  To: rostedt, fweisbec, mingo; +Cc: linux-kernel, linyongting, linyongting

There are some incorrect braces usages in kernerl/trace/trace.c, including:
1. Missing braces in 'if' or 'else' branch.
2. Unnecessary braces in 'if' statement.

Fix them according to kernel CodeStyle.

Signed-off-by: Lin Yongting <linyongting@gmail.com>
---
 kernel/trace/trace.c |   39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 737b0ef..1028f68 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -488,8 +488,9 @@ int __trace_puts(unsigned long ip, const char *str, int size)
 	if (entry->buf[size - 1] != '\n') {
 		entry->buf[size] = '\n';
 		entry->buf[size + 1] = '\0';
-	} else
+	} else {
 		entry->buf[size] = '\0';
+	}
 
 	__buffer_unlock_commit(buffer, event);
 
@@ -891,9 +892,9 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
 
 	/* read the non-space input */
 	while (cnt && !isspace(ch)) {
-		if (parser->idx < parser->size - 1)
+		if (parser->idx < parser->size - 1) {
 			parser->buffer[parser->idx++] = ch;
-		else {
+		} else {
 			ret = -EINVAL;
 			goto out;
 		}
@@ -1756,9 +1757,10 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer,
 
 		if (trace.nr_entries > size)
 			size = trace.nr_entries;
-	} else
+	} else {
 		/* From now on, use_stack is a boolean */
 		use_stack = 0;
+	}
 
 	size *= sizeof(unsigned long);
 
@@ -1770,10 +1772,10 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer,
 
 	memset(&entry->caller, 0, size);
 
-	if (use_stack)
+	if (use_stack) {
 		memcpy(&entry->caller, trace.entries,
 		       trace.nr_entries * sizeof(unsigned long));
-	else {
+	} else {
 		trace.max_entries	= FTRACE_STACK_ENTRIES;
 		trace.entries		= entry->caller;
 		if (regs)
@@ -2398,8 +2400,9 @@ static void *s_start(struct seq_file *m, loff_t *pos)
 		if (cpu_file == RING_BUFFER_ALL_CPUS) {
 			for_each_tracing_cpu(cpu)
 				tracing_iter_reset(iter, cpu);
-		} else
+		} else {
 			tracing_iter_reset(iter, cpu_file);
+		}
 
 		iter->leftover = 0;
 		for (p = iter; p && l < *pos; p = s_next(m, p, &l))
@@ -2410,9 +2413,9 @@ static void *s_start(struct seq_file *m, loff_t *pos)
 		 * If we overflowed the seq_file before, then we want
 		 * to just reuse the trace_seq buffer again.
 		 */
-		if (iter->leftover)
+		if (iter->leftover) {
 			p = iter;
-		else {
+		} else {
 			l = *pos - 1;
 			p = s_next(m, p, &l);
 		}
@@ -2460,9 +2463,10 @@ get_total_entries(struct trace_buffer *buf,
 			count -= per_cpu_ptr(buf->data, cpu)->skipped_entries;
 			/* total is the same as the entries */
 			*total += count;
-		} else
+		} else {
 			*total += count +
 				ring_buffer_overrun_cpu(buf->buffer, cpu);
+		}
 		*entries += count;
 	}
 }
@@ -4251,9 +4255,8 @@ static int tracing_wait_pipe(struct file *filp)
 
 	while (trace_empty(iter)) {
 
-		if ((filp->f_flags & O_NONBLOCK)) {
+		if ((filp->f_flags & O_NONBLOCK))
 			return -EAGAIN;
-		}
 
 		mutex_unlock(&iter->mutex);
 
@@ -4560,10 +4563,12 @@ tracing_entries_read(struct file *filp, char __user *ubuf,
 					    trace_buf_size >> 10);
 			else
 				r = sprintf(buf, "%lu\n", size >> 10);
-		} else
+		} else {
 			r = sprintf(buf, "X\n");
-	} else
+		}
+	} else {
 		r = sprintf(buf, "%lu\n", per_cpu_ptr(tr->trace_buffer.data, cpu)->entries >> 10);
+	}
 
 	mutex_unlock(&trace_types_lock);
 
@@ -4734,14 +4739,16 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
 		len = PAGE_SIZE - offset;
 		memcpy(&entry->buf, map_page[0] + offset, len);
 		memcpy(&entry->buf[len], map_page[1], cnt - len);
-	} else
+	} else {
 		memcpy(&entry->buf, map_page[0] + offset, cnt);
+	}
 
 	if (entry->buf[cnt - 1] != '\n') {
 		entry->buf[cnt] = '\n';
 		entry->buf[cnt + 1] = '\0';
-	} else
+	} else {
 		entry->buf[cnt] = '\0';
+	}
 
 	__buffer_unlock_commit(buffer, event);
 
-- 
1.7.9.5


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

* Re: [PATCH] tracing: Correct braces usage in if-else statement
  2014-04-19 13:58 [PATCH] tracing: Correct braces usage in if-else statement Lin Yongting
@ 2014-04-19 15:28 ` Steven Rostedt
  2014-04-19 17:09   ` ivan lin
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2014-04-19 15:28 UTC (permalink / raw)
  To: Lin Yongting; +Cc: fweisbec, mingo, linux-kernel, linyongting

On Sat, 19 Apr 2014 21:58:23 +0800
Lin Yongting <linyongting@gmail.com> wrote:

> There are some incorrect braces usages in kernerl/trace/trace.c, including:
> 1. Missing braces in 'if' or 'else' branch.
> 2. Unnecessary braces in 'if' statement.
> 
> Fix them according to kernel CodeStyle.

I understand that this is part of the CodeStyle, but I'm not accepting
this patch. It causes more pain than it is worth, as it makes it more
difficult to see git history because of "clean up" changes that get in
the way. I also honestly don't think this is much of a clean up.

Sorry,

-- Steve


> 
> Signed-off-by: Lin Yongting <linyongting@gmail.com>
> ---
>  kernel/trace/trace.c |   39 +++++++++++++++++++++++----------------
>  1 file changed, 23 insertions(+), 16 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c

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

* Re: [PATCH] tracing: Correct braces usage in if-else statement
  2014-04-19 15:28 ` Steven Rostedt
@ 2014-04-19 17:09   ` ivan lin
  0 siblings, 0 replies; 3+ messages in thread
From: ivan lin @ 2014-04-19 17:09 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Frédéric Weisbecker, mingo, linux-kernel, linyongting

2014-04-19 23:28 GMT+08:00 Steven Rostedt <rostedt@goodmis.org>:
> On Sat, 19 Apr 2014 21:58:23 +0800
> Lin Yongting <linyongting@gmail.com> wrote:
>
>> There are some incorrect braces usages in kernerl/trace/trace.c, including:
>> 1. Missing braces in 'if' or 'else' branch.
>> 2. Unnecessary braces in 'if' statement.
>>
>> Fix them according to kernel CodeStyle.
>
> I understand that this is part of the CodeStyle, but I'm not accepting
> this patch. It causes more pain than it is worth, as it makes it more
> difficult to see git history because of "clean up" changes that get in
> the way. I also honestly don't think this is much of a clean up.
>
> Sorry,
>
> -- Steve
>

Yes, you are right.  This clean up is pain than it is worth.

Thnaks!

-- Yongting.

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

end of thread, other threads:[~2014-04-19 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-19 13:58 [PATCH] tracing: Correct braces usage in if-else statement Lin Yongting
2014-04-19 15:28 ` Steven Rostedt
2014-04-19 17:09   ` ivan lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®