Commit 955df4f8 authored by Lino Sanfilippo's avatar Lino Sanfilippo Committed by Jarkko Sakkinen
Browse files

tpm, tpm_tis: Claim locality when interrupts are reenabled on resume



In tpm_tis_resume() make sure that the locality has been claimed when
tpm_tis_reenable_interrupts() is called. Otherwise the writings to the
register might not have any effect.

Fixes: 45baa1d1 ("tpm_tis: Re-enable interrupts upon (S3) resume")
Signed-off-by: default avatarLino Sanfilippo <l.sanfilippo@kunbus.com>
Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
parent 0e069265
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -1225,28 +1225,27 @@ int tpm_tis_resume(struct device *dev)
	struct tpm_chip *chip = dev_get_drvdata(dev);
	int ret;

	ret = tpm_tis_request_locality(chip, 0);
	if (ret < 0)
		return ret;

	if (chip->flags & TPM_CHIP_FLAG_IRQ)
		tpm_tis_reenable_interrupts(chip);

	ret = tpm_pm_resume(dev);
	if (ret)
		return ret;
		goto out;

	/*
	 * TPM 1.2 requires self-test on resume. This function actually returns
	 * an error code but for unknown reason it isn't handled.
	 */
	if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
		ret = tpm_tis_request_locality(chip, 0);
		if (ret < 0)
			return ret;

	if (!(chip->flags & TPM_CHIP_FLAG_TPM2))
		tpm1_do_selftest(chip);

out:
	tpm_tis_relinquish_locality(chip, 0);
	}

	return 0;
	return ret;
}
EXPORT_SYMBOL_GPL(tpm_tis_resume);
#endif