diff mbox series

PM: Domains: Add curly braces to delimit comment + statement block

Message ID 20201013141459.28599-1-geert+renesas@glider.be
State Accepted
Commit 505a70b783debaa84c7ebafa44a69a9401db4499
Headers show
Series PM: Domains: Add curly braces to delimit comment + statement block | expand

Commit Message

Geert Uytterhoeven Oct. 13, 2020, 2:14 p.m. UTC
There is not strict need to group a comment and a single statement in an
if block, as comments are stripped by the pre-processor.  However,
adding curly braces does make the code easier to read, and may avoid
mistakes when changing the code later.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/base/power/domain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ulf Hansson Oct. 14, 2020, 9:38 a.m. UTC | #1
On Tue, 13 Oct 2020 at 16:15, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> There is not strict need to group a comment and a single statement in an
> if block, as comments are stripped by the pre-processor.  However,
> adding curly braces does make the code easier to read, and may avoid
> mistakes when changing the code later.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

I assume that this is the only place of this pattern in this file?
Else, it seems like we should fix them all in one go.

Nevertheless:
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/base/power/domain.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 05bb4d4401b26e44..f4a28c33fafa03b2 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1270,13 +1270,14 @@ static int genpd_restore_noirq(struct device *dev)
>          * first time for the given domain in the present cycle.
>          */
>         genpd_lock(genpd);
> -       if (genpd->suspended_count++ == 0)
> +       if (genpd->suspended_count++ == 0) {
>                 /*
>                  * The boot kernel might put the domain into arbitrary state,
>                  * so make it appear as powered off to genpd_sync_power_on(),
>                  * so that it tries to power it on in case it was really off.
>                  */
>                 genpd->status = GENPD_STATE_OFF;
> +       }
>
>         genpd_sync_power_on(genpd, true, 0);
>         genpd_unlock(genpd);
> --
> 2.17.1
>
Geert Uytterhoeven Oct. 14, 2020, 12:10 p.m. UTC | #2
Hi Ulf,

On Wed, Oct 14, 2020 at 11:39 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On Tue, 13 Oct 2020 at 16:15, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> > There is not strict need to group a comment and a single statement in an
> > if block, as comments are stripped by the pre-processor.  However,
> > adding curly braces does make the code easier to read, and may avoid
> > mistakes when changing the code later.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> I assume that this is the only place of this pattern in this file?
> Else, it seems like we should fix them all in one go.

Yes, only one.

> Nevertheless:
> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Thanks!

Gr{oetje,eeting}s,

                        Geert
Rafael J. Wysocki Oct. 16, 2020, 3:43 p.m. UTC | #3
On Tue, Oct 13, 2020 at 4:15 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>

> There is not strict need to group a comment and a single statement in an

> if block, as comments are stripped by the pre-processor.  However,

> adding curly braces does make the code easier to read, and may avoid

> mistakes when changing the code later.

>

> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

> ---

>  drivers/base/power/domain.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

>

> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c

> index 05bb4d4401b26e44..f4a28c33fafa03b2 100644

> --- a/drivers/base/power/domain.c

> +++ b/drivers/base/power/domain.c

> @@ -1270,13 +1270,14 @@ static int genpd_restore_noirq(struct device *dev)

>          * first time for the given domain in the present cycle.

>          */

>         genpd_lock(genpd);

> -       if (genpd->suspended_count++ == 0)

> +       if (genpd->suspended_count++ == 0) {

>                 /*

>                  * The boot kernel might put the domain into arbitrary state,

>                  * so make it appear as powered off to genpd_sync_power_on(),

>                  * so that it tries to power it on in case it was really off.

>                  */

>                 genpd->status = GENPD_STATE_OFF;

> +       }

>

>         genpd_sync_power_on(genpd, true, 0);

>         genpd_unlock(genpd);

> --


Applied as 5.10-rc material with the Ulf's ACK, thanks!
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 05bb4d4401b26e44..f4a28c33fafa03b2 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1270,13 +1270,14 @@  static int genpd_restore_noirq(struct device *dev)
 	 * first time for the given domain in the present cycle.
 	 */
 	genpd_lock(genpd);
-	if (genpd->suspended_count++ == 0)
+	if (genpd->suspended_count++ == 0) {
 		/*
 		 * The boot kernel might put the domain into arbitrary state,
 		 * so make it appear as powered off to genpd_sync_power_on(),
 		 * so that it tries to power it on in case it was really off.
 		 */
 		genpd->status = GENPD_STATE_OFF;
+	}
 
 	genpd_sync_power_on(genpd, true, 0);
 	genpd_unlock(genpd);