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: <20170120133627.GK17297@lahna.fi.intel.com>
Date:   Fri, 20 Jan 2017 15:36:27 +0200
From:   Mika Westerberg <mika.westerberg@...ux.intel.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Neil Armstrong <narmstrong@...libre.com>,
        Alexandre Courbot <gnurou@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] pinctrl / gpio: Introduce .set_config() callback for
 GPIO chips

On Fri, Jan 20, 2017 at 10:13:05AM +0100, Linus Walleij wrote:
> > +static int gpio_set_drive_mode(struct gpio_chip *gc, unsigned offset,
> > +                              enum pin_config_param mode)
> > +{
> > +       unsigned long config = { PIN_CONF_PACKED(mode, 0) };
> > +
> > +       return gc->set_config ? gc->set_config(gc, offset, config) : -ENOTSUPP;
> > +}
> 
> I would name it gpio_set_drive_single_ended() as the open source/open
> drain is all we support here.

OK.

> >         if (test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
> >                 /* First see if we can enable open drain in hardware */
> > -               if (gc->set_single_ended) {
> > -                       ret = gc->set_single_ended(gc, gpio_chip_hwgpio(desc),
> > -                                                  LINE_MODE_OPEN_DRAIN);
> > -                       if (!ret)
> > -                               goto set_output_value;
> > -               }
> > +               ret = gpio_set_drive_mode(gc, gpio_chip_hwgpio(desc),
> > +                                         PIN_CONFIG_DRIVE_OPEN_DRAIN);
> > +               if (!ret)
> > +                       goto set_output_value;
> 
> Aha I see, so if we fail to set single ended we get to the next step.
> Nice.
> 
> >                 /* Emulate open drain by not actively driving the line high */
> >                 if (val)
> >                         return gpiod_direction_input(desc);
> >         }
> 
> (...)
> 
> > -               if (gc->set_single_ended) {
> > -                       ret = gc->set_single_ended(gc, gpio_chip_hwgpio(desc),
> > -                                                  LINE_MODE_OPEN_SOURCE);
> > -                       if (!ret)
> > -                               goto set_output_value;
> > -               }
> > +               ret = gpio_set_drive_mode(gc, gpio_chip_hwgpio(desc),
> > +                                         PIN_CONFIG_DRIVE_OPEN_SOURCE);
> >                 /* Emulate open source by not actively driving the line low */
> >                 if (!val)
> >                         return gpiod_direction_input(desc);
> 
> But here the handling seems to be wrong? You still need
> the if (!ret) goto set_output_value?

Good point. I'll fix that in the next version.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ