forked from MIrrors/gasket-driver
staging: gasket: gasket_wait_with_reschedule simplify logic
gasket_wait_with_reschedule() is a little more clear if we just return directly when the waited-for condition is hit. This also allows the following condition check to be removed and identation of the conditionally-executed code to be reduced. Reported-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Zhongze Hu <frankhu@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Alex Van Damme
parent
11eb4eb149
commit
bb0f4d4a3f
@@ -2097,18 +2097,12 @@ int gasket_wait_with_reschedule(
|
|||||||
while (retries < max_retries) {
|
while (retries < max_retries) {
|
||||||
tmp = gasket_dev_read_64(gasket_dev, bar, offset);
|
tmp = gasket_dev_read_64(gasket_dev, bar, offset);
|
||||||
if ((tmp & mask) == val)
|
if ((tmp & mask) == val)
|
||||||
break;
|
return 0;
|
||||||
msleep(delay_ms);
|
msleep(delay_ms);
|
||||||
retries++;
|
retries++;
|
||||||
}
|
}
|
||||||
if (retries == max_retries) {
|
gasket_log_error(gasket_dev, "%s timeout: reg %llx timeout (%llu ms)",
|
||||||
gasket_log_error(
|
__func__, offset, max_retries * delay_ms);
|
||||||
gasket_dev,
|
return -ETIMEDOUT;
|
||||||
"%s timeout: reg %llx timeout (%llu ms)",
|
|
||||||
__func__,
|
|
||||||
offset, max_retries * delay_ms);
|
|
||||||
return -ETIMEDOUT;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(gasket_wait_with_reschedule);
|
EXPORT_SYMBOL(gasket_wait_with_reschedule);
|
||||||
|
|||||||
Reference in New Issue
Block a user