base: genlock: Use a signed long for the result from wait_timeout

interruptible_wait_timeout returns a signed long, so make sure that
we use a signed long to hold the result. Using an unsigned value would
horribly misinterpet an error such as -ERESTARTSYS.

CRs-Fixed: 341347
Change-Id: Ic0dedbadff2dbe404e68a2a78f6282b5976d05c1
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:
Jordan Crouse 2012-03-20 14:09:29 -06:00 committed by Stephen Boyd
parent 4c754ec211
commit af3dc3f05a

View file

@ -288,7 +288,7 @@ static int _genlock_lock(struct genlock *lock, struct genlock_handle *handle,
{
unsigned long irqflags;
int ret = 0;
unsigned int ticks = msecs_to_jiffies(timeout);
unsigned long ticks = msecs_to_jiffies(timeout);
spin_lock_irqsave(&lock->lock, irqflags);
@ -359,7 +359,7 @@ static int _genlock_lock(struct genlock *lock, struct genlock_handle *handle,
/* Wait while the lock remains in an incompatible state */
while (lock->state != _UNLOCKED) {
unsigned int elapsed;
signed long elapsed;
spin_unlock_irqrestore(&lock->lock, irqflags);
@ -373,7 +373,7 @@ static int _genlock_lock(struct genlock *lock, struct genlock_handle *handle,
goto done;
}
ticks = elapsed;
ticks = (unsigned long) elapsed;
}
dolock:
@ -447,7 +447,7 @@ int genlock_wait(struct genlock_handle *handle, uint32_t timeout)
struct genlock *lock;
unsigned long irqflags;
int ret = 0;
unsigned int ticks = msecs_to_jiffies(timeout);
unsigned long ticks = msecs_to_jiffies(timeout);
if (IS_ERR_OR_NULL(handle)) {
GENLOCK_LOG_ERR("Invalid handle\n");
@ -474,7 +474,7 @@ int genlock_wait(struct genlock_handle *handle, uint32_t timeout)
}
while (lock->state != _UNLOCKED) {
unsigned int elapsed;
signed long elapsed;
spin_unlock_irqrestore(&lock->lock, irqflags);
@ -488,7 +488,7 @@ int genlock_wait(struct genlock_handle *handle, uint32_t timeout)
break;
}
ticks = elapsed;
ticks = (unsigned long) elapsed;
}
done: