/* Reads given register from mcp23xxx. 
The registers of the mcp23x0x consist of one 8 bit port. The registers of the mcp23x1x consist of two 8 bit ports. */
static int read_port_regs(const struct device *dev, uint8_t reg, uint16_t *buf)
/* Reads given register from mcp23xxx. 
The registers of the mcp23x0x consist of one 8 bit port. The registers of the mcp23x1x consist of two 8 bit ports. */
static int read_port_regs(const struct device *dev, uint8_t reg, uint16_t *buf)
{
	const struct mcp23xxx_config *config = dev->config;
	if (config->ngpios == 16U) {
		reg *= 2;
	}
	return config->read_fn(dev, reg, buf);
}