linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] staging: greybus: loopback_test: Adding missing brackets into if..else block
@ 2019-09-09 14:32 Julio Faracco
  2019-09-09 16:09 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Julio Faracco @ 2019-09-09 14:32 UTC (permalink / raw)
  To: greybus-dev, devel, linux-kernel, gregkh; +Cc: elder, johan, lkcamp

Inside a block of if..else conditional, else structure does not contain
brackets. This is not following regular policies of kernel coding style.
All parts of this conditional blocks should respect brackets inclusion.
This commit removes some blank spaces that are not following brackets
policies too.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>

---

Changes from v1:
- fixing patch description
- including more cases that brackets does not fill kernel code policies.

---
---
 drivers/staging/greybus/tools/loopback_test.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c
index ba6f905f2..22e79f197 100644
--- a/drivers/staging/greybus/tools/loopback_test.c
+++ b/drivers/staging/greybus/tools/loopback_test.c
@@ -238,7 +238,6 @@ static void show_loopback_devices(struct loopback_test *t)
 
 	for (i = 0; i < t->device_count; i++)
 		printf("device[%d] = %s\n", i, t->devices[i].name);
-
 }
 
 int open_sysfs(const char *sys_pfx, const char *node, int flags)
@@ -273,7 +272,6 @@ float read_sysfs_float_fd(int fd, const char *sys_pfx, const char *node)
 	char buf[SYSFS_MAX_INT];
 
 	if (read(fd, buf, sizeof(buf)) < 0) {
-
 		fprintf(stderr, "unable to read from %s%s %s\n", sys_pfx, node,
 			strerror(errno));
 		close(fd);
@@ -366,7 +364,6 @@ static int get_results(struct loopback_test *t)
 			r->apbridge_unipro_latency_max - r->apbridge_unipro_latency_min;
 		r->gbphy_firmware_latency_jitter =
 			r->gbphy_firmware_latency_max - r->gbphy_firmware_latency_min;
-
 	}
 
 	/*calculate the aggregate results of all enabled devices */
@@ -406,7 +403,6 @@ static int get_results(struct loopback_test *t)
 			r->apbridge_unipro_latency_max - r->apbridge_unipro_latency_min;
 		r->gbphy_firmware_latency_jitter =
 			r->gbphy_firmware_latency_max - r->gbphy_firmware_latency_min;
-
 	}
 
 	return 0;
@@ -535,8 +531,8 @@ static int log_results(struct loopback_test *t)
 			fprintf(stderr, "unable to open %s for appendation\n", file_name);
 			abort();
 		}
-
 	}
+
 	for (i = 0; i < t->device_count; i++) {
 		if (!device_enabled(t, i))
 			continue;
@@ -549,10 +545,8 @@ static int log_results(struct loopback_test *t)
 			if (ret == -1)
 				fprintf(stderr, "unable to write %d bytes to csv.\n", len);
 		}
-
 	}
 
-
 	if (t->aggregate_output) {
 		len = format_output(t, &t->aggregate_results, "aggregate",
 				    data, sizeof(data), &tm);
@@ -739,7 +733,6 @@ static int wait_for_complete(struct loopback_test *t)
 		ts = &t->poll_timeout;
 
 	while (1) {
-
 		ret = ppoll(t->fds, t->poll_count, ts, &mask_old);
 		if (ret <= 0) {
 			stop_tests(t);
@@ -801,8 +794,9 @@ static void prepare_devices(struct loopback_test *t)
 			write_sysfs_val(t->devices[i].sysfs_entry,
 					"outstanding_operations_max",
 					t->async_outstanding_operations);
-		} else
+		} else {
 			write_sysfs_val(t->devices[i].sysfs_entry, "async", 0);
+		}
 	}
 }
 
@@ -879,10 +873,8 @@ static int sanity_check(struct loopback_test *t)
 			fprintf(stderr, "Bad device mask %x\n", (1 << i));
 			return -1;
 		}
-
 	}
 
-
 	return 0;
 }
 
-- 
2.20.1


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

* Re: [PATCH v2] staging: greybus: loopback_test: Adding missing brackets into if..else block
  2019-09-09 14:32 [PATCH v2] staging: greybus: loopback_test: Adding missing brackets into if..else block Julio Faracco
@ 2019-09-09 16:09 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-09-09 16:09 UTC (permalink / raw)
  To: Julio Faracco; +Cc: greybus-dev, devel, linux-kernel, lkcamp, elder, johan

On Mon, Sep 09, 2019 at 02:32:44PM +0000, Julio Faracco wrote:
> Inside a block of if..else conditional, else structure does not contain
> brackets. This is not following regular policies of kernel coding style.
> All parts of this conditional blocks should respect brackets inclusion.
> This commit removes some blank spaces that are not following brackets
> policies too.

Whenever you say "too" or "also" that's a huge hint that you should
break the patch up into multiple patches.

Please do that here, only do "one logical thing" per patch.

thanks,

greg k-h

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

end of thread, other threads:[~2019-09-09 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 14:32 [PATCH v2] staging: greybus: loopback_test: Adding missing brackets into if..else block Julio Faracco
2019-09-09 16:09 ` Greg KH

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).