linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Jingoo Han <jingoohan1@gmail.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] backlight: pwm_bl: Don't assign levels table repeatedly
Date: Wed, 02 Oct 2019 16:32:48 +0000	[thread overview]
Message-ID: <20191002163248.GE87296@google.com> (raw)
In-Reply-To: <20191002100737.orm5ghpnw6oe6b3r@holly.lan>

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
> > 

      reply	other threads:[~2019-10-02 16:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002163248.GE87296@google.com \
    --to=mka@chromium.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel.thompson@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).