2017-07-28 19:51:04

by Shreeya Patel

[permalink] [raw]
Subject: [PATCH v2] Staging: greybus: Match alignment with open parenthesis.

Alignment should match with open parenthesis.
This fixes the coding style issue.

Signed-off-by: Shreeya Patel <[email protected]>
---
Changes in v2:
-Rebase the patch.


drivers/staging/greybus/tools/loopback_test.c | 35 ++++++++++++---------------
1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c
index 32a4369..a29e091a 100644
--- a/drivers/staging/greybus/tools/loopback_test.c
+++ b/drivers/staging/greybus/tools/loopback_test.c
@@ -420,10 +420,10 @@ void log_csv_error(int len, int err)
}

int format_output(struct loopback_test *t,
- struct loopback_results *r,
- const char *dev_name,
- char *buf, int buf_len,
- struct tm *tm)
+ struct loopback_results *r,
+ const char *dev_name,
+ char *buf, int buf_len,
+ struct tm *tm)
{
int len = 0;

@@ -535,7 +535,7 @@ static int log_results(struct loopback_test *t)
*/
if (t->file_output && !t->porcelain) {
snprintf(file_name, sizeof(file_name), "%s_%d_%d.csv",
- t->test_name, t->size, t->iteration_max);
+ t->test_name, t->size, t->iteration_max);

fd = open(file_name, O_WRONLY | O_CREAT | O_APPEND, 0644);
if (fd < 0) {
@@ -549,8 +549,8 @@ static int log_results(struct loopback_test *t)
continue;

len = format_output(t, &t->devices[i].results,
- t->devices[i].name,
- data, sizeof(data), &tm);
+ t->devices[i].name,
+ data, sizeof(data), &tm);
if (t->file_output && !t->porcelain) {
ret = write(fd, data, len);
if (ret == -1)
@@ -562,7 +562,7 @@ static int log_results(struct loopback_test *t)

if (t->aggregate_output) {
len = format_output(t, &t->aggregate_results, "aggregate",
- data, sizeof(data), &tm);
+ data, sizeof(data), &tm);
if (t->file_output && !t->porcelain) {
ret = write(fd, data, len);
if (ret == -1)
@@ -623,14 +623,13 @@ int find_loopback_devices(struct loopback_test *t)
snprintf(d->name, MAX_STR_LEN, "gb_loopback%u", dev_id);

snprintf(d->sysfs_entry, MAX_SYSFS_PATH, "%s%s/",
- t->sysfs_prefix, d->name);
+ t->sysfs_prefix, d->name);

snprintf(d->debugfs_entry, MAX_SYSFS_PATH, "%sraw_latency_%s",
- t->debugfs_prefix, d->name);
+ t->debugfs_prefix, d->name);

if (t->debug)
- printf("add %s %s\n", d->sysfs_entry,
- d->debugfs_entry);
+ printf("add %s %s\n", d->sysfs_entry, d->debugfs_entry);
}

ret = 0;
@@ -802,16 +801,14 @@ static void prepare_devices(struct loopback_test *t)
t->iteration_max);

if (t->use_async) {
+ write_sysfs_val(t->devices[i].sysfs_entry, "async", 1);
write_sysfs_val(t->devices[i].sysfs_entry,
- "async", 1);
+ "timeout", t->async_timeout);
write_sysfs_val(t->devices[i].sysfs_entry,
- "timeout", t->async_timeout);
- write_sysfs_val(t->devices[i].sysfs_entry,
- "outstanding_operations_max",
- t->async_outstanding_operations);
+ "outstanding_operations_max",
+ t->async_outstanding_operations);
} else
- write_sysfs_val(t->devices[i].sysfs_entry,
- "async", 0);
+ write_sysfs_val(t->devices[i].sysfs_entry, "async", 0);
}
}

--
2.7.4


2017-08-01 16:41:36

by Bryan O'Donoghue

[permalink] [raw]
Subject: Re: [PATCH v2] Staging: greybus: Match alignment with open parenthesis.

On 28/07/17 20:50, Shreeya Patel wrote:
> Alignment should match with open parenthesis.
I was going to crib about the use of parenthesis instead of
parentheses... but as the man would say that would be #sad #sosad

So - thanks for taking the time to send this patch.

> This fixes the coding style issue.
>
> Signed-off-by: Shreeya Patel <[email protected]>

Reviewed-by: Bryan O'Donoghue <[email protected]>

> ---
> Changes in v2:
> -Rebase the patch.
>
>
> drivers/staging/greybus/tools/loopback_test.c | 35 ++++++++++++---------------
> 1 file changed, 16 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c
> index 32a4369..a29e091a 100644
> --- a/drivers/staging/greybus/tools/loopback_test.c
> +++ b/drivers/staging/greybus/tools/loopback_test.c
> @@ -420,10 +420,10 @@ void log_csv_error(int len, int err)
> }
>
> int format_output(struct loopback_test *t,
> - struct loopback_results *r,
> - const char *dev_name,
> - char *buf, int buf_len,
> - struct tm *tm)
> + struct loopback_results *r,
> + const char *dev_name,
> + char *buf, int buf_len,
> + struct tm *tm)
> {
> int len = 0;
>
> @@ -535,7 +535,7 @@ static int log_results(struct loopback_test *t)
> */
> if (t->file_output && !t->porcelain) {
> snprintf(file_name, sizeof(file_name), "%s_%d_%d.csv",
> - t->test_name, t->size, t->iteration_max);
> + t->test_name, t->size, t->iteration_max);
>
> fd = open(file_name, O_WRONLY | O_CREAT | O_APPEND, 0644);
> if (fd < 0) {
> @@ -549,8 +549,8 @@ static int log_results(struct loopback_test *t)
> continue;
>
> len = format_output(t, &t->devices[i].results,
> - t->devices[i].name,
> - data, sizeof(data), &tm);
> + t->devices[i].name,
> + data, sizeof(data), &tm);
> if (t->file_output && !t->porcelain) {
> ret = write(fd, data, len);
> if (ret == -1)
> @@ -562,7 +562,7 @@ static int log_results(struct loopback_test *t)
>
> if (t->aggregate_output) {
> len = format_output(t, &t->aggregate_results, "aggregate",
> - data, sizeof(data), &tm);
> + data, sizeof(data), &tm);
> if (t->file_output && !t->porcelain) {
> ret = write(fd, data, len);
> if (ret == -1)
> @@ -623,14 +623,13 @@ int find_loopback_devices(struct loopback_test *t)
> snprintf(d->name, MAX_STR_LEN, "gb_loopback%u", dev_id);
>
> snprintf(d->sysfs_entry, MAX_SYSFS_PATH, "%s%s/",
> - t->sysfs_prefix, d->name);
> + t->sysfs_prefix, d->name);
>
> snprintf(d->debugfs_entry, MAX_SYSFS_PATH, "%sraw_latency_%s",
> - t->debugfs_prefix, d->name);
> + t->debugfs_prefix, d->name);
>
> if (t->debug)
> - printf("add %s %s\n", d->sysfs_entry,
> - d->debugfs_entry);
> + printf("add %s %s\n", d->sysfs_entry, d->debugfs_entry);
> }
>
> ret = 0;
> @@ -802,16 +801,14 @@ static void prepare_devices(struct loopback_test *t)
> t->iteration_max);
>
> if (t->use_async) {
> + write_sysfs_val(t->devices[i].sysfs_entry, "async", 1);
> write_sysfs_val(t->devices[i].sysfs_entry,
> - "async", 1);
> + "timeout", t->async_timeout);
> write_sysfs_val(t->devices[i].sysfs_entry,
> - "timeout", t->async_timeout);
> - write_sysfs_val(t->devices[i].sysfs_entry,
> - "outstanding_operations_max",
> - t->async_outstanding_operations);
> + "outstanding_operations_max",
> + t->async_outstanding_operations);
> } else
> - write_sysfs_val(t->devices[i].sysfs_entry,
> - "async", 0);
> + write_sysfs_val(t->devices[i].sysfs_entry, "async", 0);
> }
> }
>
>