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:   Thu, 3 Aug 2017 09:40:10 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Joseph Chen <chenjh@...k-chips.com>
Cc:     Alexandre Courbot <gnurou@...il.com>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        "open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Tao Huang <huangtao@...k-chips.com>,
        Tony Xie <tony.xie@...k-chips.com>, zhangqing@...k-chips.com,
        David Wu <wdc@...k-chips.com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        w.egorov@...tec.de, Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        Linux Input <linux-input@...r.kernel.org>
Subject: Re: [PATCH v7 08/12] pinctrl: Add pinctrl driver for the RK805 PMIC

On Fri, Jul 21, 2017 at 1:18 PM, Joseph Chen <chenjh@...k-chips.com> wrote:

> RK805 is one of Rockchip PMICs family, it has 2 output only GPIOs.
>
> This driver is also designed for other Rockchip PMICs to expend.
> Different PMIC maybe have different pin features, for example,
> RK816 has one pin which can be used for TS or GPIO(input/out).
> The mainly difference between PMICs pins are pinmux, direction
> and output value, that is 'struct rk805_pin_config'.
>
> Signed-off-by: Joseph Chen <chenjh@...k-chips.com>

OK nice! Some comments:

> +config PINCTRL_RK805
> +       tristate "Pinctrl and GPIO driver for RK805 PMIC"
> +       depends on MFD_RK808 && GPIOLIB

Nowadays I would recommend simply:

depends on MFD_RK808
select GPIOLIB

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

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

> +#define FUNCTION_GROUP(fname, mux, gname)                      \
> +       {                                                       \
> +               .name = #fname,                                 \
> +               .groups = gname##_gpio_groups,                  \
> +               .ngroups = ARRAY_SIZE(gname##_gpio_groups),     \
> +               .mux_option = RK805_PINMUX_##mux,               \
> +       }
> +
> +#define PINGROUP(pg_name, pin_id)                              \
> +       {                                                       \
> +               .name = #pg_name,                               \
> +               .pins = {RK805_##pin_id},                       \
> +               .npins = 1,                                     \
> +       }
> +
> +/* RK805: 2 output only GPIOs */
> +static const struct pinctrl_pin_desc rk805_pins_desc[] = {
> +       PINCTRL_PIN(RK805_GPIO0, "gpio0"),
> +       PINCTRL_PIN(RK805_GPIO1, "gpio1"),
> +};
> +
> +static const struct rk805_pin_function rk805_pin_functions[] = {
> +       FUNCTION_GROUP(gpio, GPIO, rk805),
> +};
> +
> +static const struct rk805_pin_group rk805_pin_groups[] = {
> +       PINGROUP(gpio0, GPIO0),
> +       PINGROUP(gpio1, GPIO1),
> +};

It looks like the macros just obscure things? Why not simply inline the data
and open code it as it is just two pins?

Apart from this it looks nice and complete.

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ