Commit ebf2ef8f613433aaffac53aef2f6703445821fc6
Committed by
Wolfram Sang
1 parent
30be774b38
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: David E. Box <david.e.box@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
drivers/i2c/busses/i2c-designware-baytrail.c
... | ... | @@ -68,6 +68,8 @@ |
68 | 68 | int ret; |
69 | 69 | unsigned long start, end; |
70 | 70 | |
71 | + might_sleep(); | |
72 | + | |
71 | 73 | if (!dev || !dev->dev) |
72 | 74 | return -ENODEV; |
73 | 75 | |
... | ... | @@ -85,7 +87,7 @@ |
85 | 87 | /* host driver waits for bit 0 to be set in semaphore register */ |
86 | 88 | start = jiffies; |
87 | 89 | end = start + msecs_to_jiffies(SEMAPHORE_TIMEOUT); |
88 | - while (!time_after(jiffies, end)) { | |
90 | + do { | |
89 | 91 | ret = get_sem(dev->dev, &sem); |
90 | 92 | if (!ret && sem) { |
91 | 93 | acquired = jiffies; |
... | ... | @@ -95,7 +97,7 @@ |
95 | 97 | } |
96 | 98 | |
97 | 99 | usleep_range(1000, 2000); |
98 | - } | |
100 | + } while (time_before(jiffies, end)); | |
99 | 101 | |
100 | 102 | dev_err(dev->dev, "punit semaphore timed out, resetting\n"); |
101 | 103 | reset_semaphore(dev->dev); |