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: <CAH7FV3nfkihmc9UTvmGC7kL=tO40CL4350smc4FKiLVdsesxkA@mail.gmail.com>
Date:   Mon, 1 Nov 2021 21:45:07 -0300
From:   Maíra Canal <maira.canal@....br>
To:     Lucas Stach <l.stach@...gutronix.de>
Cc:     hongxing.zhu@....com, lorenzo.pieralisi@....com, robh@...nel.org,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Bjorn Helgaas <helgaas@...nel.org>, shawnguo@...nel.org,
        s.hauer@...gutronix.de, kernel@...gutronix.de, linux-imx@....com,
        linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 RESEND] PCI: imx6: Replace legacy gpio interface for
 gpiod interface

Em seg., 1 de nov. de 2021 às 11:58, Lucas Stach
<l.stach@...gutronix.de> escreveu:
>
> Am Montag, dem 01.11.2021 um 11:44 -0300 schrieb Maíra Canal:
> > ?
> > > >       /* Some boards don't have PCIe reset GPIO. */
> > > > -     if (gpio_is_valid(imx6_pcie->reset_gpio)) {
> > > > -             gpio_set_value_cansleep(imx6_pcie->reset_gpio,
> > > > +     if (imx6_pcie->reset_gpio) {
> > > > +             gpiod_set_value_cansleep(imx6_pcie->reset_gpio,
> > > >                                       imx6_pcie->gpio_active_high);
> > > >               msleep(100);
> > > > -             gpio_set_value_cansleep(imx6_pcie->reset_gpio,
> > > > +             gpiod_set_value_cansleep(imx6_pcie->reset_gpio,
> > > >                                       !imx6_pcie->gpio_active_high);
> > >
> > > I don't think this is correct. gpiod_set_value sets the logical line
> > > state, so if the GPIO is specified as active-low in the DT, the real
> > > line state will be negated. The only reason why the reset-gpio-active-
> > > high property even exists is that old DTs might specify the wrong GPIO
> > > polarity in the reset-gpio DT description. I think you need to use to
> > > gpiod_set_raw_value API here to get the expected real line state even
> > > with a broken DT description.
> > >
> > > Regards,
> > > Lucas
> > >
> >
> > I'm a beginner in kernel development, so I'm sorry for the question.
> > If I change gpiod_set_value_cansleep for gpiod_set_raw_value, wouldn't
> > I change the behavior of the driver? I replaced
> > gpio_set_value_cansleep for gpiod_set_value_cansleep because they have
> > the same behavior and I didn't change the logic states. Thank you for
> > the feedback!
>
> Yes, you need to use the _cansleep variant of the API to keep the
> context information. The point I was trying to make was that you
> probably (please double check, that's just an assumption on my side)
> need to use the _raw variant of the gpiod API to keep the current
> behavior of the driver, as we are setting the physical line state
> purely depending on the reset-gpio-active-high property presence, not
> the logical line state, which would take into account the polarity
> specified in the DT gpio descriptor.
>
> I guess the right API call here would be
> gpiod_set_raw_value_cansleep().

I got it now. Thank you for your attention! I will send the v3 with
the correction.

>
> Regards,
> Lucas
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ