提交 4f701d1e 编写于 作者: A Alan Cox 提交者: Jeff Garzik

ata_timing: ensure t->cycle is always correct

Russell King hit a case where quantisation errors accumulated such that
the cycle time was shorter than rather than equal to the active/recovery
time. The code already knows how to stretch times to fit the cycle time
but does not know about the reverse.
Signed-off-by: NAlan Cox <alan@redhat.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 c1c4e8d5
......@@ -2639,6 +2639,12 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
t->active += (t->cycle - (t->active + t->recover)) / 2;
t->recover = t->cycle - t->active;
}
/* In a few cases quantisation may produce enough errors to
leave t->cycle too low for the sum of active and recovery
if so we must correct this */
if (t->active + t->recover > t->cycle)
t->cycle = t->active + t->recover;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册