/* Read both port 0 and port 1 registers of certain register function. 
Given the register in reg, read the pair of port 0 and port 1. */
static int read_port_regs(const struct device *dev, uint8_t reg, uint16_t *cache, uint16_t *buf)
/* Read both port 0 and port 1 registers of certain register function. 
Given the register in reg, read the pair of port 0 and port 1. */
static int read_port_regs(const struct device *dev, uint8_t reg, uint16_t *cache, uint16_t *buf)
{
	const struct gpio_pca95xx_config * const config = dev->config;
	uint16_t port_data, value;
	int ret;
	ret = i2c_burst_read_dt(&config->bus, reg, (uint8_t *)&port_data,
				sizeof(port_data));
	if (ret != 0) {
		LOG_ERR("PCA95XX[0x%X]: error reading register 0x%X (%d)",
			config->bus.addr, reg, ret);
		return ret;
	}
	value = sys_le16_to_cpu(port_data);
	*cache = value;
	*buf = value;
	LOG_DBG("PCA95XX[0x%X]: Read: REG[0x%X] = 0x%X, REG[0x%X] = 0x%X",
		config->bus.addr, reg, (*buf & 0xFF), (reg + 1), (*buf >> 8));
	return 0;
}