History

i2c: designware-baytrail: baytrail_i2c_acquire() might sleep

This patch marks baytrail_i2c_acquire() that it might sleep. Also it chages while-loop to do-while and, though it is matter of taste, gives a chance to check one more time before report a timeout.

Andy Shevchenko committed 11 years ago

Commit ebf2ef81 parent 30be7741 file · +4 −2Browse files

Unified · Split

drivers/i2c/busses/i2c-designware-baytrail.c+4−2
@@ -68,6 +68,8 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) · 67 unmodified lines
6868 int ret;
6969 unsigned long start, end;
7070
71+ might_sleep();
72+
7173 if (!dev || !dev->dev)
7274 return -ENODEV;
7375
@@ -85,7 +87,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) · 11 unmodified lines
8587 /* host driver waits for bit 0 to be set in semaphore register */
8688 start = jiffies;
8789 end = start + msecs_to_jiffies(SEMAPHORE_TIMEOUT);
88− while (!time_after(jiffies, end)) {
90+ do {
8991 ret = get_sem(dev->dev, &sem);
9092 if (!ret && sem) {
9193 acquired = jiffies;
@@ -95,7 +97,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev) · 3 unmodified lines
9597 }
9698
9799 usleep_range(1000, 2000);
98− }
100+ } while (time_before(jiffies, end));
99101
100102 dev_err(dev->dev, "punit semaphore timed out, resetting\n");
101103 reset_semaphore(dev->dev);