Commit e5871372 authored by Linus Torvalds's avatar Linus Torvalds

Revert "tpm_tis: Use timeouts returned from TPM"

This reverts commit 9b29050f.

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: default avatarNorbert Preining <preining@logic.at>
Reported-and-requested-by: default avatarJiri 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: default avatarRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b4c9bfab
...@@ -577,11 +577,9 @@ void tpm_get_timeouts(struct tpm_chip *chip) ...@@ -577,11 +577,9 @@ void tpm_get_timeouts(struct tpm_chip *chip)
if (rc) if (rc)
return; return;
if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || if (be32_to_cpu(tpm_cmd.header.out.return_code)
be32_to_cpu(tpm_cmd.header.out.length) != 3 * sizeof(u32))
!= sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32))
return; return;
duration_cap = &tpm_cmd.params.getcap_out.cap.duration; duration_cap = &tpm_cmd.params.getcap_out.cap.duration;
chip->vendor.duration[TPM_SHORT] = chip->vendor.duration[TPM_SHORT] =
usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short));
...@@ -941,18 +939,6 @@ ssize_t tpm_show_caps_1_2(struct device * dev, ...@@ -941,18 +939,6 @@ ssize_t tpm_show_caps_1_2(struct device * dev,
} }
EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); EXPORT_SYMBOL_GPL(tpm_show_caps_1_2);
ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct tpm_chip *chip = dev_get_drvdata(dev);
return sprintf(buf, "%d %d %d\n",
jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),
jiffies_to_usecs(chip->vendor.duration[TPM_LONG]));
}
EXPORT_SYMBOL_GPL(tpm_show_timeouts);
ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
......
...@@ -56,8 +56,6 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, ...@@ -56,8 +56,6 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr,
char *); char *);
extern ssize_t tpm_show_temp_deactivated(struct device *, extern ssize_t tpm_show_temp_deactivated(struct device *,
struct device_attribute *attr, char *); struct device_attribute *attr, char *);
extern ssize_t tpm_show_timeouts(struct device *,
struct device_attribute *attr, char *);
struct tpm_chip; struct tpm_chip;
......
...@@ -376,7 +376,6 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, ...@@ -376,7 +376,6 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated,
NULL); NULL);
static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL);
static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
static struct attribute *tis_attrs[] = { static struct attribute *tis_attrs[] = {
&dev_attr_pubek.attr, &dev_attr_pubek.attr,
...@@ -386,8 +385,7 @@ static struct attribute *tis_attrs[] = { ...@@ -386,8 +385,7 @@ static struct attribute *tis_attrs[] = {
&dev_attr_owned.attr, &dev_attr_owned.attr,
&dev_attr_temp_deactivated.attr, &dev_attr_temp_deactivated.attr,
&dev_attr_caps.attr, &dev_attr_caps.attr,
&dev_attr_cancel.attr, &dev_attr_cancel.attr, NULL,
&dev_attr_timeouts.attr, NULL,
}; };
static struct attribute_group tis_attr_grp = { static struct attribute_group tis_attr_grp = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment