Re: [PATCH] i2c: exynos5: add support for atomic transfers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marek,

> >> +static unsigned long exynos5_i2c_polled_irqs_timeout(struct exynos5_i2c *i2c,
> >> +						     unsigned long timeout_ms)
> >> +{
> >> +	ktime_t start, now;
> >> +
> >> +	start = now = ktime_get();
> >> +	while (ktime_ms_delta(now, start) < timeout_ms &&
> >> +	       !((i2c->trans_done && (i2c->msg->len == i2c->msg_ptr)) ||
> >> +	         (i2c->state < 0))) {
> >> +		while (readl(i2c->regs + HSI2C_INT_ENABLE) &
> >> +		       readl(i2c->regs + HSI2C_INT_STATUS))
> >> +			exynos5_i2c_irq(i2c->irq, i2c);
> >> +		usleep_range(100, 200);
> >> +		now = ktime_get();
> >> +	}
> >> +	return ktime_ms_delta(now, start) < timeout_ms;
> > what are you returning here?
> 
> Values similar to wait_for_completion_timeout(); 0 means timeout and 
> non-zero that the waiting condition has been reached, please check how 
> it is used in exynos5_i2c_xfer_msg(). Maybe the function should be named 
> a bit different, but I had no good idea so far.

but you are returning a boolean here. Make it a boolean then, no?

It's true that the timeout is treated as a 1/0, but still it's a
bit misleading.

Andi



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux