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