Even with the obvious bug fixed, that code is strange. "temp_size >>=
1" does little to improve the chances of the mtrr_add succeeding.
Something like this would be better:
if (mtrr_add(video_base, temp_size, MTRR_TYPE_WRCOMB, 1) == -EINVAL) {
/* Find the largest power-of-two */
while (temp_size & (temp_size - 1))
temp_sze &= (temp_size - 1);
mtrr_add(video_base, temp_size, MTRR_TYPE_WRCOMB, 1);
}
(But this is just a very crude way to work around the inflexibility of
the MTRRs. Rather than cluttering up calls to mtrr_add, it would be
better to fix this properly, either by implementing PAT support
(Zoltán Böszörményi said he was working on that), or by having a
user-space helper program to make more intelligent MTRR allocations,
or both.)
David Wragg
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/