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: <CAHp75VePJ76nhwX-1cyo-uD=2+w4dbyGNhazJzKkkQOfDma6aQ@mail.gmail.com>
Date:   Mon, 13 Mar 2023 14:24:47 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Francesco Dolcini <francesco@...cini.it>
Cc:     linux-gpio@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Emanuele Ghidoli <emanuele.ghidoli@...adex.com>,
        linux-kernel@...r.kernel.org,
        Francesco Dolcini <francesco.dolcini@...adex.com>
Subject: Re: [PATCH v2 2/2] gpio: fxl6408: add I2C GPIO expander driver

On Mon, Mar 13, 2023 at 1:33 PM Francesco Dolcini <francesco@...cini.it> wrote:
>
> From: Emanuele Ghidoli <emanuele.ghidoli@...adex.com>
>
> Add minimal driver for Fairchild FXL6408 8-bit I2C-controlled GPIO expander
> using the generic regmap based GPIO driver (GPIO_REGMAP).
>
> The driver implements setting the GPIO direction, reading inputs
> and writing outputs.
>
> In addition to that the FXL6408 has the following functionalities:
> - allows to monitor input ports for data transitions with an interrupt pin
> - all inputs can be configured with pull-up or pull-down resistors

Thank you for the update, my comments below.

...

+ Co-developed-by: your name + email ?

> Signed-off-by: Francesco Dolcini <francesco.dolcini@...adex.com>

...

> +config GPIO_FXL6408
> +       tristate "FXL6408 I2C GPIO expander"
> +       select GPIO_REGMAP

> +       select REGMAP_I2C

Somebody pointed out that this might require

    depends on I2C

being added as well.

...

> +#include <linux/gpio/regmap.h>
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/regmap.h>

Missing kernel.h for ARRAY_SIZE(), but I prefer the array_size.h to
appear (nevertheless, the latter is out of scope of this one).
Missing err.h for error handling macros.

...

> +#define FXL6408_MAX_REGISTER           0x13

This is used as a range, but why? If we can have a proper name for
this register, why bother dumping all this or even having access to?

...

> +static int fxl6408_identify(struct device *dev, struct regmap *regmap)
> +{
> +       int val, ret;
> +
> +       ret = regmap_read(regmap, FXL6408_REG_DEVICE_ID, &val);
> +       if (ret) {
> +               dev_err(dev, "error %d reading DEVICE_ID\n", ret);
> +       } else if (val >> FXL6408_MF_SHIFT != FXL6408_MF_FAIRCHILD) {
> +               dev_err(dev, "invalid device id 0x%02x\n", val);
> +               ret = -ENODEV;
> +       }
> +
> +       return ret;

This function is only used at ->probe(), you may refactor it like

       ret = regmap_read(regmap, FXL6408_REG_DEVICE_ID, &val);
       if (ret)
               return dev_err_probe(dev, ret, "error reading DEVICE_ID\n");
       if (val >> FXL6408_MF_SHIFT != FXL6408_MF_FAIRCHILD)
               return dev_err_probe(dev, -ENODEV, "invalid device id
0x%02x\n", val);

       return 0;

> +}

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ