Commit 36ce0897 authored by Jerry Snitselaar's avatar Jerry Snitselaar Committed by Jarkko Sakkinen

tpm: don't return bool from update_timeouts

Set tpm_chip->timeouts_adjusted directly in the update_timeouts
code instead of returning bool. In case of tpm read failing
print warning that the read failed and continue on.
Signed-off-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 08a8112a
...@@ -380,7 +380,6 @@ int tpm1_get_timeouts(struct tpm_chip *chip) ...@@ -380,7 +380,6 @@ int tpm1_get_timeouts(struct tpm_chip *chip)
* of misreporting. * of misreporting.
*/ */
if (chip->ops->update_timeouts) if (chip->ops->update_timeouts)
chip->timeout_adjusted =
chip->ops->update_timeouts(chip, timeout_eff); chip->ops->update_timeouts(chip, timeout_eff);
if (!chip->timeout_adjusted) { if (!chip->timeout_adjusted) {
......
...@@ -521,35 +521,38 @@ static const struct tis_vendor_timeout_override vendor_timeout_overrides[] = { ...@@ -521,35 +521,38 @@ static const struct tis_vendor_timeout_override vendor_timeout_overrides[] = {
(TIS_SHORT_TIMEOUT*1000), (TIS_SHORT_TIMEOUT*1000) } }, (TIS_SHORT_TIMEOUT*1000), (TIS_SHORT_TIMEOUT*1000) } },
}; };
static bool tpm_tis_update_timeouts(struct tpm_chip *chip, static void tpm_tis_update_timeouts(struct tpm_chip *chip,
unsigned long *timeout_cap) unsigned long *timeout_cap)
{ {
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev); struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
int i, rc; int i, rc;
u32 did_vid; u32 did_vid;
chip->timeout_adjusted = false;
if (chip->ops->clk_enable != NULL) if (chip->ops->clk_enable != NULL)
chip->ops->clk_enable(chip, true); chip->ops->clk_enable(chip, true);
rc = tpm_tis_read32(priv, TPM_DID_VID(0), &did_vid); rc = tpm_tis_read32(priv, TPM_DID_VID(0), &did_vid);
if (rc < 0) if (rc < 0) {
dev_warn(&chip->dev, "%s: failed to read did_vid: %d\n",
__func__, rc);
goto out; goto out;
}
for (i = 0; i != ARRAY_SIZE(vendor_timeout_overrides); i++) { for (i = 0; i != ARRAY_SIZE(vendor_timeout_overrides); i++) {
if (vendor_timeout_overrides[i].did_vid != did_vid) if (vendor_timeout_overrides[i].did_vid != did_vid)
continue; continue;
memcpy(timeout_cap, vendor_timeout_overrides[i].timeout_us, memcpy(timeout_cap, vendor_timeout_overrides[i].timeout_us,
sizeof(vendor_timeout_overrides[i].timeout_us)); sizeof(vendor_timeout_overrides[i].timeout_us));
rc = true; chip->timeout_adjusted = true;
} }
rc = false;
out: out:
if (chip->ops->clk_enable != NULL) if (chip->ops->clk_enable != NULL)
chip->ops->clk_enable(chip, false); chip->ops->clk_enable(chip, false);
return rc; return;
} }
/* /*
......
...@@ -41,7 +41,7 @@ struct tpm_class_ops { ...@@ -41,7 +41,7 @@ struct tpm_class_ops {
int (*send) (struct tpm_chip *chip, u8 *buf, size_t len); int (*send) (struct tpm_chip *chip, u8 *buf, size_t len);
void (*cancel) (struct tpm_chip *chip); void (*cancel) (struct tpm_chip *chip);
u8 (*status) (struct tpm_chip *chip); u8 (*status) (struct tpm_chip *chip);
bool (*update_timeouts)(struct tpm_chip *chip, void (*update_timeouts)(struct tpm_chip *chip,
unsigned long *timeout_cap); unsigned long *timeout_cap);
int (*go_idle)(struct tpm_chip *chip); int (*go_idle)(struct tpm_chip *chip);
int (*cmd_ready)(struct tpm_chip *chip); int (*cmd_ready)(struct tpm_chip *chip);
......
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