* [PATCH] backlight: pwm_bl: Don't assign levels table repeatedly
@ 2019-10-01 23:29 Matthias Kaehlcke
2019-10-02 10:07 ` Daniel Thompson
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Kaehlcke @ 2019-10-01 23:29 UTC (permalink / raw)
To: Thierry Reding, Lee Jones, Daniel Thompson, Jingoo Han,
Bartlomiej Zolnierkiewicz
Cc: linux-pwm, linux-fbdev, Matthias Kaehlcke, linux-kernel, dri-devel
pwm_backlight_probe() re-assigns pb->levels for every brightness
level. This is not needed and was likely not intended, since
neither side of the assignment changes during the loop. Assign
the field only once.
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
drivers/video/backlight/pwm_bl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 746eebc411df..959436b9e92b 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -564,6 +564,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
memset(&props, 0, sizeof(struct backlight_properties));
if (data->levels) {
+ pb->levels = data->levels;
+
/*
* For the DT case, only when brightness levels is defined
* data->levels is filled. For the non-DT case, data->levels
@@ -572,8 +574,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
for (i = 0; i <= data->max_brightness; i++) {
if (data->levels[i] > pb->scale)
pb->scale = data->levels[i];
-
- pb->levels = data->levels;
}
if (pwm_backlight_is_linear(data))
--
2.23.0.444.g18eeb5a265-goog
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] backlight: pwm_bl: Don't assign levels table repeatedly
2019-10-01 23:29 [PATCH] backlight: pwm_bl: Don't assign levels table repeatedly Matthias Kaehlcke
@ 2019-10-02 10:07 ` Daniel Thompson
2019-10-02 16:32 ` Matthias Kaehlcke
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Thompson @ 2019-10-02 10:07 UTC (permalink / raw)
To: Matthias Kaehlcke
Cc: Thierry Reding, Lee Jones, Jingoo Han, Bartlomiej Zolnierkiewicz,
linux-pwm, linux-fbdev, dri-devel, linux-kernel
On Tue, Oct 01, 2019 at 04:29:24PM -0700, Matthias Kaehlcke wrote:
> pwm_backlight_probe() re-assigns pb->levels for every brightness
> level. This is not needed and was likely not intended, since
> neither side of the assignment changes during the loop. Assign
> the field only once.
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Makes sense but this should probably be dropping the curly braces too.
Daniel.
> ---
>
> drivers/video/backlight/pwm_bl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 746eebc411df..959436b9e92b 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -564,6 +564,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> memset(&props, 0, sizeof(struct backlight_properties));
>
> if (data->levels) {
> + pb->levels = data->levels;
> +
> /*
> * For the DT case, only when brightness levels is defined
> * data->levels is filled. For the non-DT case, data->levels
> @@ -572,8 +574,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> for (i = 0; i <= data->max_brightness; i++) {
> if (data->levels[i] > pb->scale)
> pb->scale = data->levels[i];
> -
> - pb->levels = data->levels;
> }
>
> if (pwm_backlight_is_linear(data))
> --
> 2.23.0.444.g18eeb5a265-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] backlight: pwm_bl: Don't assign levels table repeatedly
2019-10-02 10:07 ` Daniel Thompson
@ 2019-10-02 16:32 ` Matthias Kaehlcke
0 siblings, 0 replies; 3+ messages in thread
From: Matthias Kaehlcke @ 2019-10-02 16:32 UTC (permalink / raw)
To: Daniel Thompson
Cc: Thierry Reding, Lee Jones, Jingoo Han, Bartlomiej Zolnierkiewicz,
linux-pwm, linux-fbdev, dri-devel, linux-kernel
On Wed, Oct 02, 2019 at 11:07:37AM +0100, Daniel Thompson wrote:
> On Tue, Oct 01, 2019 at 04:29:24PM -0700, Matthias Kaehlcke wrote:
> > pwm_backlight_probe() re-assigns pb->levels for every brightness
> > level. This is not needed and was likely not intended, since
> > neither side of the assignment changes during the loop. Assign
> > the field only once.
> >
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
>
> Makes sense but this should probably be dropping the curly braces too.
ack, I'll send a new version with the curly braces removed.
> > drivers/video/backlight/pwm_bl.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> > index 746eebc411df..959436b9e92b 100644
> > --- a/drivers/video/backlight/pwm_bl.c
> > +++ b/drivers/video/backlight/pwm_bl.c
> > @@ -564,6 +564,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> > memset(&props, 0, sizeof(struct backlight_properties));
> >
> > if (data->levels) {
> > + pb->levels = data->levels;
> > +
> > /*
> > * For the DT case, only when brightness levels is defined
> > * data->levels is filled. For the non-DT case, data->levels
> > @@ -572,8 +574,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> > for (i = 0; i <= data->max_brightness; i++) {
> > if (data->levels[i] > pb->scale)
> > pb->scale = data->levels[i];
> > -
> > - pb->levels = data->levels;
> > }
> >
> > if (pwm_backlight_is_linear(data))
> > --
> > 2.23.0.444.g18eeb5a265-goog
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-02 16:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 23:29 [PATCH] backlight: pwm_bl: Don't assign levels table repeatedly Matthias Kaehlcke
2019-10-02 10:07 ` Daniel Thompson
2019-10-02 16:32 ` Matthias Kaehlcke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).