Skip to contentSkip to conversation

staging: greybus: Fix parameters alignment and strings concatenation

PATCH In review Cristian Sicilia 3 participants 12 messages Dec 4, 2018 – Dec 6, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover staging: greybus: Fix parameters alignment and strings concatenation

First patch align some parameters with parenthesis. Second patch will add some spaces between string.

Cristian Sicilia (2):
staging: greybus: Align function call parameters to parenthesis
staging: greybus: Added space between string concatenated

 drivers/staging/greybus/loopback.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 staging: greybus: Align function call parameters to parenthesis

Aligned some parameters to the previous parenthesis.

---
 drivers/staging/greybus/loopback.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/greybus/loopback.c +6 -4
index e4d42c1..1085e06 100644
@@ -638,7 +638,8 @@ static int gb_loopback_async_transfer(struct gb_loopback *gb, u32 len)
 	retval = gb_loopback_async_operation(gb, GB_LOOPBACK_TYPE_TRANSFER,
 					     request, len + sizeof(*request),
 					     len + response_len,
-					     gb_loopback_async_transfer_complete);
+					     gb_loopback_async_transfer_complete
+					     );
 	if (retval)
 		goto gb_error;
 
@@ -682,7 +683,8 @@ static int gb_loopback_request_handler(struct gb_operation *operation)
 		}
 
 		if (!gb_operation_response_alloc(operation,
-				len + sizeof(*response), GFP_KERNEL)) {
+						 len + sizeof(*response),
+						 GFP_KERNEL)) {
 			dev_err(dev, "error allocating response\n");
 			return -ENOMEM;
 		}
@@ -882,7 +884,7 @@ static int gb_loopback_fn(void *data)
 				gb->type = 0;
 				gb->send_count = 0;
 				sysfs_notify(&gb->dev->kobj,  NULL,
-						"iteration_count");
+					     "iteration_count");
 				dev_dbg(&bundle->dev, "load test complete\n");
 			} else {
 				dev_dbg(&bundle->dev,
@@ -1066,7 +1068,7 @@ static int gb_loopback_probe(struct gb_bundle *bundle,
 
 	/* Allocate kfifo */
 	if (kfifo_alloc(&gb->kfifo_lat, kfifo_depth * sizeof(u32),
-			  GFP_KERNEL)) {
+			GFP_KERNEL)) {
 		retval = -ENOMEM;
 		goto out_conn;
 	}
Signature · 1 line
2.7.4
#4 lore raw

PATCH 2/2 staging: greybus: Added space between string concatenated

In reply to Cristian Sicilia

Some concatenated strings are now spaced.

---
 drivers/staging/greybus/loopback.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/loopback.c +3 -3
index 1085e06..acfa392 100644
@@ -141,7 +141,7 @@ static ssize_t name##_##field##_show(struct device *dev,	\
 	/* Report 0 for min and max if no transfer successed */		\
 	if (!gb->requests_completed)					\
 		return sprintf(buf, "0\n");				\
-	return sprintf(buf, "%"#type"\n", gb->name.field);	\
+	return sprintf(buf, "%" #type "\n", gb->name.field);		\
 }									\
 static DEVICE_ATTR_RO(name##_##field)
 
@@ -176,7 +176,7 @@ static ssize_t field##_show(struct device *dev,				\
 			    char *buf)					\
 {									\
 	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sprintf(buf, "%"#type"\n", gb->field);			\
+	return sprintf(buf, "%" #type "\n", gb->field);			\
 }									\
 static ssize_t field##_store(struct device *dev,			\
 			    struct device_attribute *attr,		\
@@ -212,7 +212,7 @@ static ssize_t field##_show(struct device *dev,				\
 			    char *buf)					\
 {									\
 	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sprintf(buf, "%"#type"\n", gb->field);			\
+	return sprintf(buf, "%" #type "\n", gb->field);			\
 }									\
 static ssize_t field##_store(struct device *dev,			\
 			    struct device_attribute *attr,		\
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/2] staging: greybus: Align function call parameters to parenthesis

In reply to Cristian Sicilia
Quoted 12 lines · Cristian Sicilia

Aligned some parameters to the previous parenthesis.

---
 drivers/staging/greybus/loopback.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/greybus/loopback.c +0 -0
index e4d42c1..1085e06 100644

drivers/staging/greybus/loopback.c static int gb_loopback_async_transfer(struct gb_loopback *gb, u32 len) · line 642

Quoted 6 lines
drivers/staging/greybus/loopback.c +2 -1
@@ -638,7 +638,8 @@ static int gb_loopback_async_transfer(struct gb_loopback *gb, u32 len)
 	retval = gb_loopback_async_operation(gb, GB_LOOPBACK_TYPE_TRANSFER,
 					     request, len + sizeof(*request),
 					     len + response_len,
-					     gb_loopback_async_transfer_complete);
+					     gb_loopback_async_transfer_complete
+					     );

Ick, why do this? That's not really needed.

thanks,

greg k-h

maintainer
#5 lore raw

Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

In reply to Cristian Sicilia
Quoted 31 lines · Cristian Sicilia

Some concatenated strings are now spaced.

---
  drivers/staging/greybus/loopback.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/loopback.c +2 -2
index 1085e06..acfa392 100644
@@ -141,7 +141,7 @@ static ssize_t name##_##field##_show(struct device *dev,	\
  	/* Report 0 for min and max if no transfer successed */		\
  	if (!gb->requests_completed)					\
  		return sprintf(buf, "0\n");				\
-	return sprintf(buf, "%"#type"\n", gb->name.field);	\
+	return sprintf(buf, "%" #type "\n", gb->name.field);		\
  }									\
  static DEVICE_ATTR_RO(name##_##field)
 
@@ -176,7 +176,7 @@ static ssize_t field##_show(struct device *dev,				\
  			    char *buf)					\
  {									\
  	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sprintf(buf, "%"#type"\n", gb->field);			\
+	return sprintf(buf, "%" #type "\n", gb->field);			\
  }									\
  static ssize_t field##_store(struct device *dev,			\
  			    struct device_attribute *attr,		\

drivers/staging/greybus/loopback.c static ssize_t field##_show(struct device *dev, \ · line 218

Quoted 8 lines
drivers/staging/greybus/loopback.c +1 -1
@@ -212,7 +212,7 @@ static ssize_t field##_show(struct device *dev,				\
  			    char *buf)					\
  {									\
  	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sprintf(buf, "%"#type"\n", gb->field);			\
+	return sprintf(buf, "%" #type "\n", gb->field);			\
  }									\
  static ssize_t field##_store(struct device *dev,			\
  			    struct device_attribute *attr,		\

Eh.

But doesn't all of this add an extra two space to the resultant string ?

Not what we want.

---
bod

#6 lore raw

Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

Quoted 41 lines · Bryan O'Donoghue
Quoted 30 lines · Cristian Sicilia

Some concatenated strings are now spaced.

---
 drivers/staging/greybus/loopback.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/loopback.c +2 -2
index 1085e06..acfa392 100644
@@ -141,7 +141,7 @@ static ssize_t name##_##field##_show(struct device *dev,	\
 	/* Report 0 for min and max if no transfer successed */		\
 	if (!gb->requests_completed)					\
 		return sprintf(buf, "0\n");				\
-	return sprintf(buf, "%"#type"\n", gb->name.field);	\
+	return sprintf(buf, "%" #type "\n", gb->name.field);		\
 }									\
 static DEVICE_ATTR_RO(name##_##field)
@@ -176,7 +176,7 @@ static ssize_t field##_show(struct device *dev,				\
 			    char *buf)					\
 {									\
 	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sprintf(buf, "%"#type"\n", gb->field);			\
+	return sprintf(buf, "%" #type "\n", gb->field);			\
 }									\
 static ssize_t field##_store(struct device *dev,			\
 			    struct device_attribute *attr,		\

drivers/staging/greybus/loopback.c static ssize_t field##_show(struct device *dev, \ · line 218

Quoted 8 lines
drivers/staging/greybus/loopback.c +1 -1
@@ -212,7 +212,7 @@ static ssize_t field##_show(struct device *dev,				\
 			    char *buf)					\
 {									\
 	struct gb_loopback *gb = dev_get_drvdata(dev);			\
-	return sprintf(buf, "%"#type"\n", gb->field);			\
+	return sprintf(buf, "%" #type "\n", gb->field);			\
 }									\
 static ssize_t field##_store(struct device *dev,			\
 			    struct device_attribute *attr,		\

Eh.

Quoted 3 lines

But doesn't all of this add an extra two space to the resultant string ?

Not what we want.

It doesn't change the result string, if I well understand the question your doubt is if there are some space between % and type or between type and end of line:

This (supposing type=u and field=min):
return sprintf(buf, "%"#type"\n", gb->field);
Will expanded in this
return sprintf(buf, "%""u""\n", gb->min);
That's is like:
return sprintf(buf, "%u\n", gb->min);

This (supposing type=u and field=min):
return sprintf(buf, "%" #type "\n", gb->field);
Will expanded in this
return sprintf(buf, "%" "u" "\n", gb->min);
That's is like:
return sprintf(buf, "%u\n", gb->min);

Quoted 3 lines

---
bod

#3 lore raw

Re: [PATCH 1/2] staging: greybus: Align function call parameters to parenthesis

In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Cristian Sicilia

Aligned some parameters to the previous parenthesis.

---
 drivers/staging/greybus/loopback.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
Quoted 14 lines

drivers/staging/greybus/loopback.c static int gb_loopback_async_transfer(struct gb_loopback *gb, u32 len) · line 642

Quoted 11 lines
drivers/staging/greybus/loopback.c +2 -1
index e4d42c1..1085e06 100644
@@ -638,7 +638,8 @@ static int gb_loopback_async_transfer(struct gb_loopback *gb, u32 len)
 	retval = gb_loopback_async_operation(gb, GB_LOOPBACK_TYPE_TRANSFER,
 					     request, len + sizeof(*request),
 					     len + response_len,
-					     gb_loopback_async_transfer_complete);
+					     gb_loopback_async_transfer_complete
+					     );

Ick, why do this? That's not really needed.

Ok, better to leave it unchanged

Quoted 3 lines

thanks,

greg k-h

#8 lore raw

Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

Quoted 4 lines · Bryan O'Donoghue
Quoted 1 line · Sicilia Cristian

It doesn't change the result string

So why do it then ?

Because it is easier to read this way and odds are checkpatch is happier.

thanks,

greg k-h

maintainer Acked-by
#9 lore raw

Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

Quoted 8 lines · Greg Kroah-Hartman
Quoted 4 lines · Bryan O'Donoghue
Quoted 1 line · Sicilia Cristian

It doesn't change the result string

So why do it then ?

Because it is easier to read this way and odds are checkpatch is happier.

Fine.

Sicilia could you please amend your commit.

'This patch fixes the checkpatch error "CHECK: Concatenated strings should use spaces between elements"'

and then feel free to add my

---
bod

#10 lore raw

Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

Quoted 12 lines · Bryan O'Donoghue
Quoted 8 lines · Greg Kroah-Hartman
Quoted 4 lines · Bryan O'Donoghue
Quoted 1 line · Sicilia Cristian

It doesn't change the result string

So why do it then ?

Because it is easier to read this way and odds are checkpatch is happier.

Fine.

Quoted 8 lines

Sicilia could you please amend your commit.

'This patch fixes the checkpatch error "CHECK: Concatenated strings should use spaces between elements"'

and then feel free to add my

It's already in my tree, no need to ammend it, sorry :)

greg k-h

maintainer
#11 lore raw

Re: [PATCH 2/2] staging: greybus: Added space between string concatenated

Quoted 18 lines · Greg Kroah-Hartman
Quoted 17 lines · Bryan O'Donoghue
Quoted 8 lines · Greg Kroah-Hartman
Quoted 4 lines · Bryan O'Donoghue
Quoted 1 line · Sicilia Cristian

It doesn't change the result string

So why do it then ?

Because it is easier to read this way and odds are checkpatch is happier.

Fine.

Sicilia could you please amend your commit.

'This patch fixes the checkpatch error "CHECK: Concatenated strings should use spaces between elements"'

Quoted 8 lines
Quoted 3 lines

and then feel free to add my

It's already in my tree, no need to ammend it, sorry :)

greg k-h

thanks greg !