lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170327142740.kz74sy56zpup5zgu@dell>
Date:   Mon, 27 Mar 2017 15:27:40 +0100
From:   Lee Jones <lee.jones@...aro.org>
To:     Daniel Thompson <daniel.thompson@...aro.org>
Cc:     Geert Uytterhoeven <geert+renesas@...der.be>,
        Thierry Reding <thierry.reding@...il.com>,
        Jingoo Han <jingoohan1@...il.com>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Peter Ujfalusi <peter.ujfalusi@...com>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        linux-pwm@...r.kernel.org, linux-fbdev@...r.kernel.org,
        linux-renesas-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] backlight: pwm_bl: Fix GPIO out for unimplemented
 .get_direction()

On Fri, 24 Mar 2017, Daniel Thompson wrote:

> On 24/03/17 16:42, Daniel Thompson wrote:
> > On 22/03/17 17:21, Geert Uytterhoeven wrote:
> > > Commit 7613c922315e308a ("backlight: pwm_bl: Move the checks for initial
> > > power state to a separate function") not just moved some code, but made
> > > slight changes in semantics.
> > > 
> > > If a gpiochip doesn't implement the optional .get_direction() callback,
> > > gpiod_get_direction always returns -EINVAL, which is never equal to
> > > GPIOF_DIR_IN, leading to the GPIO not being configured for output.
> > > 
> > > To avoid this, invert the test and check for not GPIOF_DIR_OUT instead,
> > > like the original code did.
> > > 
> > > This restores the display on r8a7740/armadillo.
> > > 
> > > Fixes: 7613c922315e308a ("backlight: pwm_bl: Move the checks for
> > > initial power state to a separate function")
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>
> > 
> > Acked-by: Daniel Thommpson <daniel.thompson@...aro.org>
> 
> Actually, it would be better if there only one m...
> 
> Acked-by: Daniel Thompson <daniel.thompson@...aro.org>

You probably don't want to be typing out your Acks manually every
time.  Can you set a key combination in your editor?

> > > ---
> > >  drivers/video/backlight/pwm_bl.c | 7 ++++---
> > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/video/backlight/pwm_bl.c
> > > b/drivers/video/backlight/pwm_bl.c
> > > index d7efcb632f7d9dde..002f1ce22bd02032 100644
> > > --- a/drivers/video/backlight/pwm_bl.c
> > > +++ b/drivers/video/backlight/pwm_bl.c
> > > @@ -297,14 +297,15 @@ static int pwm_backlight_probe(struct
> > > platform_device *pdev)
> > >      }
> > > 
> > >      /*
> > > -     * If the GPIO is configured as input, change the direction to
> > > output
> > > -     * and set the GPIO as active.
> > > +     * If the GPIO is not known to be already configured as output, that
> > > +     * is, if gpiod_get_direction returns either GPIOF_DIR_IN or
> > > -EINVAL,
> > > +     * change the direction to output and set the GPIO as active.
> > >       * Do not force the GPIO to active when it was already output as it
> > >       * could cause backlight flickering or we would enable the
> > > backlight too
> > >       * early. Leave the decision of the initial backlight state for
> > > later.
> > >       */
> > >      if (pb->enable_gpio &&
> > > -        gpiod_get_direction(pb->enable_gpio) == GPIOF_DIR_IN)
> > > +        gpiod_get_direction(pb->enable_gpio) != GPIOF_DIR_OUT)
> > >          gpiod_direction_output(pb->enable_gpio, 1);
> > > 
> > >      pb->power_supply = devm_regulator_get(&pdev->dev, "power");
> > > 
> > 
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ