Skip to contentSkip to conversation

staging: greybus: quoted string split across lines

PATCH In review Gokce Kuler 4 participants 4 messages Apr 4, 2020 – Apr 6, 2020

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

PATCH 1/1 staging: greybus: quoted string split across lines

Quoted string merge to upper line.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +1 -2
index ab882cc..d7216e9 100644
@@ -18,8 +18,7 @@ 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",
+			"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);
 
Signature · 1 line
2.7.4
#1 lore raw

Gökçe,

Quoted 12 lines · On Sat, 4 Apr 2020 03:51:22 +0300 Gokce Kuler <[email protected]> wrote:

Quoted string merge to upper line.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +0 -0
index ab882cc..d7216e9 100644

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

Quoted 6 lines
drivers/staging/greybus/audio_manager_sysfs.c +1 -2
@@ -18,8 +18,7 @@ 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",
+			"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",

Is this reported by...? checkpatch? Because I don't see the problem with a sscanf().

That is, the rationale for keeping quoted strings unwrapped is that they end up in kernel logs, and one might want to find the equivalent point in the sources. But with a sscanf(), I'm not sure we need it.

Signature · 1 line
Stefano
maintainer
#2 lore raw
In reply to Gokce Kuler
Quoted 12 lines · Gokce Kuler

Quoted string merge to upper line.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +0 -0
index ab882cc..d7216e9 100644

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

Quoted 6 lines
drivers/staging/greybus/audio_manager_sysfs.c +1 -2
@@ -18,8 +18,7 @@ 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",
+			"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",

No, try breaking this line by putting the "s " on the next line, so there is only quoted string there.

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Gokce Kuler

Quoted string merge to upper line.

---
 drivers/staging/greybus/audio_manager_sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/greybus/audio_manager_sysfs.c +0 -0
index ab882cc..d7216e9 100644
@@ -18,8 +18,7 @@ static ssize_t manager_sysfs_add_store(struct kobject *kobj,
 	struct gb_audio_manager_module_descriptor desc = { {0} };
 
Quoted 7 lines

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

Quoted 4 lines
drivers/staging/greybus/audio_manager_sysfs.c +1 -2
 	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",
+			"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",

No, try breaking this line by putting the "s " on the next line, so there is only quoted string there.

Not sure that would improve things; I'd say that "s " really does belong on the same line as the "name=%" and field width define.

As Stefano pointed out, splitting a string like this isn't really an issue with sscanf either.

I suggest we just leave this one as is.

Johan