2020-10-14 09:22:32

by Xu Wang

[permalink] [raw]
Subject: [PATCH] video: fbdev: sh_mobile_lcdcfb: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

Because clk_prepare_enable() and clk_disable_unprepare() already checked
NULL clock parameter, so the additional checks are unnecessary, just
remove them.

Signed-off-by: Xu Wang <[email protected]>
---
drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index c1043420dbd3..c0952cc96bdb 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -341,8 +341,7 @@ static void lcdc_wait_bit(struct sh_mobile_lcdc_priv *priv,
static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
{
if (atomic_inc_and_test(&priv->hw_usecnt)) {
- if (priv->dot_clk)
- clk_prepare_enable(priv->dot_clk);
+ clk_prepare_enable(priv->dot_clk);
pm_runtime_get_sync(priv->dev);
}
}
@@ -351,8 +350,7 @@ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
{
if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
pm_runtime_put(priv->dev);
- if (priv->dot_clk)
- clk_disable_unprepare(priv->dot_clk);
+ clk_disable_unprepare(priv->dot_clk);
}
}

--
2.17.1


2020-10-15 11:17:21

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH] video: fbdev: sh_mobile_lcdcfb: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

On Wed, 14 Oct 2020 08:57:22 +0000 Xu Wang <[email protected]> wrote:

> Because clk_prepare_enable() and clk_disable_unprepare() already checked
> NULL clock parameter, so the additional checks are unnecessary, just
> remove them.
>
> Signed-off-by: Xu Wang <[email protected]>

Reviewed-by: Thomas Zimmermann <[email protected]>

> ---
> drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> b/drivers/video/fbdev/sh_mobile_lcdcfb.c index c1043420dbd3..c0952cc96bdb
> 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> @@ -341,8 +341,7 @@ static void lcdc_wait_bit(struct sh_mobile_lcdc_priv
> *priv, static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
> {
> if (atomic_inc_and_test(&priv->hw_usecnt)) {
> - if (priv->dot_clk)
> - clk_prepare_enable(priv->dot_clk);
> + clk_prepare_enable(priv->dot_clk);
> pm_runtime_get_sync(priv->dev);
> }
> }
> @@ -351,8 +350,7 @@ static void sh_mobile_lcdc_clk_off(struct
> sh_mobile_lcdc_priv *priv) {
> if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
> pm_runtime_put(priv->dev);
> - if (priv->dot_clk)
> - clk_disable_unprepare(priv->dot_clk);
> + clk_disable_unprepare(priv->dot_clk);
> }
> }
>



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

2020-10-16 13:07:30

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH] video: fbdev: sh_mobile_lcdcfb: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

On Thu, 15 Oct 2020 10:10:15 +0200 Thomas Zimmermann <[email protected]>
wrote:

> On Wed, 14 Oct 2020 08:57:22 +0000 Xu Wang <[email protected]> wrote:
>
> > Because clk_prepare_enable() and clk_disable_unprepare() already checked
> > NULL clock parameter, so the additional checks are unnecessary, just
> > remove them.
> >
> > Signed-off-by: Xu Wang <[email protected]>
>
> Reviewed-by: Thomas Zimmermann <[email protected]>
>

Merged into drm-misc-next. Thanks!

> > ---
> > drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> > b/drivers/video/fbdev/sh_mobile_lcdcfb.c index c1043420dbd3..c0952cc96bdb
> > 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> > +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> > @@ -341,8 +341,7 @@ static void lcdc_wait_bit(struct sh_mobile_lcdc_priv
> > *priv, static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
> > {
> > if (atomic_inc_and_test(&priv->hw_usecnt)) {
> > - if (priv->dot_clk)
> > - clk_prepare_enable(priv->dot_clk);
> > + clk_prepare_enable(priv->dot_clk);
> > pm_runtime_get_sync(priv->dev);
> > }
> > }
> > @@ -351,8 +350,7 @@ static void sh_mobile_lcdc_clk_off(struct
> > sh_mobile_lcdc_priv *priv) {
> > if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
> > pm_runtime_put(priv->dev);
> > - if (priv->dot_clk)
> > - clk_disable_unprepare(priv->dot_clk);
> > + clk_disable_unprepare(priv->dot_clk);
> > }
> > }
> >
>
>
>



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer