Пример #1
0
static int pca_isa_waitforinterrupt(struct i2c_algo_pca_data *adap)
{
	int ret = 0;

	if (irq > -1) {
		ret = wait_event_interruptible(pca_wait,
					       pca_isa_readbyte(adap, I2C_PCA_CON) & I2C_PCA_CON_SI);
	} else {
		while ((pca_isa_readbyte(adap, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0) 
			udelay(100);
	}
	return ret;
}
static int pca_isa_waitforcompletion(void *pd)
{
	int ret = 0;

	if (irq > -1) {
		ret = wait_event_interruptible(pca_wait,
					       pca_isa_readbyte(pd, I2C_PCA_CON) & I2C_PCA_CON_SI);
	} else {
		while ((pca_isa_readbyte(pd, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0)
			udelay(100);
	}
	return ret;
}
static int pca_isa_waitforcompletion(void *pd)
{
	long ret = ~0;
	unsigned long timeout;

	if (irq > -1) {
		ret = wait_event_interruptible_timeout(pca_wait,
				pca_isa_readbyte(pd, I2C_PCA_CON)
				& I2C_PCA_CON_SI, pca_isa_ops.timeout);
	} else {
		/* Do polling */
		timeout = jiffies + pca_isa_ops.timeout;
		while (((pca_isa_readbyte(pd, I2C_PCA_CON)
				& I2C_PCA_CON_SI) == 0)
				&& (ret = time_before(jiffies, timeout)))
			udelay(100);
	}
	return ret > 0;
}
Пример #4
0
static int pca_isa_waitforcompletion(void *pd)
{
	unsigned long timeout;
	long ret;

	if (irq > -1) {
		ret = wait_event_timeout(pca_wait,
				pca_isa_readbyte(pd, I2C_PCA_CON)
				& I2C_PCA_CON_SI, pca_isa_ops.timeout);
	} else {
		/* Do polling */
		timeout = jiffies + pca_isa_ops.timeout;
		do {
                        ret = time_before(jiffies, timeout);
                        if (pca_isa_readbyte(pd, I2C_PCA_CON)
                                        & I2C_PCA_CON_SI)
                                break;
			udelay(100);
		} while (ret);
	}
	return ret > 0;
}