[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZFEyWH9PmtJIyeCK@surfacebook>
Date: Tue, 2 May 2023 18:55:04 +0300
From: andy.shevchenko@...il.com
To: Okan Sahin <okan.sahin@...log.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>,
linux-gpio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] gpio: ds4520: Add ADI DS4520 GPIO Expander Support
Tue, May 02, 2023 at 02:05:16AM +0300, Okan Sahin kirjoitti:
> The DS4520 is a 9-bit nonvolatile (NV) I/O expander.
> It offers users a digitally programmable alternative
> to hardware jumpers and mechanical switches that are
> being used to control digital logic node.
...
> +#include <linux/device.h>
> +#include <linux/gpio/driver.h>
> +#include <linux/gpio/regmap.h>
> +#include <linux/i2c.h>
Missing property.h.
> +#include <linux/regmap.h>
...
> +#define NUMBER_OF_GPIO 9
> +
> +#define PULLUP0 0xF0
> +#define IO_CONTROL0 0xF2
> +#define IO_STATUS0 0xF8
No namespace for the above?
...
> + struct gpio_regmap_config config = {0};
0 is not needed.
> + ngpio = NUMBER_OF_GPIO;
Do you really need this? Can Device Tree be sufficient here? (We have a
GPIO-wide property for that).
...
> + ret = device_property_read_u32(dev, "reg", &base);
> + if (ret)
> + return -EINVAL;
Why shadowing error?
...
> + regmap = devm_regmap_init_i2c(client, &ds4520_regmap_config);
> + if (IS_ERR(regmap)) {
> + ret = PTR_ERR(regmap);
> + dev_err_probe(dev, ret,
> + "Failed to allocate register map\n");
> + return ret;
return dev_err_probe();
> + }
...
> + config.ngpio = ngpio;
Why do you use temporary variable ngpio and not assign directly here?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists