All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi: sysfs: Fixed a control flow style issue
@ 2021-06-12 22:34 Clayton Casciato
  2021-06-14 15:36 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Clayton Casciato @ 2021-06-12 22:34 UTC (permalink / raw)
  To: rjw; +Cc: lenb, linux-acpi, Clayton Casciato

Fixed coding style issue.

Signed-off-by: Clayton Casciato <majortomtosourcecontrol@gmail.com>
---
 drivers/acpi/sysfs.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index d6626aba4a6a..0e685ca8f78f 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -254,15 +254,15 @@ static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
 {
 	if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED))
 		return sprintf(buffer, "disable\n");
-	else {
-		if (acpi_gbl_trace_method_name) {
-			if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
-				return sprintf(buffer, "method-once\n");
-			else
-				return sprintf(buffer, "method\n");
-		} else
-			return sprintf(buffer, "enable\n");
-	}
+
+	if (acpi_gbl_trace_method_name) {
+		if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
+			return sprintf(buffer, "method-once\n");
+		else
+			return sprintf(buffer, "method\n");
+	} else
+		return sprintf(buffer, "enable\n");
+
 	return 0;
 }
 
-- 
2.31.1


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

* Re: [PATCH] acpi: sysfs: Fixed a control flow style issue
  2021-06-12 22:34 [PATCH] acpi: sysfs: Fixed a control flow style issue Clayton Casciato
@ 2021-06-14 15:36 ` Rafael J. Wysocki
  2021-06-16  3:52   ` Clayton Casciato
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-06-14 15:36 UTC (permalink / raw)
  To: Clayton Casciato; +Cc: Rafael J. Wysocki, Len Brown, ACPI Devel Maling List

On Sun, Jun 13, 2021 at 12:37 AM Clayton Casciato
<majortomtosourcecontrol@gmail.com> wrote:
>
> Fixed coding style issue.

I'm not really sure what issue you are fixing here.

Is it the redundant braces around the nested if () statement?

If so, the flow before and after the patch is different.  Is this intentional?

> Signed-off-by: Clayton Casciato <majortomtosourcecontrol@gmail.com>
> ---
>  drivers/acpi/sysfs.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
> index d6626aba4a6a..0e685ca8f78f 100644
> --- a/drivers/acpi/sysfs.c
> +++ b/drivers/acpi/sysfs.c
> @@ -254,15 +254,15 @@ static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
>  {
>         if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED))
>                 return sprintf(buffer, "disable\n");
> -       else {
> -               if (acpi_gbl_trace_method_name) {
> -                       if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
> -                               return sprintf(buffer, "method-once\n");
> -                       else
> -                               return sprintf(buffer, "method\n");
> -               } else
> -                       return sprintf(buffer, "enable\n");
> -       }
> +
> +       if (acpi_gbl_trace_method_name) {
> +               if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
> +                       return sprintf(buffer, "method-once\n");
> +               else
> +                       return sprintf(buffer, "method\n");
> +       } else
> +               return sprintf(buffer, "enable\n");
> +
>         return 0;
>  }
>
> --
> 2.31.1
>

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

* Re: [PATCH] acpi: sysfs: Fixed a control flow style issue
  2021-06-14 15:36 ` Rafael J. Wysocki
@ 2021-06-16  3:52   ` Clayton Casciato
  0 siblings, 0 replies; 3+ messages in thread
From: Clayton Casciato @ 2021-06-16  3:52 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Rafael J. Wysocki, Len Brown, ACPI Devel Maling List

On Mon, Jun 14, 2021 at 05:36:19PM +0200, Rafael J. Wysocki wrote:
> On Sun, Jun 13, 2021 at 12:37 AM Clayton Casciato
> <majortomtosourcecontrol@gmail.com> wrote:
> >
> > Fixed coding style issue.
> 
> I'm not really sure what issue you are fixing here.
> 

Checkpatch warns that "else is not generally useful after a break or
return".

> Is it the redundant braces around the nested if () statement?
> 

The patch only removes the else clause.

> If so, the flow before and after the patch is different.  Is this intentional?
> 

Yes. The patch improves readability by removing the outermost context, reducing
the nested conditional complexity.

Thank you for your consideration!

> > Signed-off-by: Clayton Casciato <majortomtosourcecontrol@gmail.com>
> > ---
> >  drivers/acpi/sysfs.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
> > index d6626aba4a6a..0e685ca8f78f 100644
> > --- a/drivers/acpi/sysfs.c
> > +++ b/drivers/acpi/sysfs.c
> > @@ -254,15 +254,15 @@ static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
> >  {
> >         if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED))
> >                 return sprintf(buffer, "disable\n");
> > -       else {
> > -               if (acpi_gbl_trace_method_name) {
> > -                       if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
> > -                               return sprintf(buffer, "method-once\n");
> > -                       else
> > -                               return sprintf(buffer, "method\n");
> > -               } else
> > -                       return sprintf(buffer, "enable\n");
> > -       }
> > +
> > +       if (acpi_gbl_trace_method_name) {
> > +               if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT)
> > +                       return sprintf(buffer, "method-once\n");
> > +               else
> > +                       return sprintf(buffer, "method\n");
> > +       } else
> > +               return sprintf(buffer, "enable\n");
> > +
> >         return 0;
> >  }
> >
> > --
> > 2.31.1
> >

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

end of thread, other threads:[~2021-06-16  3:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-12 22:34 [PATCH] acpi: sysfs: Fixed a control flow style issue Clayton Casciato
2021-06-14 15:36 ` Rafael J. Wysocki
2021-06-16  3:52   ` Clayton Casciato

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.