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]
Message-ID: <CACRpkdbtkLjzMqRKzd3ppmwZ9hZESL4+zGOf7-uqjuF==Wm=3A@mail.gmail.com>
Date:   Tue, 17 Nov 2020 21:59:06 +0100
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@...hiba.co.jp>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Punit Agrawal <punit1.agrawal@...hiba.co.jp>,
        yuji2.ishikawa@...hiba.co.jp,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/4] gpio: visoconti: Add Toshiba Visconti GPIO support

Hi Nobuhiro,

On Thu, Nov 12, 2020 at 12:42 AM Nobuhiro Iwamatsu
<nobuhiro1.iwamatsu@...hiba.co.jp> wrote:

> Add the GPIO driver for Toshiba Visconti ARM SoCs.
>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@...hiba.co.jp>

I just noticed this:

> +config GPIO_VISCONTI
> +       tristate "Toshiba Visconti GPIO support"
> +       depends on ARCH_VISCONTI || COMPILE_TEST
> +       depends on OF_GPIO
> +       select GPIOLIB_IRQCHIP
> +       help
> +         Say yes here to support GPIO on Tohisba Visconti.

Add:
select GPIO_GENERIC

Then all of these:

> +static int visconti_gpio_get(struct gpio_chip *chip, unsigned int offset)
> +static void visconti_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
> +static int visconti_gpio_get_dir(struct gpio_chip *chip, unsigned int offset)
> +static int visconti_gpio_dir_in(struct gpio_chip *chip, unsigned int offset)
> +static int visconti_gpio_dir_out(struct gpio_chip *chip, unsigned int offset, int value)

Can be implemented by the genric MMIO GPIO library.

> +       gpio_chip = &priv->gpio_chip;
> +       gpio_chip->label = name;
> +       gpio_chip->owner = THIS_MODULE;
> +       gpio_chip->parent = dev;
> +       gpio_chip->request = gpiochip_generic_request;
> +       gpio_chip->free = gpiochip_generic_free;
> +       gpio_chip->get = visconti_gpio_get;
> +       gpio_chip->set = visconti_gpio_set;
> +       gpio_chip->get_direction = visconti_gpio_get_dir;
> +       gpio_chip->direction_input = visconti_gpio_dir_in;
> +       gpio_chip->direction_output = visconti_gpio_dir_out;
> +       gpio_chip->base = 0;
> +       gpio_chip->ngpio = VISCONTI_GPIO_NR;
> +       gpio_chip->irq.init_valid_mask = visconti_init_irq_valid_mask;

Initialized the generic helpers using the addresses of the
GPIO registers here by a call to bgpio_init().

Check this driver for an example:
drivers/gpio/gpio-ftgpio010.c

If you get uncertain about the arguments to bgpio_init()
check drivers/gpio/gpio-mmio.c, there is kerneldoc for the
function.

By doing this you get implementations of gpio_[get|set]_multiple()
for free.

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ