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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 29 May 2018 16:36:52 +0200
From:   Nicolas Ferre <nicolas.ferre@...rochip.com>
To:     Radu Pirea <radu.pirea@...rochip.com>,
        Andy Shevchenko <andy.shevchenko@...il.com>
CC:     Mark Brown <broonie@...nel.org>, <alexandre.belloni@...tlin.com>,
        Lee Jones <lee.jones@...aro.org>,
        Richard Genoud <richard.genoud@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-spi <linux-spi@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Ludovic Desroches <ludovic.desroches@...rochip.com>
Subject: Re: [PATCH v4 5/6] spi: at91-usart: add driver for at91-usart as spi

On 29/05/2018 at 16:34, Nicolas Ferre wrote:
> On 29/05/2018 at 16:28, Radu Pirea wrote:
>>
>>
>> On 05/28/2018 11:21 AM, Andy Shevchenko wrote:
>>> On Fri, May 25, 2018 at 8:19 PM, Radu Pirea <radu.pirea@...rochip.com> wrote:
>>>> This is the driver for at91-usart in spi mode. The USART IP can be configured
>>>> to work in many modes and one of them is SPI.
> 
> [..]
> 
>>>> +static int at91_usart_gpio_setup(struct platform_device *pdev)
>>>> +{
>>>
>>>> +       struct device_node      *np = pdev->dev.parent->of_node;
>>>
>>> Your driver is not OF specific as far as I can see. Drop all these
>>> device_node stuff and change API calls respectively.
>>
>> Ok. What do you suggest to use instead of OF API to get the count of
>> cs-gpios and to read their values one by one?
> 
> As Alexandre said, we can make this driver OF specific.
> 
> What could be interesting is to use the gpio descriptors API and not the
> older one. This would allow us to have far more control over the gpio
> that we use in our drivers (Ludovic is converting our drivers to only
> use gpiod structures).

Oh, but we already said that we cannot.
Disregard my comment then, sorry for the noise.

> Regards,
>     Nicolas
> 
>>
>>>
>>>> +       int                     i;
>>>
>>>> +       int                     ret = 0;
>>>> +       int                     nb = 0;
>>>
>>> What happened to indentation?
>>>
>>> Redundnant assignment for both.
>>>
>>>> +       if (!np)
>>>> +               return -EINVAL;
>>>> +
>>>> +       nb = of_gpio_named_count(np, "cs-gpios");
>>>> +       for (i = 0; i < nb; i++) {
>>>> +               int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
>>>> +
>>>> +               if (cs_gpio < 0)
>>>> +                       return cs_gpio;
>>>> +
>>>> +               if (gpio_is_valid(cs_gpio)) {
>>>> +                       ret = devm_gpio_request_one(&pdev->dev, cs_gpio,
>>>> +                                                   GPIOF_DIR_OUT,
>>>> +                                                   dev_name(&pdev->dev));
>>>> +                       if (ret)
>>>> +                               return ret;
>>>> +               }
>>>> +       }
>>>> +
>>>> +       return 0;
>>>> +}
> [..]
> 


-- 
Nicolas Ferre

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ