Skip to contentSkip to conversation

staging: greybus: Fix quote string split across lines

PATCH In review Jamal Shareef 3 participants 4 messages Oct 14, 2019 – Oct 15, 2019

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

PATCH 1/1 staging: greybus: Fix quote string split across lines

Fix quoted string split across multiple lines.
Issue found by checkpatch.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +5 -5
index ab882cc49b41..54b0caf22b5a 100644
@@ -17,11 +17,11 @@ static ssize_t manager_sysfs_add_store(struct kobject *kobj,
 {
 	struct gb_audio_manager_module_descriptor desc = { {0} };
 
-	int num = sscanf(buf,
-			"name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
-			"vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",
-			desc.name, &desc.vid, &desc.pid, &desc.intf_id,
-			&desc.ip_devices, &desc.op_devices);
+	int num =
+	sscanf(buf, "name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
+	       "vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",
+	       desc.name, &desc.vid, &desc.pid, &desc.intf_id,
+	       &desc.ip_devices, &desc.op_devices);
 
 	if (num != 7)
 		return -EINVAL;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · Jamal Shareef

Fix quoted string split across multiple lines.
Issue found by checkpatch.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +0 -0
index ab882cc49b41..54b0caf22b5a 100644
@@ -17,11 +17,11 @@ static ssize_t manager_sysfs_add_store(struct kobject *kobj,
 {

drivers/staging/greybus/audio_manager_sysfs.c static ssize_t manager_sysfs_add_store(struct kobject *kobj, · line 22

Quoted 10 lines
drivers/staging/greybus/audio_manager_sysfs.c +3 -5
 	struct gb_audio_manager_module_descriptor desc = { {0} };
 
-	int num = sscanf(buf,
-			"name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
-			"vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",
-			desc.name, &desc.vid, &desc.pid, &desc.intf_id,
-			&desc.ip_devices, &desc.op_devices);
+	int num =
+	sscanf(buf, "name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
+	       "vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",

It still seems to be split over multiple lines. The point of the message is that you can exceed 80 columns if doing so puts the whole string on one line, making it easier to grep for. On the other hand, the use of the macro already makes part of the string impossible to grep for. So the macro could be on a different line from the rest of the string, reducing a bit the overall width.

julia

Quoted 13 lines
drivers/staging/greybus/audio_manager_sysfs.c +2 -1
+	       desc.name, &desc.vid, &desc.pid, &desc.intf_id,
+	       &desc.ip_devices, &desc.op_devices);
 
 	if (num != 7)
 		return -EINVAL;
--

2.17.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191014205529.919-1-jamal.k.shareef%40gmail.com.

#2 lore raw
Quoted 36 lines · Julia Lawall
Quoted 14 lines · Jamal Shareef

Fix quoted string split across multiple lines.
Issue found by checkpatch.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +0 -0
index ab882cc49b41..54b0caf22b5a 100644
@@ -17,11 +17,11 @@ static ssize_t manager_sysfs_add_store(struct kobject *kobj,
 {

drivers/staging/greybus/audio_manager_sysfs.c static ssize_t manager_sysfs_add_store(struct kobject *kobj, · line 22

Quoted 10 lines
drivers/staging/greybus/audio_manager_sysfs.c +3 -5
 	struct gb_audio_manager_module_descriptor desc = { {0} };
 
-	int num = sscanf(buf,
-			"name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
-			"vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",
-			desc.name, &desc.vid, &desc.pid, &desc.intf_id,
-			&desc.ip_devices, &desc.op_devices);
+	int num =
+	sscanf(buf, "name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
+	       "vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",

It still seems to be split over multiple lines. The point of the message is that you can exceed 80 columns if doing so puts the whole string on one line, making it easier to grep for. On the other hand, the use of the macro already makes part of the string impossible to grep for. So the macro could be on a different line from the rest of the string, reducing a bit the overall width.

Quoted 1 line

julia

I was under the impression that the warning was specifically for the quoted string that starts with "vid...".

We can proceed with the macro fix suggested if that would be beneficial. Thank you for the information on grep, was not aware of this.

Jamal

Quoted 13 lines
Quoted 13 lines
drivers/staging/greybus/audio_manager_sysfs.c +2 -1
+	       desc.name, &desc.vid, &desc.pid, &desc.intf_id,
+	       &desc.ip_devices, &desc.op_devices);
 
 	if (num != 7)
 		return -EINVAL;
--

2.17.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191014205529.919-1-jamal.k.shareef%40gmail.com.

maintainer
#3 lore raw
In reply to Jamal Shareef
Quoted 13 lines · Jamal Shareef

Fix quoted string split across multiple lines.
Issue found by checkpatch.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +0 -0
index ab882cc49b41..54b0caf22b5a 100644

drivers/staging/greybus/audio_manager_sysfs.c static ssize_t manager_sysfs_add_store(struct kobject *kobj, · line 21

Quoted 10 lines
drivers/staging/greybus/audio_manager_sysfs.c +2 -5
@@ -17,11 +17,11 @@ static ssize_t manager_sysfs_add_store(struct kobject *kobj,
 {
 	struct gb_audio_manager_module_descriptor desc = { {0} };
 
-	int num = sscanf(buf,
-			"name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "
-			"vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",
-			desc.name, &desc.vid, &desc.pid, &desc.intf_id,
-			&desc.ip_devices, &desc.op_devices);
+	int num =
+	sscanf(buf, "name=%" GB_AUDIO_MANAGER_MODULE_NAME_LEN_SSCANF "s "

First off, this type of indent isn't ok :(

drivers/staging/greybus/audio_manager_sysfs.c static ssize_t manager_sysfs_add_store(struct kobject *kobj, · line 24

Quoted 3 lines
drivers/staging/greybus/audio_manager_sysfs.c +3 -0
+	       "vid=%d pid=%d intf_id=%d i/p devices=0x%X o/p devices=0x%X",
+	       desc.name, &desc.vid, &desc.pid, &desc.intf_id,
+	       &desc.ip_devices, &desc.op_devices);

Secondly, as Julia points out, you didn't actually change anything here with regards to the string.

As the code is, it looks about as good as it can get, I would just leave this as-is.

thanks,

greg k-h