On Mon, Jan 30, 2023 at 09:59:55PM +0100, Levente Révész wrote: > The driver supports 8 chip types, 6 of which have extended registers > with various functions, e.g. pull-up and pull-down bias for the gpio > lines or interrupt masking. To allow supporting these functions, the > driver has to be able to calculate the addresses of these registers. > > Replace the address calculation scheme with new reg_addr() and check_reg() > functions, one for each register layout. The new functions can work with > all of the extended registers. The functions have been tested with the > register layout of each compatible chip. ... > +/* > + * Register types: > + * - Single register: 1 byte for each GPIO port. > + * - Double register: 2 bytes for each GPIO port. > + * - One-byte register: Only a single byte. We use term "bank". > + */ ... > + * Returns -1 if reg_addr is invalid. Use proper error code. ... > + * Convert register address to register enum value. > + * Returns -1 if reg_addr is invalid. Ditto. -- With Best Regards, Andy Shevchenko