/* Do the transfer (low level): May use interrupt-driven or polling, depending on if an IRQ is presently registered. NOTE: Assumes data->lock is held.  */
static enum pmcmsptwi_xfer_result pmcmsptwi_do_xfer(u32 reg, struct pmcmsptwi_data *data)
/* Do the transfer (low level): May use interrupt-driven or polling, depending on if an IRQ is presently registered. NOTE: Assumes data->lock is held.  */
static enum pmcmsptwi_xfer_result pmcmsptwi_do_xfer(u32 reg, struct pmcmsptwi_data *data)
{
	dev_dbg(&pmcmsptwi_adapter.dev, "Writing cmd reg 0x%08x\n", reg);
	pmcmsptwi_writel(reg, data->iobase + MSP_TWI_CMD_REG_OFFSET);
	if (data->irq) {
		unsigned long timeleft = wait_for_completion_timeout(
						&data->wait, MSP_IRQ_TIMEOUT);
		if (timeleft == 0) {
			dev_dbg(&pmcmsptwi_adapter.dev,
				"Result: IRQ timeout\n");
			complete(&data->wait);
			data->last_result = MSP_TWI_XFER_TIMEOUT;
		}
	} else
		pmcmsptwi_poll_complete(data);
	return data->last_result;
}