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]
Date:   Tue, 16 Jan 2018 10:27:03 +0100
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Richard Fitzgerald <rf@...nsource.wolfsonmicro.com>
Cc:     Lee Jones <lee.jones@...aro.org>, Mark Brown <broonie@...nel.org>,
        Alexandre Courbot <gnurou@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jason Cooper <jason@...edaemon.net>,
        "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." 
        <alsa-devel@...a-project.org>,
        "open list:WOLFSON MICROELECTRONICS DRIVERS" 
        <patches@...nsource.wolfsonmicro.com>, linux-gpio@...r.kernel.org,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 12/17] gpio: madera: Support Cirrus Logic Madera class codecs

On Mon, Jan 15, 2018 at 1:42 PM, Richard Fitzgerald
<rf@...nsource.wolfsonmicro.com> wrote:

> This adds support for the GPIOs on Cirrus Logic Madera class codecs.
> Any pins not used for special functions (see the pinctrl driver) can be
> used as general single-bit input or output lines. The number of available
> GPIOs varies between codecs.
>
> Signed-off-by: Nariman Poushin <nariman@...nsource.wolfsonmicro.com>
> Signed-off-by: Richard Fitzgerald <rf@...nsource.wolfsonmicro.com>
> Signed-off-by: Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>
> Acked-by: Linus Walleij <linus.walleij@...aro.org>

I see Andy found more problems so fix those too..

> +#include <linux/device.h>
> +#include <linux/gpio.h>

Only
#include <linux/gpio/driver.h>

> +#include <linux/kernel.h>
> +#include <linux/module.h>

Not for bool drivers, right, as Andy pointed out.

> +static struct gpio_chip template_chip = {

Why is this named "template"?

There is nothing template about it, it is what you use.

If you keep it like this, name it madera_chip or something.

> +       .label                  = "madera",
> +       .owner                  = THIS_MODULE,
> +       .request                = gpiochip_generic_request,
> +       .free                   = gpiochip_generic_free,
> +       .get_direction          = madera_gpio_get_direction,
> +       .direction_input        = madera_gpio_direction_in,
> +       .get                    = madera_gpio_get,
> +       .direction_output       = madera_gpio_direction_out,
> +       .set                    = madera_gpio_set,
> +       .set_config             = gpiochip_generic_config,

Pretty cool! Have you tested this with e.g. open drain or debounce?

> +       ret = gpiochip_add_pin_range(&madera_gpio->gpio_chip, "madera-pinctrl",
> +                                    0, 0, madera_gpio->gpio_chip.ngpio);

Are you using device tree for this?

In that case add the range in the device tree instead.

The gpiolib will pick that up for you by default and you don't even need
this code. See
git grep 'gpio-ranges' arch/arm/boot/dts

If you're also using this with platform data or ACPI or whatever, then
this is fine.

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ