summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-designware-baytrail.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2015-02-10 18:06:10 +0100
committerWolfram Sang <wsa@the-dreams.de>2015-03-07 01:08:26 +0100
commitebf2ef8f613433aaffac53aef2f6703445821fc6 (patch)
treef6e0d87de4c2532d3bab76885038a13159a7c844 /drivers/i2c/busses/i2c-designware-baytrail.c
parenti2c: designware-baytrail: cross-check lock functions (diff)
downloadlinux-ebf2ef8f613433aaffac53aef2f6703445821fc6.tar.xz
linux-ebf2ef8f613433aaffac53aef2f6703445821fc6.zip
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>
Diffstat (limited to 'drivers/i2c/busses/i2c-designware-baytrail.c')
-rw-r--r--drivers/i2c/busses/i2c-designware-baytrail.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c b/drivers/i2c/busses/i2c-designware-baytrail.c
index 036d9bdc0aaa..7d7ae97476e2 100644
--- a/drivers/i2c/busses/i2c-designware-baytrail.c
+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
@@ -68,6 +68,8 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
int ret;
unsigned long start, end;
+ might_sleep();
+
if (!dev || !dev->dev)
return -ENODEV;
@@ -85,7 +87,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
/* host driver waits for bit 0 to be set in semaphore register */
start = jiffies;
end = start + msecs_to_jiffies(SEMAPHORE_TIMEOUT);
- while (!time_after(jiffies, end)) {
+ do {
ret = get_sem(dev->dev, &sem);
if (!ret && sem) {
acquired = jiffies;
@@ -95,7 +97,7 @@ static int baytrail_i2c_acquire(struct dw_i2c_dev *dev)
}
usleep_range(1000, 2000);
- }
+ } while (time_before(jiffies, end));
dev_err(dev->dev, "punit semaphore timed out, resetting\n");
reset_semaphore(dev->dev);