All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: Fix quote string split across lines
@ 2019-10-14 20:55 Jamal Shareef
  2019-10-14 21:10 ` [Outreachy kernel] " Julia Lawall
  2019-10-15  4:09 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Jamal Shareef @ 2019-10-14 20:55 UTC (permalink / raw)
  To: boqun.feng, andrea.parri
  Cc: Jamal Shareef, vaibhav.sr, mgreer, johan, elder, gregkh,
	outreachy-kernel

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

Signed-off-by: Jamal Shareef <jamal.k.shareef@gmail.com>
---
 drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/greybus/audio_manager_sysfs.c b/drivers/staging/greybus/audio_manager_sysfs.c
index ab882cc49b41..54b0caf22b5a 100644
--- a/drivers/staging/greybus/audio_manager_sysfs.c
+++ b/drivers/staging/greybus/audio_manager_sysfs.c
@@ -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;
-- 
2.17.1



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

* Re: [Outreachy kernel] [PATCH] staging: greybus: Fix quote string split across lines
  2019-10-14 20:55 [PATCH] staging: greybus: Fix quote string split across lines Jamal Shareef
@ 2019-10-14 21:10 ` Julia Lawall
  2019-10-15  3:24   ` Jamal Shareef
  2019-10-15  4:09 ` Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2019-10-14 21:10 UTC (permalink / raw)
  To: Jamal Shareef
  Cc: boqun.feng, andrea.parri, vaibhav.sr, mgreer, johan, elder,
	gregkh, outreachy-kernel



On Mon, 14 Oct 2019, Jamal Shareef wrote:

> Fix quoted string split across multiple lines.
> Issue found by checkpatch.
>
> Signed-off-by: Jamal Shareef <jamal.k.shareef@gmail.com>
> ---
>  drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_manager_sysfs.c b/drivers/staging/greybus/audio_manager_sysfs.c
> index ab882cc49b41..54b0caf22b5a 100644
> --- a/drivers/staging/greybus/audio_manager_sysfs.c
> +++ b/drivers/staging/greybus/audio_manager_sysfs.c
> @@ -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",

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

> +	       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 outreachy-kernel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191014205529.919-1-jamal.k.shareef%40gmail.com.
>


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

* Re: [Outreachy kernel] [PATCH] staging: greybus: Fix quote string split across lines
  2019-10-14 21:10 ` [Outreachy kernel] " Julia Lawall
@ 2019-10-15  3:24   ` Jamal Shareef
  0 siblings, 0 replies; 4+ messages in thread
From: Jamal Shareef @ 2019-10-15  3:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: boqun.feng, andrea.parri, vaibhav.sr, mgreer, johan, elder,
	gregkh, outreachy-kernel

On Mon, Oct 14, 2019 at 11:10:31PM +0200, Julia Lawall wrote:
> 
> 
> On Mon, 14 Oct 2019, Jamal Shareef wrote:
> 
> > Fix quoted string split across multiple lines.
> > Issue found by checkpatch.
> >
> > Signed-off-by: Jamal Shareef <jamal.k.shareef@gmail.com>
> > ---
> >  drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/staging/greybus/audio_manager_sysfs.c b/drivers/staging/greybus/audio_manager_sysfs.c
> > index ab882cc49b41..54b0caf22b5a 100644
> > --- a/drivers/staging/greybus/audio_manager_sysfs.c
> > +++ b/drivers/staging/greybus/audio_manager_sysfs.c
> > @@ -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",
> 
> 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

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
> > +	       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 outreachy-kernel+unsubscribe@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191014205529.919-1-jamal.k.shareef%40gmail.com.
> >


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

* Re: [PATCH] staging: greybus: Fix quote string split across lines
  2019-10-14 20:55 [PATCH] staging: greybus: Fix quote string split across lines Jamal Shareef
  2019-10-14 21:10 ` [Outreachy kernel] " Julia Lawall
@ 2019-10-15  4:09 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2019-10-15  4:09 UTC (permalink / raw)
  To: Jamal Shareef
  Cc: boqun.feng, andrea.parri, vaibhav.sr, mgreer, johan, elder,
	outreachy-kernel

On Mon, Oct 14, 2019 at 01:55:29PM -0700, Jamal Shareef wrote:
> Fix quoted string split across multiple lines.
> Issue found by checkpatch.
> 
> Signed-off-by: Jamal Shareef <jamal.k.shareef@gmail.com>
> ---
>  drivers/staging/greybus/audio_manager_sysfs.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/greybus/audio_manager_sysfs.c b/drivers/staging/greybus/audio_manager_sysfs.c
> index ab882cc49b41..54b0caf22b5a 100644
> --- a/drivers/staging/greybus/audio_manager_sysfs.c
> +++ b/drivers/staging/greybus/audio_manager_sysfs.c
> @@ -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 :(

> +	       "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


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 20:55 [PATCH] staging: greybus: Fix quote string split across lines Jamal Shareef
2019-10-14 21:10 ` [Outreachy kernel] " Julia Lawall
2019-10-15  3:24   ` Jamal Shareef
2019-10-15  4:09 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.