Revert "tpm_tis: Use timeouts returned from TPM"

This reverts commit 9b29050f8f75916f974a2d231ae5d3cd59792296.

It has caused hibernate regressions, for example Juri Sladby's report:

"I'm unable to hibernate 2.6.37.1 unless I rmmod tpm_tis:
[10974.074587] Suspending console(s) (use no_console_suspend to debug)
[10974.103073] tpm_tis 00:0c: Operation Timed out
[10974.103089] legacy_suspend(): pnp_bus_suspend+0x0/0xa0 returns -62
[10974.103095] PM: Device 00:0c failed to freeze: error -62"

and Rafael points out that some of the new conditionals in that commit
seem to make no sense. This commit needs more work and testing, let's
revert it for now.

Reported-by: Norbert Preining <preining@logic.at>
Reported-and-requested-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: Guillaume Chazarain <guichaz@gmail.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+3 -21
+2 -16
drivers/char/tpm/tpm.c
··· 577 577 if (rc) 578 578 return; 579 579 580 - if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || 581 - be32_to_cpu(tpm_cmd.header.out.length) 582 - != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) 580 + if (be32_to_cpu(tpm_cmd.header.out.return_code) 581 + != 3 * sizeof(u32)) 583 582 return; 584 - 585 583 duration_cap = &tpm_cmd.params.getcap_out.cap.duration; 586 584 chip->vendor.duration[TPM_SHORT] = 587 585 usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); ··· 938 940 return str - buf; 939 941 } 940 942 EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); 941 - 942 - ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr, 943 - char *buf) 944 - { 945 - struct tpm_chip *chip = dev_get_drvdata(dev); 946 - 947 - return sprintf(buf, "%d %d %d\n", 948 - jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]), 949 - jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]), 950 - jiffies_to_usecs(chip->vendor.duration[TPM_LONG])); 951 - } 952 - EXPORT_SYMBOL_GPL(tpm_show_timeouts); 953 943 954 944 ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, 955 945 const char *buf, size_t count)
-2
drivers/char/tpm/tpm.h
··· 56 56 char *); 57 57 extern ssize_t tpm_show_temp_deactivated(struct device *, 58 58 struct device_attribute *attr, char *); 59 - extern ssize_t tpm_show_timeouts(struct device *, 60 - struct device_attribute *attr, char *); 61 59 62 60 struct tpm_chip; 63 61
+1 -3
drivers/char/tpm/tpm_tis.c
··· 376 376 NULL); 377 377 static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); 378 378 static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); 379 - static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); 380 379 381 380 static struct attribute *tis_attrs[] = { 382 381 &dev_attr_pubek.attr, ··· 385 386 &dev_attr_owned.attr, 386 387 &dev_attr_temp_deactivated.attr, 387 388 &dev_attr_caps.attr, 388 - &dev_attr_cancel.attr, 389 - &dev_attr_timeouts.attr, NULL, 389 + &dev_attr_cancel.attr, NULL, 390 390 }; 391 391 392 392 static struct attribute_group tis_attr_grp = {