diff mbox series

[2/3] PM: wakeup: Remove unnecessary else from device_init_wakeup

Message ID 20240318055054.1564696-3-d-gole@ti.com (mailing list archive)
State Superseded, archived
Headers show
Series PM: wakeup: make device_wakeup_disable return void | expand

Commit Message

Dhruva Gole March 18, 2024, 5:50 a.m. UTC
Checkpatch warns that else is generally not necessary after a return
condition which exists in the if part of this function. Hence, just to
abide by what checkpatch recommends, follow it's guidelines.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
---
 include/linux/pm_wakeup.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Rafael J. Wysocki March 18, 2024, 1:52 p.m. UTC | #1
On Mon, Mar 18, 2024 at 6:55 AM Dhruva Gole <d-gole@ti.com> wrote:
>
> Checkpatch warns that else is generally not necessary after a return
> condition which exists in the if part of this function. Hence, just to
> abide by what checkpatch recommends, follow it's guidelines.
>
> Signed-off-by: Dhruva Gole <d-gole@ti.com>
> ---
>  include/linux/pm_wakeup.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
> index 428803eed798..76cd1f9f1365 100644
> --- a/include/linux/pm_wakeup.h
> +++ b/include/linux/pm_wakeup.h
> @@ -234,11 +234,10 @@ static inline int device_init_wakeup(struct device *dev, bool enable)
>         if (enable) {
>                 device_set_wakeup_capable(dev, true);
>                 return device_wakeup_enable(dev);
> -       } else {
> -               device_wakeup_disable(dev);
> -               device_set_wakeup_capable(dev, false);
> -               return 0;
>         }
> +       device_wakeup_disable(dev);
> +       device_set_wakeup_capable(dev, false);
> +       return 0;
>  }
>
>  #endif /* _LINUX_PM_WAKEUP_H */
> --

This one is fine with me, but not 6.9-rc material.

Thanks!
Dhruva Gole March 18, 2024, 3:18 p.m. UTC | #2
On Mar 18, 2024 at 14:52:02 +0100, Rafael J. Wysocki wrote:
> On Mon, Mar 18, 2024 at 6:55 AM Dhruva Gole <d-gole@ti.com> wrote:
> >
> > Checkpatch warns that else is generally not necessary after a return
> > condition which exists in the if part of this function. Hence, just to
> > abide by what checkpatch recommends, follow it's guidelines.
> >
> > Signed-off-by: Dhruva Gole <d-gole@ti.com>
> > ---
> >  include/linux/pm_wakeup.h | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
> > index 428803eed798..76cd1f9f1365 100644
> > --- a/include/linux/pm_wakeup.h
> > +++ b/include/linux/pm_wakeup.h
> > @@ -234,11 +234,10 @@ static inline int device_init_wakeup(struct device *dev, bool enable)
> >         if (enable) {
> >                 device_set_wakeup_capable(dev, true);
> >                 return device_wakeup_enable(dev);
> > -       } else {
> > -               device_wakeup_disable(dev);
> > -               device_set_wakeup_capable(dev, false);
> > -               return 0;
> >         }
> > +       device_wakeup_disable(dev);
> > +       device_set_wakeup_capable(dev, false);
> > +       return 0;
> >  }
> >
> >  #endif /* _LINUX_PM_WAKEUP_H */
> > --
> 
> This one is fine with me, but not 6.9-rc material.

OK, I completely understand.
diff mbox series

Patch

diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 428803eed798..76cd1f9f1365 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -234,11 +234,10 @@  static inline int device_init_wakeup(struct device *dev, bool enable)
 	if (enable) {
 		device_set_wakeup_capable(dev, true);
 		return device_wakeup_enable(dev);
-	} else {
-		device_wakeup_disable(dev);
-		device_set_wakeup_capable(dev, false);
-		return 0;
 	}
+	device_wakeup_disable(dev);
+	device_set_wakeup_capable(dev, false);
+	return 0;
 }
 
 #endif /* _LINUX_PM_WAKEUP_H */