All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: remove variable backlight
@ 2021-08-10  1:23 zhaoxiao
  2021-08-10 14:13   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: zhaoxiao @ 2021-08-10  1:23 UTC (permalink / raw)
  To: airlied, daniel
  Cc: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig,
	Xinhui.Pan, nirmoy.das, amd-gfx, dri-devel, linux-kernel,
	zhaoxiao

The variable backlight is being initialized with a value that
is never read, it is being re-assigned immediately afterwards.
Clean up the code by removing the need for variable backlight.

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
index 874b132fe1d7..0808433185f8 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
@@ -177,23 +177,21 @@ static void dce_abm_init(struct abm *abm, uint32_t backlight)
 static unsigned int dce_abm_get_current_backlight(struct abm *abm)
 {
 	struct dce_abm *abm_dce = TO_DCE_ABM(abm);
-	unsigned int backlight = REG_READ(BL1_PWM_CURRENT_ABM_LEVEL);
 
 	/* return backlight in hardware format which is unsigned 17 bits, with
 	 * 1 bit integer and 16 bit fractional
 	 */
-	return backlight;
+	return REG_READ(BL1_PWM_CURRENT_ABM_LEVEL);
 }
 
 static unsigned int dce_abm_get_target_backlight(struct abm *abm)
 {
 	struct dce_abm *abm_dce = TO_DCE_ABM(abm);
-	unsigned int backlight = REG_READ(BL1_PWM_TARGET_ABM_LEVEL);
 
 	/* return backlight in hardware format which is unsigned 17 bits, with
 	 * 1 bit integer and 16 bit fractional
 	 */
-	return backlight;
+	return REG_READ(BL1_PWM_TARGET_ABM_LEVEL);
 }
 
 static bool dce_abm_set_level(struct abm *abm, uint32_t level)
-- 
2.20.1




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

* Re: [PATCH] drm/amd/display: remove variable backlight
  2021-08-10  1:23 [PATCH] drm/amd/display: remove variable backlight zhaoxiao
@ 2021-08-10 14:13   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-08-10 14:13 UTC (permalink / raw)
  To: zhaoxiao
  Cc: Dave Airlie, Daniel Vetter, Wentland, Harry, Leo (Sunpeng) Li,
	Deucher, Alexander, Christian Koenig, xinhui pan, Nirmoy Das,
	amd-gfx list, Maling list - DRI developers, LKML

On Mon, Aug 9, 2021 at 9:24 PM zhaoxiao <zhaoxiao@uniontech.com> wrote:
>
> The variable backlight is being initialized with a value that
> is never read, it is being re-assigned immediately afterwards.

I don't think this comment really matches the code.  I think you can drop it.

Alex

> Clean up the code by removing the need for variable backlight.
>
> Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
> ---
>  drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
> index 874b132fe1d7..0808433185f8 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
> @@ -177,23 +177,21 @@ static void dce_abm_init(struct abm *abm, uint32_t backlight)
>  static unsigned int dce_abm_get_current_backlight(struct abm *abm)
>  {
>         struct dce_abm *abm_dce = TO_DCE_ABM(abm);
> -       unsigned int backlight = REG_READ(BL1_PWM_CURRENT_ABM_LEVEL);
>
>         /* return backlight in hardware format which is unsigned 17 bits, with
>          * 1 bit integer and 16 bit fractional
>          */
> -       return backlight;
> +       return REG_READ(BL1_PWM_CURRENT_ABM_LEVEL);
>  }
>
>  static unsigned int dce_abm_get_target_backlight(struct abm *abm)
>  {
>         struct dce_abm *abm_dce = TO_DCE_ABM(abm);
> -       unsigned int backlight = REG_READ(BL1_PWM_TARGET_ABM_LEVEL);
>
>         /* return backlight in hardware format which is unsigned 17 bits, with
>          * 1 bit integer and 16 bit fractional
>          */
> -       return backlight;
> +       return REG_READ(BL1_PWM_TARGET_ABM_LEVEL);
>  }
>
>  static bool dce_abm_set_level(struct abm *abm, uint32_t level)
> --
> 2.20.1
>
>
>

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

* Re: [PATCH] drm/amd/display: remove variable backlight
@ 2021-08-10 14:13   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-08-10 14:13 UTC (permalink / raw)
  To: zhaoxiao
  Cc: Dave Airlie, Daniel Vetter, Wentland, Harry, Leo (Sunpeng) Li,
	Deucher, Alexander, Christian Koenig, xinhui pan, Nirmoy Das,
	amd-gfx list, Maling list - DRI developers, LKML

On Mon, Aug 9, 2021 at 9:24 PM zhaoxiao <zhaoxiao@uniontech.com> wrote:
>
> The variable backlight is being initialized with a value that
> is never read, it is being re-assigned immediately afterwards.

I don't think this comment really matches the code.  I think you can drop it.

Alex

> Clean up the code by removing the need for variable backlight.
>
> Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
> ---
>  drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
> index 874b132fe1d7..0808433185f8 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
> @@ -177,23 +177,21 @@ static void dce_abm_init(struct abm *abm, uint32_t backlight)
>  static unsigned int dce_abm_get_current_backlight(struct abm *abm)
>  {
>         struct dce_abm *abm_dce = TO_DCE_ABM(abm);
> -       unsigned int backlight = REG_READ(BL1_PWM_CURRENT_ABM_LEVEL);
>
>         /* return backlight in hardware format which is unsigned 17 bits, with
>          * 1 bit integer and 16 bit fractional
>          */
> -       return backlight;
> +       return REG_READ(BL1_PWM_CURRENT_ABM_LEVEL);
>  }
>
>  static unsigned int dce_abm_get_target_backlight(struct abm *abm)
>  {
>         struct dce_abm *abm_dce = TO_DCE_ABM(abm);
> -       unsigned int backlight = REG_READ(BL1_PWM_TARGET_ABM_LEVEL);
>
>         /* return backlight in hardware format which is unsigned 17 bits, with
>          * 1 bit integer and 16 bit fractional
>          */
> -       return backlight;
> +       return REG_READ(BL1_PWM_TARGET_ABM_LEVEL);
>  }
>
>  static bool dce_abm_set_level(struct abm *abm, uint32_t level)
> --
> 2.20.1
>
>
>

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

end of thread, other threads:[~2021-08-10 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10  1:23 [PATCH] drm/amd/display: remove variable backlight zhaoxiao
2021-08-10 14:13 ` Alex Deucher
2021-08-10 14:13   ` Alex Deucher

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.