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

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

 



Hi Marek,

...

> +static bool exynos5_i2c_poll_irqs_timeout(struct exynos5_i2c *i2c,
> +					  unsigned long timeout)
> +{
> +	unsigned long time_left = jiffies + timeout;
> +
> +	while (time_before(jiffies, time_left) &&
> +	       !((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);
> +	}
> +	return time_before(jiffies, time_left);
> +}
> +
>  static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c,
>  			      struct i2c_msg *msgs, int stop)
>  {
> @@ -725,8 +746,13 @@ static int exynos5_i2c_xfer_msg(struct exynos5_i2c *i2c,
>  
>  	exynos5_i2c_message_start(i2c, stop);
>  
> -	timeout = wait_for_completion_timeout(&i2c->msg_complete,
> -					      EXYNOS5_I2C_TIMEOUT);
> +	if (!i2c->atomic)
> +		timeout = wait_for_completion_timeout(&i2c->msg_complete,
> +						      EXYNOS5_I2C_TIMEOUT);
> +	else
> +		timeout = exynos5_i2c_poll_irqs_timeout(i2c,
> +							EXYNOS5_I2C_TIMEOUT);

what's a bit bothering here is that one function returns a
boolean while the other returns a timeout stored in an unsigned
long.

Anyway, exynos5_i2c_poll_irqs_timeout() is used only here as a
boolean, so that I guess it's fine.

Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx> 

Andi



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux