CHROMIUM: tpm: reconcile mainline changes with resume strategy
authorLuigi Semenzato <semenzato@chromium.org>
Tue, 22 May 2012 23:55:38 +0000 (16:55 -0700)
committerOlof Johansson <olof@lixom.net>
Fri, 1 Jun 2012 06:56:51 +0000 (23:56 -0700)
commit754f558ea844c00eeea4442afa01cc9cdad54ad6
tree81bbb687c83666329a2fc5a5fad58c3e769654eb
parent9d0c267e456341ae557674e12b65118f71a810f2
CHROMIUM: tpm: reconcile mainline changes with resume strategy

Our local changes were no longer compatible with the mainline changes
to tpm_continue_selftest.  This introduces the helper function
tpm_continue_selftest_nocheck, which avoids recursion in transmit_cmd.
A large comment also attempts to explain more clearly what is going
on.

The new mainline function tpm_do_selftest hides differences between
TPMs by calling tpm_continue_selftest, then checking if the self test
has completed or not.  (TPM_ContinueSelfTest unfortunately allows
both behaviors.)  This probably works fine, but it would add hundreds
of milliseconds to our resume path.

This fix is necessary because our version of tpm_continue_selftest
was not returning an error code, but the length of the response packet,
which was interpreted as a weird error code.

To test, I ran "powerd_suspend; tpmc getvf", looked at the log, and
noted that waiting for the self test to complete would have cost us
over 300ms.

BUG=chromium-os:31065
TEST=manual test

Change-Id: Iff09a9759c31ea93cd58c7ba32114b04e67e2359
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/23299
Reviewed-by: Grant Grundler <grundler@chromium.org>
drivers/char/tpm/tpm.c