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