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: <CAHp75VdTFF0r8oiYxavoGVo9ShLLaveU1p2BNzzqVgu2eKCBaw@mail.gmail.com>
Date:   Sun, 19 Jun 2022 13:25:03 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Aidan MacDonald <aidanmacdonald.0x0@...il.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Chen-Yu Tsai <wens@...e.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Lee Jones <lee.jones@...aro.org>,
        Sebastian Reichel <sre@...nel.org>,
        Mark Brown <broonie@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Lars-Peter Clausen <lars@...afoo.de>,
        "Rafael J. Wysocki" <rafael@...nel.org>, quic_gurus@...cinc.com,
        Sebastian Reichel <sebastian.reichel@...labora.com>,
        Michael Walle <michael@...le.cc>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v3 13/16] pinctrl: Add AXP192 pin control driver

On Sun, Jun 19, 2022 at 1:20 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Sat, Jun 18, 2022 at 11:40 PM Aidan MacDonald
> <aidanmacdonald.0x0@...il.com> wrote:

Hit 'Send' accidentally, here is the rest of the review, including
previous comments.

...

> > +config PINCTRL_AXP192
> > +       tristate "X-Powers AXP192 PMIC pinctrl and GPIO Support"
> > +       depends on MFD_AXP20X
>
>
> > +       depends on OF
>
> Why?
>
> > +       select PINMUX
> > +       select GENERIC_PINCONF
> > +       select GPIOLIB
>
> ...
>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
>
> Why?

Perhaps you missed mod_devicetable.h.

> ...
>
> > +struct axp192_pctl_function {
> > +       const char              *name;
> > +       /* Mux value written to the control register to select the function (-1 if unsupported) */
>
> Comment is misleading. -1 can't be a value of unsigned type.
>
> > +       const u8                *muxvals;
> > +       const char * const      *groups;
> > +       unsigned int            ngroups;
> > +};
>
> ...
>
> > +struct axp192_pctl_desc {
> > +       unsigned int                            npins;
> > +       const struct pinctrl_pin_desc           *pins;
> > +       /* Description of the function control register for each pin */
> > +       const struct axp192_pctl_reg_info       *ctrl_regs;
> > +       /* Description of the output signal register for each pin */
> > +       const struct axp192_pctl_reg_info       *out_regs;
> > +       /* Description of the input signal register for each pin */
> > +       const struct axp192_pctl_reg_info       *in_regs;
> > +       /* Description of the pull down resistor config register for each pin */
>
> Can you just convert these comments to a kernel-doc?
>
> > +       const struct axp192_pctl_reg_info       *pull_down_regs;
> > +
> > +       unsigned int                            nfunctions;
> > +       const struct axp192_pctl_function       *functions;
> > +};
>
> ...
>
> > +
> > +
>
> One blank line is enough.
>
> ...
>
> > +       switch (param) {
> > +       case PIN_CONFIG_BIAS_DISABLE:
> > +               ret = axp192_pinconf_get_pull_down(pctldev, pin);
> > +               if (ret < 0)
> > +                       return ret;
>
> > +               else if (ret != 0)
>
> 1. Redundant 'else'
> 2. if (ret > 0)
>
> > +                       return -EINVAL;
> > +               break;
> > +
> > +       case PIN_CONFIG_BIAS_PULL_DOWN:
> > +               ret = axp192_pinconf_get_pull_down(pctldev, pin);
> > +               if (ret < 0)
> > +                       return ret;
> > +               else if (ret == 0)
>
> Ditto.
>
> Looking at this I would rather expect the function to return something
> defined, than 0, non-0.
>
> > +                       return -EINVAL;
> > +               break;
>
> > +       default:
> > +               return -ENOTSUPP;
> > +       }
>
> ...
>
> > +       for (cfg = 0; cfg < num_configs; ++cfg) {
>
> cfg++ will work the same way and easier to read.

...

You may make some lines shorter by introducing here

  struct device *dev = &pdev->dev;

> > +       struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);

dev->parent

and so on...

...

> > +       pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl);
> > +       if (IS_ERR(pctl->pctl_dev))
> > +               dev_err_probe(&pdev->dev, PTR_ERR(pctl->pctl_dev),
> > +                             "couldn't register pinctrl driver\n");

With the above it probably fits one line.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ